liveBook · Manning

Chapter 5: Agent reasoning and planning

What you will learn in chapter 5 of AI Agents in Action, Second Edition

Introduces decomposition and planning as distinct, necessary parts of LLM reasoning and explains why distinguishing their failures matters for agents.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces decomposition and planning as distinct, necessary parts of LLM reasoning and explains why distinguishing their failures matters for agents.

Key terms: decomposition, planning, subproblems, agency

5.1 Understanding LLM reasoning and planning

The section explains why agents need explicit planning structures, contrasts non-reasoning and reasoning models, and introduces CoT and ReAct as distinct ways to structure reasoning.

Key terms: decomposition, planning structures, world model, non-reasoning LLMs, reasoning models, single forward pass, deliberation phase, tokens, latency, chain-of-thought (CoT)

5.1.1 Chain-of-thought reasoning

This section explains how chain-of-thought prompting structures an LLM’s reasoning, illustrates it with a time-travel problem, and describes its benefits and limits.

Key terms: chain-of-thought (CoT) prompting, intermediate reasoning steps, chain of thought, 26 days, viewpoints and references, CoT prompting, token usage, latency

5.1.2 Reasoning, acting, observing: The ReAct paradigm

This section explains ReAct as a feedback-driven cycle of reasoning, action, and observation, and shows how an agent framework runs that cycle.

Key terms: ReAct, CoT, thought steps, action steps, observation, feedback loop, agent framework, tool/MCP call, process loop, final reply

5.1.3 Planning with LLMs

The section explains how LLM planning gives multistep work a longer-term, explicit plan that can be revised as execution reveals new information.

Key terms: planning, CoT, ReAct, longer horizon, explicit plan, memory, scratchpad, conversation context, persistent state, foundational model

5.2 Instructing agents to reason and plan

This section distinguishes the LLM’s reasoning role from the surrounding agent system that turns reasoning into real-world work.

Key terms: agent, LLM, tools, memory, orchestration logic, environment

5.2.1 Applying CoT to an agent

This section shows that a simple agent can produce a visible chain-of-thought process when instructed to think step by step.

Key terms: CoT, agent instructions, step by step, agent’s output

5.2.2 Implementing ReAct with agents

This section explains how agent instructions apply ReAct through repeated tool use, notes a visibility limitation of the example, and positions ReAct and CoT as techniques for relatively simple problems.

Key terms: ReAct, reasoning, act, observe, tool call, agent instructions, step-by-step thought process, logging, tool traces, CoT

5.3 Advanced reasoning patterns with agents

Explains when explicit reasoning is worth its cost for an agent and when to consider specialized patterns beyond CoT and ReAct.

Key terms: explicit reasoning structures, CoT, ReAct, single forward pass, tree-of-thought (ToT), Reflexion

5.3.1 Tree-of-thought

This section explains tree-of-thought as an explicit search over reasoning branches, including its workflow, suitable problems, implementation needs, and costs.

Key terms: tree-of-thought (ToT), chain-of-thought (CoT), candidate reasoning paths, thought tree, branches, evaluation, pruning, maximum search depth, single prompt, external orchestration code

5.3.2 Reflexion

This section explains how Reflexion revises an agent’s answer using critique, how it differs from tree-of-thought, and what a solver–critic implementation requires.

Key terms: Reflexion, self-critique, context, ToT, depth versus breadth, iterative refinement, solver–critic agent flow, solver agent, critic agent, dynamic instructions

5.3.3 Selecting the right pattern for your agents

The section explains that reasoning patterns should be chosen for the use case and notes a shared planning limitation of four common strategies.

Key terms: reasoning strategies, best practices, simple LLM, CoT, ReAct, planning

5.4 Utilizing the sequential thinking MCP server

The section explains how agents use the sequential thinking MCP server as external working memory to maintain and revise their reasoning and plans.

Key terms: sequential thinking (ST) MCP server, working memory scratchpad, intermediate outputs, high-level strategic plans, global strategic plan

5.4.1 Unchaining the sequential thinking server

This section shows how an agent encounters the sequential thinking server’s tool and clarifies that the tool tracks thoughts rather than reasoning on its own.

Key terms: SequentialThinking, scratch pad, thought tracker, ST server, SequentialThinking tool, tool description, ST, ReAct, ToT, prompt

5.4.2 Revisiting time travel problems with sequential thinking

The section uses a time-travel agent’s traces to show sequential thinking alongside tool actions, while noting that the agent can still give a wrong answer.

Key terms: sequential-thinking tool, time travel tools, Traces page, ReAct pattern, sequential thinking, model, wrong answer

5.4.3 Advanced reasoning with sequential thinking

This section combines reasoning patterns with a sequential thinking server and explains when that approach is useful, costly, or impractical.

Key terms: sequential thinking server, CoT, ReAct, ToT, Reflexion, reasoning scratchpad, tokens, underlying model, low latency, correct answer

5.5 Exercises

Five exercises ask the reader to modify and check agents using chain-of-thought, ReAct, sequential thinking, tree-of-thought, and Reflexion.

5.6 Summary

The chapter summary connects structured reasoning patterns with practical choices for building agents that can plan, use tools, revise their work, and validate results.

Where this is used later

Concepts explained in this chapter

← Chapter 4: Architecting and building multi-agent systems Chapter 6: Working with memory and knowledge RAG for agents →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.