By the time a run's dollar cost looks wrong, the run has been wrong for a long time. Its step count knew first: loops are step-shaped before they are dollar-shaped, and a budget on steps catches them while they are still cheap.
The short answer
Give every run a step budget counted at the gateway — every model call, tool call, delegation and retry decrements it — sized from your real completed runs at roughly twice the 95th-percentile length. When the budget ends, the run stops and summarises what it achieved, or escalates to a human who can extend it deliberately. Pair step budgets with spend caps rather than choosing between them: cheap-call loops are caught by steps, expensive drift by dollars, and each covers the other's blind spot.
Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.
Worked example: a 40-step job that took 11,000 steps
Halloway Research, a fictional competitive-intelligence firm, ran a briefing agent whose typical job — gather, dedupe, summarise — took 30 to 45 steps. A source site's layout change broke its extractor; the agent treated each malformed page as a new lead and kept expanding the frontier. The run reached 11,214 steps over 26 hours and $286 before a client asked why their briefing was late. The steps had announced the failure in the first hour: at step 300 the run was already seven times longer than any successful briefing in the firm's history.
Halloway set a step budget of 120 for briefing runs — nearly three times the normal length — with a summarise-and-escalate ending: at the budget, the agent delivers the best briefing it has and flags the gap. In six months the budget has ended 14 runs early. Eleven were genuine tool or source failures caught within the hour; three were legitimately large briefings a human extended in one tap. Average stopped cost across the fourteen: $9.60. The firm now treats step count as its primary run health metric, reviewed before spend.
Count everything the run does
A step budget only works if the count is complete: model calls, tool calls, retries, delegations, sub-agent steps — all decrement the same budget, counted at the authorisation layer rather than inside the framework. Partial counting invites the failure to move to the uncounted category, the way a handoff loop distributes spend across agents so no single cap fires. One run, one budget, one counter outside the run's own control: that is the whole mechanism, and its simplicity is why it survives framework changes.
Size from completed runs, and re-size as work changes
Use the distribution of successful runs only — failed runs teach lengths you never want to permit. Take the 95th percentile and multiply by about two; Halloway's 45-step ceiling became 120 with headroom for genuinely big briefings. Revisit quarterly or whenever the workflow changes materially: a step budget set for last year's product quietly becomes the constraint that truncates this year's legitimate work, and teams respond by raising it to a meaningless number in a hurry, mid-incident.
Design the ending, not just the stop
What happens at the budget decides whether users experience a control or a failure. The pattern that works is summarise-and-escalate: the agent packages its partial result, names what remains undone, and asks a human to extend or accept. Killing the run silently wastes everything it legitimately did; letting it 'just finish this last part' re-opens the unbounded run under a polite name. The extension decision, like every other approval, is logged with its decider.
Steps are also your best early-warning metric
Even below the budget, step velocity and step count against the run's own class baseline are leading indicators: a run at three times its class's median steps by the halfway point is a run to watch, and its tripwire can notify long before either the step budget or the spend cap fires. Put step counts in the attribution review beside spend per task — the pair separates 'expensive because thorough' from 'expensive because lost' better than either number alone.
Step budgets for agents that are supposed to run long
Some agents legitimately run for hours — deep research, large migrations, monitoring with periodic work. For these, a single run budget is the wrong shape; use a budget per phase or per hour, with the same summarise-and-escalate ending at each boundary, so a healthy long run renews itself through checkpoints while a lost one stops at the next edge. The principle survives the adaptation: the run's length is always justified at intervals by recorded progress, never merely by the run's own desire to continue. If a phase ends with no completed sub-tasks to show, that is the escalation — progress, not motion, is what earns the next budget.
Five actions to set step budgets that work
- Count every step at the gateway — model calls, tools, retries, delegations — against one per-run budget.
- Size the budget from successful runs only: roughly twice the 95th-percentile length, revisited quarterly.
- Design the ending as summarise-and-escalate, with human extension logged like any other approval.
- Add a mid-run tripwire when a run passes three times its class's median steps.
- Review step counts beside spend per task to separate thorough runs from lost ones.
Source note and related guides
Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.
Sources
- NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023
- OWASP Top 10 for Large Language Model Applications, the OWASP GenAI Security Project's risk list for LLM and agent systems: owasp.org, 2025
- RFC 6749, The OAuth 2.0 Authorization Framework, the IETF standard behind scoped, expiring access tokens: rfc-editor.org, 2012