Overview

5 Reasoning: How your agent decides what to do next

The chapter frames reasoning as an architectural control problem, not just “thinking longer.” An agent needs a clear representation of goal, current state, evidence, and constraints so it can produce an inspectable decision artifact rather than an opaque answer. It also stresses that private model reasoning, visible decision records, and action-and-evidence traces are different things: the first may help generation, but only the latter two belong in application-owned governance and audit.

From there, the chapter presents four reusable patterns for deciding how an agent should proceed. Chain-like reasoning makes intermediate claims explicit when dependencies matter; complexity-based routing chooses the right model, effort, or fallback based on difficulty and consequence; parallel exploration preserves genuinely distinct alternatives before committing; and iterative hypothesis testing lets external evidence revise the active explanation. Across all four, the key idea is to match reasoning structure to the task, budget, risk, and available evidence instead of assuming one generic approach fits every request.

The chapter repeatedly warns against mistaking fluent rationales, self-reported confidence, or a long trace for proof. Good design records what was seen, what was tried, what changed, and why a step was accepted or rejected, while keeping recovery authority and consequential actions separate from reasoning itself. In practice, the best system may sometimes use a chain, sometimes route to a faster path, sometimes branch, sometimes probe the world, and sometimes bypass model reasoning entirely in favor of ordinary code and governance.

Reasoning shifts from prompt-elicited steps to trained reasoning models and then to adaptive system allocation of models, effort, tools, branches, and evidence.
Three ways to externalize intermediate reasoning. None should be confused with a guaranteed export of the model's private reasoning.
Complexity-Based Routing selects a reasoning policy, while consequence can override the cheap path and require governed handling.
Tree of Thoughts applied to itinerary planning. The agent does not commit to expanding a branch until it has compared it against siblings.
Iterative Hypothesis Testing seeks discriminating evidence, updates the active explanation, and stops when the next cycle cannot justify its cost or authority.
The four reasoning patterns compose around a shared contract and an inspectable decision artifact; no fixed escalation order is required.
Valid compositions include independent policy interpretation, an early external probe, and minimal reasoning with strong governance.

Summary

  • Chain-of-Thought externalizes selected claims and dependencies. Treat visible rationales as diagnostic records, not faithful exports of private model reasoning or proof of correctness.
  • Complexity-Based Routing selects a policy, model, effort, evidence path, or human fallback. Difficulty allocates reasoning capacity; consequence overrides the cheap path with governance.
  • Parallel Exploration preserves materially different candidates under a branch budget and convergence rule. Independence of frames matters more than agent count.
  • Iterative Hypothesis Testing uses bounded external observations to support or refute live explanations. Evidence collection does not automatically grant recovery authority.
  • Reasoning depth is one engineering variable among several. Represented state, evidence requirements, consequences, latency, cost, stopping rules, and replay results determine the design.
  • Reasoning traces and execution traces are different artifacts. Retain the decision record and the external evidence needed to inspect the completed run.
  • Stronger reasoning models change what can happen inside one response, but they do not remove application-owned routing, branch control, semantic input contracts, evidence checks, or governance boundaries.

FAQ

What is reasoning in an AI agent?Reasoning is the controlled transformation of a goal, current state, evidence, and constraints into an inspectable decision artifact. The result should capture the conclusion or plan, the evidence it depends on, uncertainty, and what the next component should do next.
Why should private model reasoning be separated from decision records and execution traces?Because they serve different purposes. Private reasoning belongs to the model runtime, a decision record is application-owned and reviewable, and an action-and-evidence trace records what the system actually did. None of them, by itself, proves the full causal basis of a decision.
Why isn't a generated rationale proof that a model made the right decision?A generated rationale is still just a claim about the decision, not proof of how the model internally arrived there. It may be fluent and useful for review, but it can be unfaithful, incomplete, or omit the real causal factors.
When should an agent use Chain-of-Thought style reasoning?Use it when a decision depends on a sequence of claims and the important intermediate claims can be checked against evidence or invariants. It is useful for dependency visibility, targeted repair, and reviewable decision records, but not for simple lookups or deterministic transformations.
What is the main risk of Chain-of-Thought reasoning in production?The main risk is that the chain may be fluent but unfaithful, or it may become too long, too costly, or too convincing without improving correctness. The goal is to make decisive claims easier to check, not to produce more narration.
What is Complexity-Based Routing?It is the pattern of selecting a reasoning policy before spending resources. The router can choose deterministic code, a smaller or larger model, an evidence-gathering path, parallel search, or human review based on difficulty, consequence, evidence needs, latency, and cost.
Why should consequence be handled separately from difficulty in routing?Because something can be easy to understand and still highly consequential. A simple but high-impact request may need approval, containment, or extra evidence even if it does not require deep reasoning.
When is Parallel Exploration worth the cost?When several materially different alternatives remain plausible and committing early would be expensive. The branches should be genuinely independent, not paraphrases of the same idea, and the branch budget should be justified by measurable gain over a single-path baseline.
What is Iterative Hypothesis Testing?It is a reasoning loop that lets external evidence change the active explanation. The agent forms a hypothesis, chooses a discriminating test, observes the result, updates its view, and either converges, changes direction, or stops.
How should the four reasoning patterns be composed?Start with a reasoning contract that defines the decision, represented state, acceptable evidence, constraints, uncertainty tolerance, and stopping condition. Then route the request to deterministic handling, one pattern, or a composition of patterns such as a chain inside a branch, a loop fed by parallel candidates, or an early external probe before deeper reasoning.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents ebook for free