Token budget
Last verified: June 2026· definition
Autonomous agents fail in an expensive direction. A loop that cannot make progress will keep trying — re-reading files, re-running a failing test, re-planning — and each iteration costs money. Without a ceiling, the failure mode is a surprise invoice.
Budgets work at two levels. A hard cap (max tokens per response, max iterations per loop) is enforced by your code and the model is unaware of it. A softer task budget tells the model how much it has for the whole job so it can prioritize and wrap up gracefully rather than being cut off mid-thought.
Budgets pair with observability: the cap stops the bleeding, the trace tells you which route bled and why. Both belong in any agent harness before it runs unattended.