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