Planning
≈ Workflow Orchestration / Saga Pattern / Finite State Machine (FSM)
> Agentic Definition
Planning is the capability of an agent to break down a high-level, ambiguous user goal into a sequence of executable steps (a plan), and then execute them, maintaining the state of progress. It allows agents to tackle tasks that are too complex to be solved in a single turn.
> Description
The capability of an agent to break down a high-level, ambiguous user goal into a sequence of executable steps (a plan), and then execute them while maintaining the state of progress.
Before: Static Workflow
1def handle_return_order():2 # Hardcoded sequence3 validate_payment()4 check_inventory()5 ship_replacement()6 email_user()After: Dynamic Planning
1# The Planner Agent generates the DAG at runtime2# Framework: LangGraph / AutoGen3plan = planner_agent.generate_plan(4 goal="Handle a return for a damaged item"5)67# Generated Plan (Dynamic):8# 1. Ask user for photo of damage (Reasoning: Policy requires proof)9# 2. Verify purchase history10# 3. Generate shipping label11# 4. Refund wallet1213for step in plan:14 executor_agent.execute(step)15 # Agent updates plan if a step fails (e.g., photo invalid)≈ Similarity
Both involve managing a sequence of dependent tasks to achieve a complex goal. Both must manage state (which step are we on?) and dependencies (Step B requires Step A).
≠ Divergence
Standard workflows (e.g., Airflow DAGs, AWS Step Functions) are static and defined at compile-time by the engineer. Agentic plans are dynamic and generated at run-time by the model. The agent builds its own DAG (Directed Acyclic Graph) based on the specific request, allowing it to handle novel situations that the programmer did not foresee.
> Production Considerations
- [01]Agents often get stuck in loops or generate invalid plans (e.g., skipping a prerequisite). Reliability requires careful guardrails.
- [02]Evaluating planners is difficult. You must verify not just the final output, but the validity of the generated plan logic. Is the plan optimal? Is it safe?
- [03]Planning takes time upfront ("Time to First Token" is high). Latency-sensitive applications need to balance planning depth with responsiveness.
> Key Takeaway
Adapt: You are moving from "Imperative Programming" (telling the machine how to do it) to "Declarative Goal Setting" (telling the machine what to achieve). You build the planner, not the plan.
Mission: Build a Multi-Step Task Executor
Create a system that takes a complex goal, breaks it into a step-by-step plan, executes each step, and can re-plan when a step fails.
> Drag blocks to the canvas
Planner Agent
Decomposes a goal into an ordered list of steps
Step Executor
Executes a single step from the plan
Progress Monitor
Checks if the step succeeded before proceeding
Re-Planner
Revises the plan when a step fails or conditions change
Sentiment Analyzer
Analyzes emotional tone
Result Merger
Merges parallel outputs
Drop blocks here to build your agent pipeline
Arrange them in the correct order
Frequently Asked Questions
When should I use the Planning pattern?
Planning is the capability of an agent to break down a high-level, ambiguous user goal into a sequence of executable steps (a plan), and then execute them, maintaining the state of progress. It allows agents to tackle tasks that are too complex to be solved in a single turn.
How does Planning relate to Workflow Orchestration / Saga Pattern / Finite State Machine (FSM)?
Both involve managing a sequence of dependent tasks to achieve a complex goal. Both must manage state (which step are we on?) and dependencies (Step B requires Step A). However, there is a key divergence: Standard workflows (e.g., Airflow DAGs, AWS Step Functions) are static and defined at compile-time by the engineer. Agentic plans are dynamic and generated at run-time by the model. The agent builds its own DAG (Directed Acyclic Graph) based on the specific request, allowing it to handle novel situations that the programmer did not foresee.
What are the production trade-offs of Planning?
Agents often get stuck in loops or generate invalid plans (e.g., skipping a prerequisite). Reliability requires careful guardrails. Evaluating planners is difficult. You must verify not just the final output, but the validity of the generated plan logic. Is the plan optimal? Is it safe? Planning takes time upfront ("Time to First Token" is high). Latency-sensitive applications need to balance planning depth with responsiveness.