Most runaway bills are not loops in the glamorous sense. They are retries: a tool timed out, the agent tried again, the timeout was the tool protecting itself, and each retry made the underlying problem worse and more expensive.
The short answer
Give every agent a retry budget as real as its spend budget: a maximum number of attempts per action per run, exponential backoff enforced outside the agent, and idempotency keys on every paid or state-changing call so a retry cannot double-charge or double-send. Distinguish retryable errors — a network blip — from verdicts — a denial, a validation failure — which must never be retried unchanged. When the retry budget ends, the run ends or escalates; it does not reset because a new sub-task began.
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: the webhook that was retried 7,400 times
Cinder Peak Outfitters, a fictional outdoor retailer, let an inventory agent post stock updates to a warehouse webhook. The warehouse system slowed to 20-second responses under a sale peak; the agent's 5-second timeout fired, and it retried each update immediately, in parallel, for the length of the 6-hour sale. The warehouse received 7,400 duplicate or stale updates, the agent burned $212 in tool and model calls, and two staff spent the next day reconciling stock counts that had been overwritten in the wrong order.
Cinder Peak's fix had three parts. Retries were capped at 3 attempts per action with backoff of 5, 25 and 125 seconds, enforced at the gateway so no framework update could quietly remove it. Every stock update carried an idempotency key derived from the product and the stock event, so the warehouse could safely ignore duplicates. And a circuit rule was added: if half of an agent's calls in ten minutes time out, new calls pause for approval. At the next sale the same slowdown produced 3 retries, one pause, and a clean reconciliation.
Retries are spend decisions, so budget them like spend
Developers treat retries as a reliability knob and set them by instinct — five attempts sounds diligent. But each attempt is a paid call and, for state-changing tools, a second chance to do the action twice. A retry budget makes the trade-off explicit: this run may attempt this action at most this many times, across all its sub-tasks and sub-agents, after which a human or a fresh plan is required. Counted at the gateway, the budget survives delegation; counted inside the agent, every handoff resets it.
Backoff must be exponential and out of the agent's hands
Immediate retries convert a struggling tool's slowdown into a collapse — the classic thundering herd, with your agent as the herd. Enforced exponential backoff with jitter spreads attempts and gives the tool room to recover. It must be enforced outside the agent because the agent's incentive, mid-task, is always to try again now; a policy that merely recommends patience will be optimised away by the next framework default or the next helpful prompt edit.
Idempotency is the difference between a retry and a duplicate
For reads, a retry is harmless. For payments, sends, bookings and writes, a retry without an idempotency key is a second action waiting for a slow first one to have secretly succeeded. Derive keys from the business event — this order, this refund, this stock movement — not from the attempt, so every retry of the same event carries the same key and downstream systems can deduplicate. Alder-style double refunds and Cinder Peak's overwritten stock are the same bug wearing different clothes.
Some answers are verdicts, not invitations
A denial from policy, a validation error, an insufficient-funds response: these are answers, and retrying them unchanged is either futile or an attempt to wear the control down. Policy should classify errors at the gateway — transient errors may retry within budget; verdict errors end the action and are logged. A rising retry-against-verdict count is also a detection signal: agents probing a boundary look exactly like this in the log.
Retries in multi-agent systems multiply twice
In a fleet, a retry storm rarely stays inside one agent: the caller's retries become the callee's load, and if the callee is another agent, its own retries cascade onward, so a single slow tool can be amplified by every layer that touches it. This is why retry budgets must be counted per run at the gateway rather than per agent in each framework — the run-level count is the only one that sees the whole cascade. When you review a storm afterwards, reconstruct it layer by layer from the log; the layer where the budget should have bitten first is usually not the layer where the timeout started, and fixing only the origin leaves the amplifier in place.
Five actions to end retry storms
- Set a per-run retry budget per action, counted at the gateway across sub-tasks and sub-agents.
- Enforce exponential backoff with jitter outside the agent; never retry immediately in a tight loop.
- Require idempotency keys derived from the business event on every paid or state-changing call.
- Classify errors at the gateway: transient errors may retry, verdict errors end the action and are logged.
- Add a circuit rule that pauses an agent for approval when timeouts pass half its calls in ten minutes.
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
- OpenAI API documentation — Rate limits and spend limits, on how provider-side usage and spend limits are defined at organization and project level: platform.openai.com, 2026
- 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