Chapter 14: Search and Tree Reasoning
Lecture
Chapter principle
Key takeaways
- Search delays commitment by keeping several candidate paths open.
- It needs a state, a generator, an evaluator and a search policy, bounded by a budget.
- More candidates help only if viable alternatives are generated and can be evaluated.
- Pruning saves resources but can discard the eventual best branch.
- Best-of-N searches answers; trees search intermediate states.
- Prefer external verification; compare with simpler baselines.
Experiments
Every experiment in the book is small, runnable and printed with its real output. In the Lab you can replay a recorded real run of each one, with no programming, and watch what the model and the agent do.
Experiment 26: Searching several paths
Does exploring several paths beat committing to one?
The puzzle: start at 2 and reach exactly 13 with exactly two operations, each one of +3, ×2 or +9. The only answer is ×2, then +9. First a real model answers directly, five times. Then code tries every first move, a judge decides which branches are worth keeping, and code checks every path through a kept branch. The judge is the model three times, then an exact check that tries every last move. This is a recorded run of a real model. A new run may give different answers.
All the code for this chapter: github.com/agentic-engineering-book/code
Download the bookBrowse all chapters