On this page
How runaway spend happens
- Retry loops. An agent fails, retries, fails again, and every attempt is a paid model call.
- Runaway runs. A tool keeps returning data that the agent feeds back into its context until one run uses hundreds of thousands of tokens.
- Traffic spikes or abuse. Real or automated users drive far more calls than usual.
- A wrong model. An agent quietly runs on an expensive model after a configuration change.
Provider-side budgets help, but they usually apply to a whole account or key and stop everything at once. You want limits per agent, which act before the account limit is reached and leave healthy agents running.
The rules to set
| Rule | Catches | How to pick the threshold |
|---|---|---|
| Daily spend cap | Total spend today (UTC day) crossing a limit | Start at about twice a normal day’s spend; adjust after a week of real numbers |
| Runaway run | One run using more tokens than any normal run should | A few times your largest normal run |
| Failures in a row | Retry loops and broken integrations | 5 to 10, depending on how often the agent runs |
| Spend anomaly | Spend far above the usual rate for the time window | Needs history; useful once the agent has steady traffic |
| Error rate | A rising share of failed runs | For example 20% over 15 minutes |
How Agent Control Panel does it
- Rule types: daily spend cap, spend anomaly (after twenty baseline runs), error rate (from five runs), heartbeat lost, and two per-agent rules: failures in a row and runaway run (tokens in one run).
- Notify or pause. Each rule can notify you or attempt an automatic pause. The per-agent rules pause only the agent that misbehaved. A paused agent stays paused until someone resumes it.
- Respects your controls. Automatic pause needs the app’s control scope; on a monitor-only app the alert tells you it would have paused. If control is switched off (an organization-wide switch, or
ACP_DISABLE_CONTROLin the app), the rule notifies only. - Cooldown. Each rule has a cooldown (60 minutes by default) so one incident does not flood you. Alerts can be delivered to Discord, and every event is in the alert history with what was done.
- Clear messages. An automatic pause says which agent was paused, the spend it reached against your cap, when it happened, and that it stays paused until you resume it.
Spend is computed from the tokens and model each run reports, which the SDK reads from OpenAI, Anthropic and Google Gemini responses. A pause stops the next model call; a request already in flight finishes. Setup: connect an existing app, then alerts and automated response and token usage and cost.
A safe starting setup
- Report runs for a few days and look at a normal day’s spend and your largest normal run.
- Add a runaway-run rule and a failures-in-a-row rule with automatic pause: they rarely fire on healthy agents.
- Add a daily spend cap at about twice a normal day, set to notify for the first week, then switch it to pause.
- Keep a provider-side budget as the last line of defence for the whole account.
Frequently asked questions
How do I stop an AI agent from running up a huge bill?
Set per-agent limits that pause the agent automatically: a daily spend cap, a runaway-run limit (tokens in one run) and a limit on failures in a row, plus a provider-side budget for the whole account.
Does a spend cap stop the agent immediately?
It pauses the agent, so its next model call does not happen. A request already in flight finishes.
Will an automatic pause stop all my agents?
No. In Agent Control Panel the per-agent rules pause only the agent that crossed the limit; others keep running.
What happens after an automatic pause?
The agent stays paused until someone resumes it from the dashboard, and the alert history records what happened and why.
Do I need to send my provider API keys?
No. Spend is calculated from the tokens and model your agent reports; your agent keeps calling its provider directly with your own keys.