Planning loops

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

  1. Plan step: agent is prompted to produce a step-by-step plan for the task. Output is a structured list of actions.
  2. Execute step: orchestrator walks the plan, calling tools at each step. Agent can call for replanning if something changes.
  3. Final step: agent synthesizes results into a final answer.

When planning helps

When planning doesn't help

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:

On trigger, agent generates a new plan from the current state.

Plan quality is prompt quality

A good plan-step prompt tells the model: