---
title: "Cap what agents can spend · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/agent-spend-limits
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Cap what agents can spend

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

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

- ID: AID-62
- Level: Required
- Chapter: [Safety and permissions](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions)
- Rule: Set a spend limit that stops usage on every account that pays for coding agents. Give every unattended run its own cost cap.
- 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/safety-and-permissions/unattended-only-in-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](https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/budgets-for-every-account) says.
- 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.

## 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

- [Skip approvals only in a throwaway sandbox](https://agentwranglers.se/playbook/ai-assisted-development/safety-and-permissions/unattended-only-in-sandbox) in AI development
- [Give every account a budget with alerts](https://agentwranglers.se/playbook/infrastructure/cost-and-ownership/budgets-for-every-account) in Infrastructure

**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/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.

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