TokenPolice
Docs

Why your agent needs it

The runaway-agent-spend problem: what goes wrong when an AI app has no spend firewall.

AI agents spend money on every step, and they don't stop on their own. A prompt tweak, a flaky tool, or one abusive user can turn a normal feature into a bill you only notice once it has already landed.

A story you've probably lived

You ship a support agent. It answers a question, calls a tool, reads the result, and calls the model again to decide what to do next. Normal.

Then one conversation goes sideways. The tool returns something the agent doesn't expect, so it retries. The retry doesn't help, so it reasons about it — another model call. It loops: call, tool, call, tool, hundreds of times on a single thread. No error is thrown. Nothing crashes. The agent is working exactly as written — it just never decides to stop.

You find out three days later, on the provider invoice.

Why "watch it on a dashboard" isn't enough

Cost dashboards and usage exports are all after the fact. By the time a chart turns red, the tokens are bought and the money is gone. Rate limits help with volume, but they don't know that this user is on the free tier, or that this workflow just cost 50× its normal run.

The failure mode isn't a bug you can catch in review. It's an agent behaving normally on an input you didn't anticipate — a loop, a retry storm, or a single account hammering an expensive path.

What TokenPolice does instead

It sits in front of the provider call and checks it first. You set the limits that matter to you — a per-user cap, a per-workflow budget, "stop after N identical steps" — and when a call would cross one, TokenPolice can block it before the spend happens.

You don't have to trust it blindly, either: it starts in dry-run, where it watches and records what it would have done, so you can flip on enforcement once the limits look right.

Next: go straight to getting started, or read what leaves your servers on Data & privacy.