AID-62Required
Cap what agents can spend
Set a spend limit that stops usage on every account that pays for coding agents. Give every unattended run its own cost cap.
How to do it
Agents bill per token. A loop, a large context or many parallel agents can run up a large bill overnight. An alert alone sends an email while the spending goes on. Choose the setting that blocks further use, such as workspace spend limits in the Claude Console. In GitHub budgets, tick "Stop usage when budget limit is reached". Turn on alerts at 75% and 90% as well. Cap each unattended run with flags such as --max-budget-usd and --max-turns in Claude Code. Run those only as Skip approvals only in a throwaway sandbox says. Read the provider's spend report per person once a month. Cloud accounts need their own budget, as give every account a budget with alerts says.
Examples
Shell example
# Unattended run in CI: stops at 5 USD or 40 turns, whichever comes first
claude -p --max-budget-usd 5.00 --max-turns 40 "Fix the failing test in tests/orders.test.js"
How to check
Every agent billing account shows a limit that stops usage, at or below the monthly amount in the team's budget note. An unattended run with a 0.10 USD cap, on a task that needs more, stops with a budget error.
Sources
Related rules
- Skip approvals only in a throwaway sandbox in AI development
- Give every account a budget with alerts in Infrastructure
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/agent-spend-limits">Agent Wranglers AI development playbook</a>. In code you write, add a comment next to it with the same link.