What a sane agent spend cap looks like

Key points in 30 seconds
- A monthly budget is not a guardrail. It trips after the money is gone.
- Use three caps: per run, per hour or day, and per month.
- Set the per-run cap at 10 to 20 times the median cost of a normal run.
- For agents that loop, a step limit stops a runaway. A dollar cap only reacts later.
- Every limit needs a named person who gets the alert, and a way to stop the agent in under a minute.
- You do not need to build the tools. The hard part is choosing the numbers.
The common question is "what should our monthly AI bill be?" It is the wrong control. The bill is a result. The better question is: what is the most one run can cost, and how many times can it run before someone finds out?
Why is one monthly budget not enough?
Most teams have one limit: a monthly cap at the provider or on the company card. It feels safe because it has a number. But it is a lagging control. It trips after the money is spent. It shows the bill you are willing to accept. It does not stop the loop that ran on Friday night.
Three caps work together:
Per-run cap
- What it limits
- One bad task. It limits the damage of a single run.
- What it catches
- An agent that gets stuck on one job.
- What it misses
- Many normal runs, one after another.
Most important. Almost nobody sets it.
Per-window cap
- What it limits
- Too many runs in a short time.
- What it catches
- Retry storms and replayed queues. Every run looks fine, but suddenly there are four thousand.
- What it misses
- One single run that goes wrong.
Catches what the per-run cap cannot see.
Per-month cap
- What it limits
- Nothing in time. It trips after the money is gone.
- What it catches
- Slow, steady overspend.
- What it misses
- A loop on Friday night. It is over before the cap acts.
A backstop. Keep it, but do not trust it alone.
How do I set a per-run cap?
There is no published number to copy. It depends on what your agent does. The method is simple.
- Measure first. Find the median cost of one normal run for this agent, on real work. Not the average of all agents. You cannot limit a number you have never seen. This is why you need observability (tracking each run's cost) before limits.
- Multiply. Our starting rule is 10 to 20 times the median run cost.
Why this range? Below about 10 times, normal variation trips the cap often (a long document, a hard ticket). Then someone quietly raises it and stops reading alerts. Above about 20 times, a stuck agent can do real damage before anything notices.
It is a ratio, not a dollar figure, on purpose. A dollar figure from someone else's workload is worth nothing. Different agents carry different risks, so one global budget protects none of them. Try it:
Find a starting cap for one agent
1. Pick the kind of agent
Classifiers, routers, triage bots, extraction jobs
Cost per run is small and steady. There is no loop. The risk is volume: ten thousand calls, not one costly call.
Conversational agents
Cost per turn is modest, but the context grows. A long chat costs much more than a short one.
Research and browsing agents
Cost swings a lot. Nothing in the task tells the agent when to stop. Three lookups or forty is the same request to your budget.
Coding agents
The extreme case: long loops, large context, and retries that add up. A failing test the agent keeps trying to fix can turn a small task into a large invoice.
Per-run cap: 3 to 5 times your median
$0.6 to $1
Use rate limits. They help more than spend limits here.
What really stops a runaway agent?
For anything with a loop, the control is a step limit, not a dollar limit. Most runaway cost is not one costly call. It is a cheap call repeated far too often. A dollar cap reacts only after the spending has happened. A hard limit on iterations or tool calls stops the loop while it is still running.
Set both. The step limit is the control. The dollar limit is the backstop. When an agent reaches its limit, it should stop and say so clearly. It should not quietly try again.
Who gets the alert?
An alert nobody owns is not a control. It is a log entry with ambitions.
- Name a person, not a channel. Ask for every cap: when it trips, who finds out, on what device, and what can they do right then?
- Be able to stop it. Revoking a scoped key is a good kill switch. This is one reason to send agent traffic through a gateway, instead of letting each service hold its own provider keys. One person should be able to stop an agent in under a minute, without a deploy.
If the alert goes to Slack and someone sees it on Monday, then from Friday to Monday you have a record, not a limit.
Before an agent runs alone
0 of 7 done
Tick each item you have in place today.
Do I need to build these controls?
No. The mechanism is a solved problem, and most of it is free:
- LiteLLM sets budgets and rate limits per key, team and user, with virtual keys you can revoke.
- Langfuse traces cost per step across a whole agent run, including retrieval and embedding calls that people forget to count.
- Helicone is close to a one-line drop-in for cost and latency logging.
- Portkey adds routing, budgets and guardrails on top of a large model catalogue.
- The major providers also offer workspace-level spend controls.
Building your own version is a poor use of a small team's time. But no tool can tell you which number to put in the box. Which agent gets which cap, what a normal run costs, which loops need a step limit, and who is woken at 2am: that is specific to your business, and it is the part that matters. The tools get cheaper every quarter. The decisions do not.
Frequently asked questions
What is a reasonable spend cap for an AI agent?
There is no single number, because a sane cap is derived from your own measured run cost rather than copied from someone else. The rule we start from is a per-run cap of roughly ten to twenty times the median cost of a normal run for that agent. Below ten times you spend your life clearing false alarms; above twenty times a runaway agent can burn a lot of money before anything trips. You cannot set this number until you have measured what a normal run costs, which is why observability comes before limits.
Why is a monthly AI budget not a real guardrail?
Because it is a lagging control. By the time a monthly cap trips, the money is already spent and the damage is already done. A monthly budget tells you the size of the bill you are willing to receive; it does not stop the run that caused it. The limits that actually protect you are the per-run cap, which bounds the blast radius of one bad task, and the per-window cap, which catches retry storms where each individual run looks fine.
Should I build my own AI agent cost controls?
Almost certainly not. The mechanism is commodity and mostly free: LiteLLM does per-key and per-team budgets and rate limits, Langfuse and Helicone do cost tracing per step, and Portkey adds routing and guardrails on top. What is not commodity is deciding what limits to set, for which agent, and who gets woken up when one trips. Buy or adopt the mechanism; spend your scarce engineering time on the judgment.
What stops an AI agent from looping and burning budget?
A step or iteration limit, not a dollar limit. Most runaway agent costs come from loops rather than from a single expensive call, and a dollar cap only trips after the spend has happened. A hard ceiling on tool calls or iterations per run stops the loop while it is still running. Dollar caps are the backstop; step caps are the actual control.
Which AI agents cost the most to run?
Agents with an unbounded tool loop and no natural stopping point — research, browsing and coding agents — carry by far the widest cost variance, because nothing in the task itself tells them when to stop. Single-call agents such as classifiers and triage bots are cheap and predictable per run, so their risk is volume rather than blast radius. The two need different limits, which is why one global budget across all of them protects neither.