5 Agent reasoning and planning
The chapter explains that agent reasoning begins with an LLM’s ability to break a problem into smaller tasks and organize them into a plan. It contrasts non-reasoning models, which mainly predict tokens and tend to handle one step at a time, with reasoning-capable models that can more naturally decompose goals and coordinate actions. The chapter also emphasizes that even when a model can reason, developers often still need to guide how that reasoning happens so agent behavior becomes more consistent and reproducible.
It then introduces several practical patterns for prompting and structuring reasoning. Chain of Thought encourages step-by-step problem solving and makes the model’s intermediate steps visible, which helps with debugging and improves performance on structured problems. ReAct extends this by interleaving reasoning, tool use, and observation in a loop, allowing the agent to update its plan based on new information. Planning adds a broader, longer-horizon layer that helps the model maintain a global view of a task and coordinate multiple subgoals, especially when conditions change and a prior plan must be revised.
For more difficult cases, the chapter presents advanced strategies such as Tree of Thought, which explores multiple candidate reasoning paths and prunes weak branches, and Reflexion, which uses critique and feedback to improve future attempts. It also introduces the Sequential Thinking MCP server as a scratchpad for structured reasoning, helping agents store, revise, and revisit thoughts across complex tasks. Throughout, the chapter stresses that no single strategy fits every case: simpler problems can often be handled with CoT or ReAct, while ambiguous, multi-step, or error-prone problems may benefit from ToT, Reflexion, or Sequential Thinking, despite their higher cost in latency and tokens.
compares differences to prompting strategies with reasoning and non-reasoning models
compares the LLM thought process when using CoT prompting on the left and not using any explicit reasoning instructions.
demonstrates the ReAct paradigm of reasoning in a sequential diagram. The agent thought process occurs in the loop where the LLM first reasons, plans and then executes on the plan. After each execution of a task (tool) the LLM observes the output and then reasons if it needs to continue looping or the plan has been completed.
shows a partial workflow of the tree of thought process where thoughts are branched into nodes and each node is executed to determine which is the best path to follow.
illustrates the Reflexion reasoning strategy in a step-by-step flowchart. Each step in the flow demonstrates a task, decision, or output that can occur in an LLM or deterministic code.
shows the Traces page for the Time Travel Agent execution, from here we can see how the agent goes through the ReAct pattern of reasoning, acting, observing and reasoning again.
Summary
- Large Language Models don’t “think” by default—they’re token-predictors—so agents must inject structured reasoning and planning to achieve multi-step goals.
- Chain-of-Thought (CoT) prompting turns a model’s hidden intuition into explicit, step-by-step thoughts that are easy to debug, at the cost of extra tokens and latency.
- ReAct augments CoT with tool calls: Reason → Act → Observe → Repeat, letting an agent gather information dynamically while iteratively refining its plan.
- High-level planning goes beyond single chains: agents can ask an LLM to draft a strategic outline, then revise it as real-world feedback arrives.
- Tree-of-Thoughts (ToT) explores many branches in parallel, pruning losers and expanding promising paths—powerful for complex search tasks but extremely token-hungry.
- Reflexion wraps a solver–critic loop around any reasoning strategy: the critic provides feedback, the solver revises, and the cycle repeats until the answer passes a self-defined check.
- Choosing a strategy is task-dependent: CoT for logic puzzles, ReAct for tool-heavy look-ups, ToT for deep planning, Reflexion for iterative improvement—mix and match as needs evolve.
- The Sequential Thinking MCP server acts as a universal “scratchpad” tool; agents write, revise, and branch thoughts there while still using ReAct or ToT patterns externally.
- Combining strategies scales up reasoning: e.g. CoT to draft a plan, ReAct+ToT to execute/branch it, Reflexion to self-grade and retry—expect high latency but high reliability.
- Guardrails, schemas, and typed outputs remain essential; reasoning output should be validated just like any other agent I/O to avoid cascading errors.
- Model choice matters: newer reasoning-native models (e.g. GPT-4o family) handle these patterns with fewer prompts, but even base models can reason when coached properly.
- Keep tool lists lean; every additional tool inflates ReAct loops and Sequential Thinking calls—scope each agent to < 10 highly relevant tools.
- A production-ready reasoning agent pairs structured prompts, the right reasoning strategy, Sequential Thinking for thought tracking, and guardrails for validation—yielding plans that can adjust, retry, and successed autonomously.
AI Agents in Action, Second Edition ebook for free