Skip to main content

Pattern · Agents

Budgets and kill switches

Cap steps, tokens, time and money per task, user and day, and let an operator stop any agent instantly.

Say it in the interview

I would put budgets at three levels, task, user and day, in a shared store, with a kill switch an operator can flip without a deploy, and the provider limit only as a backstop.

When to use it

  • Any agent in production
  • Agents that can loop or call paid APIs

How it works

  1. Every task → Caps (steps, tokens, time)
  2. Every tool call → Checks (kill switch, repeated calls)
  3. Every day → Spend caps (per user, per feature, alert at 75%)
  4. Caps (steps, tokens, time) → Shared store
  5. Checks (kill switch, repeated calls) → Shared store
  6. Spend caps (per user, per feature, alert at 75%) → Shared store
  7. Shared store → Provider spend limit (the backstop)

Trade-offs

  • Prevents runaway bills and loops
  • Caps can stop a legitimate long task

Pitfalls interviewers probe

  • Only a provider limit, which stops everyone at once
  • Kill switch that needs a deploy

Practise it on these questions

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.