Planning loops
📖 3 min readUpdated 2026-04-19
A ReAct agent makes decisions one step at a time. A planning agent thinks about the whole problem first, produces a plan, then executes. The plan gives the system structure; the execution stays flexible.
The plan-then-execute pattern
- Plan step: agent is prompted to produce a step-by-step plan for the task. Output is a structured list of actions.
- Execute step: orchestrator walks the plan, calling tools at each step. Agent can call for replanning if something changes.
- Final step: agent synthesizes results into a final answer.
When planning helps
- Tasks with many steps where the full shape is knowable up front
- When you want to review the plan before execution (safety, cost control)
- When steps are independent and parallelizable
- When failures mid-task benefit from a "restart from step N" recovery
When planning doesn't help
- Exploratory tasks where each step's result changes the next step radically
- Tasks where you genuinely don't know what the plan looks like until you start
- Low-latency use cases (planning step adds one LLM call)
Hybrid: plan + react
Most modern systems use a hybrid: produce a high-level plan, then run ReAct within each plan step. Plan gives structure, ReAct handles tactics.
Replanning
Real tasks don't go according to plan. Build replanning triggers:
- Tool returned unexpected result
- Cost exceeded budget for a plan step
- User intervened with new info
- Multiple steps failed
On trigger, agent generates a new plan from the current state.
Plan quality is prompt quality
A good plan-step prompt tells the model:
- The high-level goal
- Available tools
- Constraints (budget, time, safety)
- Format for the plan output
- Instructions to prefer fewer steps over more