An AI agent in a loop made more than 15,000 paid calls in under an hour and spent about $50,000. Caps that read the bill notice
minutes later. spendcap asks first: every model or tool call reserves what it can cost, and a call that would cross a budget never starts.
ReserveHold the most it can cost against every budget above it.
RunOnly if every budget and breaker says yes.
SettleCharge what it really cost and release the rest.
RefuseOver a budget or tripping a breaker: the call never starts, the scope pauses, a named person resumes it.
Replayingagent-7 at Acme finance09:00:00
The same loop with no cap would spend $49,536 in the hour.
Spend over the hour log scale
Who spent what
09:00
Budgets per hour. Change a limit and press Start again to use it. A paused row stays paused until someone resumes it by name.
Scope
Limit an hour
Spent
Status
Action
Alerts
#
Time
Event
Path
Amount
Detail
Ctrl + Enter runs it. S is require("spendcap") in Node.
Press Run.
Reference
Caps that act before the call.pdfPage 1 of 3100%
spendcap technical note 1, October 2026
Caps that act before the call
The spendcap maintainers
Abstract. AI agents spend in small, fast steps, and a loop multiplies them. Providers are adding spend caps, several of which act on the bill,
which arrives late. We model a cap read from the bill with a delay and compare it with a governor that reserves each call's maximum cost before it runs.
On a simulated runaway agent shaped like the one Mandiant described, the bill-based cap overshoots by roughly the agent's spending rate times the delay;
the reservation never crosses the cap, and two simple breakers stop the loop within seconds without refusing any legitimate work in our workloads.
1. A loop is a spending rate
In September Mandiant described an accounting agent that entered a loop, made more than 15,000 calls to paid services in under an hour and cost about $50,000,
with no attacker involved [1]. Our runaway workload copies that shape: five minutes of normal work, then the same $3.30 sync call about 270 times a minute.
With no cap it spends in the hour (Figure 1).
Figure 1. Spend over the hour for each guard, log scale, cap $1,000.
1
2. A cap that reads the bill is late by design
Google Cloud's new real-time caps pause Gemini agents when a project reaches its limit; an earlier API cap took about ten minutes to take effect [2]. Cohere's
North 2 tracks tokens per user and per agent and warns before limits are reached [3]. Whatever the product, a cap that learns about spend after it happens lets
through about the spending rate times the delay: at one minute and at ten (Figure 2).
Figure 2. Money spent past a $1,000 cap, by how late the cap reads the bill.
3. Reserve first, then breakers
A reservation holds the most a call can cost before it runs, against every budget above it, so the cap is never crossed: the runaway agent stops at
. A loop breaker (the same call twenty times in a minute) stops it after ; a velocity breaker
($100 a minute) after . Set a velocity limit below a workload's real peak and it pauses good work (Figure 3).
Figure 3. Share of the month-end batch that finishes, by velocity limit.
2
Table 1. The runaway agent, 60 minutes, cap $1,000, seed 7.
Guard
Spent
Over the cap
Calls
Stopped
4. Limits
A reservation needs an upper bound for each call; a tool billed by usage needs an estimate. The workloads are synthetic. Several processes sharing one budget
need a shared ledger. Our source on the Mandiant case is press reporting of the report, not the report itself.
References
"One runaway AI agent racked up a $50,000 cloud bill," Help Net Security, 16 September 2026. helpnetsecurity.com
"Google Cloud adds project spend caps that pause Gemini agents at the limit," PPC Land, 8 October 2026. ppc.land
"Cohere unveils North 2 AI agent platform with rebuilt orchestration and token spending caps," SiliconANGLE, 5 October 2026. siliconangle.com