Agentic Engineering from First Principles All chaptersLecturesLabDownload the book
Part V · Engineering Reliable Agents

Chapter 27: Budgets and Stopping

Central questionHow does an agent know when to stop? Not only because it has finished, but because additional autonomy is no longer worth the cost, the time, the uncertainty, or the risk.

Lecture

Chapter principle

Autonomy must earn continuation. At every step, continued autonomy should remain inside permissions, resource limits, deadlines, and acceptable risk. When it no longer does, the correct behaviour is to stop, degrade, verify, or escalate.

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 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

This is Chapter 27 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 26: SecurityChapter 28: Coding Agents →