Chapter 12: Planning
Lecture
Chapter principle
Key takeaways
- Planning creates an intermediate representation of intended future work.
- Plans can expose dependencies, coverage, and opportunities for coordination.
- Validate a plan against known capabilities and constraints.
- Execution tests the assumptions embedded in a plan.
- Replanning needs an explicit trigger.
- Measure planning quality and execution quality separately.
- More planning is not automatically better.
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 23: Check a plan before running it
Can checking a plan before it runs catch its mistakes?
A real model acts as a planner. The goal: find the price of 3 units of product A and 2 units of product B, then compute the total. Two tools exist: a price lookup, which gives prices in euros, and a calculator. The model replies with a whole plan, a list of steps, before anything runs. Software then checks that every step uses a tool that exists, and only then runs the plan. The model plans three times for the total, then three times for the total in US dollars. No tool can turn euros into dollars. This is a recorded run of a real model. A new run may produce different plans.
Experiment 24: Plan, execute, replan
What should an agent do when its plan stops matching the world?
A car must get from the start to D. Route A is shorter than route B, but route A is blocked, and nobody knows that at the start. Three controllers are compared, each allowed four moves. Reactive: a real model chooses one move at a time and sees what each move did. Plan-first: a real model plans the whole route, and the program follows the plan no matter what. Plan and replan: the same, but a failed move sends the planner back to work with what was learned. This is a recorded run of a real model. A new run may differ.
All the code for this chapter: github.com/agentic-engineering-book/code
Download the bookBrowse all chapters