A $37 bill taught me to put spending limits on my AI agents
Description and use
Problem: AI agents can enter error loops that exceed spending limits, causing unexpected bills. Solution: assign separate budgets, use allow-lists, cap individual transactions, and monitor anomalies. Result: spending is controlled and agents operate within set limits.
Problem
AI agents can enter error loops that exceed intended spending limits, leading to unexpectedly high bills.
Outcome
The agent system now prevents runaway costs, provides clear budget exhaustion notifications, and allows quick adjustments without monitoring bills nightly.
Workflow
- 1. List all paid services and their monthly costs.
- 2. Assign each main agent a dedicated budget and enforce it in code.
- 3. Use one API key per agent to isolate billing and limits.
- 4. Split budgets into Exploration, Project, and Escalation buckets.
- 5. Create an allow-list of trusted services and request new ones through the agent.
- 6. Set per-call and per-day caps to stop retry loops.
- 7. Flag any single charge over $2 for human review.
- 8. Freeze accounts on anomaly detection (high call rate, failure rate, or spend speed).
- 9. Use a visible owner identifier for agent calls to encourage merchant trust.
Evidence
On the third night the bill said $37 for one day.
A subtask had fallen into an error loop. Call fails, agent tweaks a parameter, retries, fails again.
I use three buckets: Exploration, Project, Escalation.
Now nothing is allowed by default: Start with services you already trust, like OpenAI, Anthropic and your existing data sources.
Any single charge over $2 goes to a human.
- Record date: 2026-10-18T04:41:13.857Z