Planning and Reasoning in Agents
8 min read
How ReAct, chain-of-thought, and structured planning patterns help agents decompose and solve complex tasks.
Simple agents pick a single tool and execute. More capable agents plan: they decompose a complex goal into sub-tasks, reason about dependencies, adapt when steps fail, and know when the plan needs revision. Several prompt-level patterns can dramatically improve planning quality.
ReAct: reasoning and acting together
The ReAct pattern (Reasoning + Acting) instructs the model to alternate between a Thought step — where it reasons about what to do and why — and an Action step, where it selects and executes a tool. The resulting trace is interpretable, making it far easier to debug failures than with a model that jumps directly to action.
Thought: The user wants a summary of Q3 revenue. I need to find the quarterly report first.
Action: search_documents(query="Q3 2024 revenue report")
Observation: Found finance/q3-2024-report.pdf
Thought: I have the document path. Now I should read its content.
Action: read_file(path="finance/q3-2024-report.pdf")
Observation: [full document text ...]
Thought: I now have the data. I can write the summary.
Answer: Q3 revenue was $42.3M, up 18% year-over-year ...Structured planning with a plan step
For multi-step tasks, add an explicit planning phase before the action loop. In the plan step, ask the model to write out all the sub-tasks it expects to complete, in order, before taking any action. This forces the model to think about dependencies and common failure points up front, reducing wasted tool calls mid-execution.
Chain-of-thought in agentic contexts
Chain-of-thought prompting is especially valuable in agents because the reasoning trace becomes part of the context that influences subsequent steps. A model that writes out its reasoning in a scratchpad block tends to make more consistent decisions across the loop than one that responds only with action calls.
- ReAct pattern: alternate Thought / Action / Observation until done
- Plan-then-execute: write the full plan first, then iterate through steps
- Scratchpad: give the model a dedicated reasoning section before it commits to an action
- Self-critique: add a step where the model reviews its plan for errors before executing
If your agent keeps making the wrong tool choice, add a Thought step and log the reasoning. Usually the model reveals the misunderstanding clearly in the thought text, which points directly to the fix — often a clearer tool description or a better task framing.
More planning tokens mean more reasoning quality but also higher cost and latency. For simple single-step tasks, full ReAct is overkill. Match the planning overhead to the task complexity.