Planning: make a plan before acting
Make the agent write an explicit, ordered plan before it acts, execute the steps, and replan when reality breaks the plan.
What it is
Planning means the agent writes down the steps *before* it touches anything. Instead of reacting one move at a time, it produces an explicit, ordered plan — then executes it.
- It splits the work in two: deciding what to do and actually doing it.
- The plan is a first-class artifact you can read, check, and revise — not hidden inside the model's head.
- When reality breaks the plan, the agent replans instead of blundering ahead.
When to use it
Reach for planning when the task has shape that a single step can't capture.
- Multi-step goals where order matters — book the flight before the hotel, not after.
- Long-horizon tasks where reacting step-by-step loses the thread or loops.
- Work you want to inspect or approve before it runs — the plan is your checkpoint.
- Pairs well with reflection (critique the plan) and goal monitoring (track progress against it).
Skip it for one-shot or trivial tasks. A lookup or single tool call doesn't need a plan — planning just adds latency and tokens. See routing for picking the cheap path.
How it works
Two phases: plan, then execute.
- The agent takes the goal and emits an ordered list of steps, e.g.
["search flights", "pick cheapest", "book", "email itinerary"]. - An executor walks the steps, calling tools for each one and feeding results forward.
- After each step it checks: did this succeed, and is the rest of the plan still valid?
- If a step fails or returns surprising data — no flights under budget — the agent replans from the current state instead of forcing the stale plan.
The plan can be plain text, a structured list, or a small task graph. Keep it explicit so you can log and audit it — see observability.
Watch out for
- Stale plans. A plan made up front goes wrong mid-run. Always re-check validity and replan — a plan with no replan loop is just a brittle script.
- Over-planning small tasks. Generating a 7-step plan for a one-line answer burns tokens and time. Gate planning behind task complexity; watch your cost control.
- Plans that ignore real constraints. The model invents steps using tools or data that don't exist. Ground the planner in the actual available tools.
- Endless replanning. If every step triggers a rewrite, cap replans and fail loudly instead of looping forever.
Related patterns
Goal setting & monitoring: track progress to a target
Give the agent an explicit target plus a way to measure progress, so loops terminate on done, stuck, or off-track instead of wandering until they run out of tokens.
Reasoning techniques: think before you answer
Reasoning techniques trade extra tokens for accuracy on hard problems — chain-of-thought, self-consistency voting, ReAct's think-act loop, and tree search — but only when the failure is reasoning, not facts.
Multi-agent: split roles, coordinate the work
Break a hard job into specialized agents with narrow roles and separate context windows, then coordinate their work through an orchestrator or a structured exchange.