Chapter 27: Budgets and Stopping
Lecture
Chapter principle
Key takeaways
- Enforce budgets during execution: check before acting, not only afterwards.
- Step, cost, time, token, tool, and child-agent limits control different resources.
- Delegation must not create budget from nothing; reserve some for recovery.
- Stopping can depend on completion, verification, stability, marginal value, resources, or risk.
- A risk budget is distinct from a money budget, and the autonomy envelope can contract.
- Termination reasons should be explicit, observable, and evaluable.
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 51: Resource budgets
How does an agent stop when the answer never comes?
A real research agent is asked to find the primary study behind a claim about coffee. Every search returns another blog post, never the study. It runs three times: with no budget (only a safety net of 20 steps), with a limit of 5 steps and a cost of 0.10, and with a limit of 2 steps. Each search costs 0.03, in made-up units. The budget is asked before every search, never after. This is a recorded run of a real model; a new run may search a different number of times.
Experiment 52: Risk budget and autonomy envelope
Can many small, allowed actions add up to too much risk?
A real model plans a task: tell three customers that an outage is fixed, then delete the outage record. Each action has a risk score: draft 1, send an email 3, delete a record 8. Software first checks each action on its own against a single-action limit of 8. Then the plan runs inside an autonomy envelope: a total risk budget of 10 that every action uses up, plus a cost budget. In a second run, sensitive data turns up at step 2 and the risk budget shrinks to 2. This is a recorded run of a real model; a new run may plan differently.
All the code for this chapter: github.com/agentic-engineering-book/code
Download the bookBrowse all chapters