Agentic Engineering from First Principles All chaptersLecturesLabDownload the book
Part III · Making Agents Think and Work

Chapter 14: Search and Tree Reasoning

Central questionWhen is exploring multiple candidate paths better than committing to the first plausible path?

Lecture

Chapter principle

Search is useful only when alternatives can be evaluated. And remember that search amplifies whatever the evaluator rewards. It can amplify competence, and it can amplify evaluator bias.

Key takeaways

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

This is Chapter 14 of Agentic Engineering from First Principles: thirty chapters, a case study and fifty-nine executable experiments, from a single model call to controlled, self-improving agents.
Download the bookBrowse all chapters
← Chapter 13: ReflectionChapter 15: Routing →