Set a per-run step and token budget
Cap how many steps a single run is allowed to take, and how many total tokens it can consume. Once it hits either limit, it stops and reports back instead of continuing indefinitely. A budget that's hit is a signal to look, not a silent failure, and that's far cheaper than a loop that runs unbounded.
Route by tier: Fast for sub-tasks, Frontier only where it earns its cost
Most steps in a multi-step run (summarizing a tool result, checking a simple condition, formatting output) don't need a Frontier-tier model. Reserve the most capable, most expensive tier for the steps that need it, and route the rest to a Fast-tier model. That can cut the per-step rate substantially without changing the run's step count at all.
Use prompt caching on the stable prefix
The system prompt, tool definitions, and task description usually stay identical from step to step even as the rest of the context grows. Caching that stable prefix means the provider charges a small fraction of the normal input rate for re-processing it on every subsequent step. That matters most on the long, many-step runs this page is about.
Batch what doesn't need to run synchronously
Runs that don't need an immediate interactive response (a scheduled sweep, a bulk classification job) are often eligible for a provider's batch API. It charges a meaningfully lower per-token rate than the standard synchronous endpoint, for the same total work.
See it in a daily view, not a month-end invoice
Every control above still assumes someone notices when it's not working. A budget nobody reads is just a number in a config file. A daily, normalized view of AI spend sits next to the rest of the stack. Anomaly alerting on top of it catches a runaway agent within a day or two of the start. Compare that to the end of the billing period, when the only remaining option is damage control.