---
title: "Cap what your coding agents can spend · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials/agent-spend-limits
id: AID-62
level: Required
risk: money
updated: 2026-10-27
build: a2a6bdfed830
tokens: 1110
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Cap what your coding agents can spend

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Isolation and credentials](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: AID-62
- Level: Required
- Chapter: [Isolation and credentials](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials.md)
- Rule: Set a spend limit that stops usage on every account that pays for coding agents. Give every unattended run its own cost cap.
- 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.
- Risk: Money lost or taken twice
- How: 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](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials/unattended-only-in-sandbox.md) says. Read the provider's spend report per person once a month. Caps on model calls inside your own product are in [Price every model call and cap the spend](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks/cost-per-call.md). Cloud accounts need their own budget, as [give every account a budget with alerts](https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/budgets-for-every-account.md) says.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Shell example

```bash
# 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"
```

## Sources

- [Claude Code, manage costs](https://code.claude.com/docs/en/costs)
- [GitHub Docs, set up budgets](https://docs.github.com/en/billing/how-tos/set-up-budgets)
- [Claude Code CLI reference](https://code.claude.com/docs/en/cli-reference)

## Related rules

- AID-24 [Skip approvals only in a throwaway sandbox](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials/unattended-only-in-sandbox.md) in AI-assisted development
- AIF-42 [Price every model call and cap the spend](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks/cost-per-call.md) in AI features
- INF-53 [Give every account a budget with alerts](https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/budgets-for-every-account.md) in Infrastructure and environments
- AID-68 [Attribute the cost of every agent session](https://agentwranglers.se/playbook/ai-assisted-development/running-agents-at-scale/agent-cost-attribution.md) in AI-assisted development
- AIF-71 [Stop every agent run at fixed limits set in code](https://agentwranglers.se/playbook/ai-features/agents-in-products/agent-run-limits.md) in AI features

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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/isolation-and-credentials/agent-spend-limits">Agent Wranglers AI-assisted development playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Approve destructive commands](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials/approve-destructive-commands.md)
- Next: [Treat what the agent reads as untrusted](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials/untrusted-context.md)
- [Isolation and credentials](https://agentwranglers.se/playbook/ai-assisted-development/isolation-and-credentials.md)
