Overview

5 Reasoning: How your agent decides what to do next

Reasoning in an AI agent is presented as a controlled transformation of a goal, current state, evidence, and constraints into an inspectable decision artifact. The key architectural move is to distinguish private model deliberation from the application-owned records that can actually be inspected: a decision record that explains claims, evidence, uncertainty, and next-step guidance, and an action-and-evidence trace that records what the harness observed and did. This separation matters because fluent explanations are not proof, private reasoning is not an audit trail, and no amount of extra context or longer thinking can recover facts that were never represented clearly in the first place.

The chapter organizes reasoning into four patterns that answer different control questions. Chain-of-thought makes important intermediate claims explicit when dependencies need to be checked; complexity-based routing chooses the right policy, model, effort level, or fallback based on difficulty, evidence needs, latency, and consequence; parallel exploration preserves genuinely different alternatives before commitment; and iterative hypothesis testing lets external observations change the active explanation through bounded experiments. In each case, the point is not to maximize how much the model thinks, but to place the right kind of reasoning around the right boundary, with explicit budgets, stopping rules, and evidence contracts.

Across these patterns, the chapter repeatedly warns against common failures: unfaithful rationales, false simplicity, branch duplication, confirmation bias, confidence drift, and over-trusting generated scores or summaries. Good design measures completed outcomes, evidence coverage, routing regret, branch diversity, and cost against accepted baselines rather than treating polished prose as success. The overall message is that an agent should reason over represented state it can justify, use the cheapest adequate pattern, and keep governance separate from deliberation so that even a correct answer does not cross an inappropriate action boundary.

Reasoning shifts from prompt-elicited steps to trained reasoning models and then to adaptive system allocation of models, effort, tools, branches, and evidence.
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.
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.
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.
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.
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.
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.
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 architecture?Reasoning is the controlled transformation of a goal, current state, evidence, and constraints into an inspectable decision artifact. It is not just “thinking harder”; it produces something the rest of the system can review, govern, or use to choose the next step.
Why is private model reasoning different from a decision record?Private model reasoning belongs to the model runtime and may be hidden, summarized, or encrypted by the provider. A decision record is application-owned output that can expose claims, evidence references, uncertainty, route, and stopping reasons, but it is still only a claim about the decision, not proof of the model’s internal computation.
Why can’t an action-and-evidence trace prove the agent’s reasoning?An action-and-evidence trace records what the harness observed and did, such as tool calls, searches, results, and state transitions. It can reconstruct what happened, but it does not by itself prove why those actions support the conclusion or expose the model’s private reasoning.
When should a system use Chain-of-Thought style reasoning?Use Chain-of-Thought when a decision depends on a sequence of claims and the important intermediate claims can be checked against evidence or invariants. It is most useful when explicit dependencies help later review or repair, and less useful for simple lookups, formatting, or deterministic transformations.
What is the main purpose of complexity-based routing?Complexity-Based Routing selects the reasoning policy before resources are spent. It chooses between deterministic code, a smaller or larger model, evidence gathering, parallel search, or human review based on difficulty, consequence, evidence needs, latency, and cost.
Why should consequence be separated from difficulty in routing?Difficulty determines how much capacity a request needs, but consequence determines what controls it needs. A request can be easy yet highly consequential, so it may still require verification, approval, containment, or human oversight even if it does not need deep reasoning.
What makes parallel exploration worth using?Parallel exploration is worth using when several materially different candidates remain plausible and committing early would be expensive. It is useful only if the branches are genuinely independent and the added diversity is likely to improve accepted outcomes enough to justify the branch cost.
How does iterative hypothesis testing differ from ordinary tool use?Iterative hypothesis testing treats external evidence as something that can change the active explanation. The loop maintains hypotheses, predicts what evidence would appear under true and false cases, runs bounded experiments, and stops when evidence is sufficient, ambiguous, or no longer informative.
What are the biggest failure modes of these reasoning patterns?Common failures include unfaithful chains, false simplicity in routing, shallow or duplicate branches in parallel search, confirmation bias in hypothesis testing, and confidence drift when repeated effort creates the illusion of progress. In all cases, the fix is to preserve evidence, use explicit contracts, and measure accepted outcomes rather than polished narration.
How should the four reasoning patterns be composed in a real agent?Start with a reasoning contract that defines the decision, state, evidence, constraints, uncertainty tolerance, and stopping condition. Then combine routing, chains, parallel branches, or hypothesis loops as needed; there is no fixed escalation order, and a stable judgment can even be compiled into ordinary code when that becomes the best design.

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


Close
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 Designing AI Agents ebook for free
Close
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 Designing AI Agents ebook for free