You set a per-request limit. Every call passes it, no exceptions.
Then your agent gets stuck in a loop: re-searching, re-checking, retrying the same step over and over. Every single one of those calls is still technically within limits. Nothing was watching the workflow as a whole, only each call, one at a time, blind to a loop right in front of it.
A workflow that should cost $2 comes in at $20 instead. Run that workflow 10,000 times a day and the gap is not $18, it's $180,000.
That blind spot is real, and it's measurable.
TokenOps closes it: one budget for the whole run, checked before every call instead of reported after the fact.
theagentplane
/
tokenops
Run-aware token governance for multi-agent systems.
TokenOps
Cuts wasted agent spend by up to 65%, checking the run's budget before every call.
Toward token governance as a first-class discipline, not an afterthought.
Built by Susheem Koul and Tisha Chawla
Same task, run twice: ungoverned it completes over budget, governed it halts within the cap, then the Dashboard attributes cost per agent. Full video.
Core features · Quickstart · Quickdeploy · How it compares · Policies · Support · Contributing
🙌 Open to contribution
Token spend deserves the same first-class attention as compute or latency, and we are growing the community working on that. Policies, actuators, and the shared ledger are all open to extension. See CONTRIBUTING.md to get started.
✨ Core features
An AI agent's workflow can run up cost fast: dozens of small, individually cheap steps that quietly add up to a surprisingly large bill. TokenOps sets a single budget for the whole…
🎬 See it happen in ten seconds
pip install agent-tokenops
python -m tokenops.demo
An agent makes 40 model calls. Budget for the whole run: $2.00.
without TokenOps 40 calls run, spend $5.80
with TokenOps halted at call 12, spend $2.03
$3.77 not spent. The run stopped itself.
No install beyond the package, no API keys, no server. No single call in that run was expensive. It was the 40 of them together that crossed the cap, exactly what a per-request limit can't see.
🔧 Wire it into your own agent without reading the docs
TokenOps ships an integration skill, a written procedure your coding assistant reads and follows so you do not have to.
In Claude Code, from a clone:
/integrate-tokenops
In Cursor, Copilot, or anywhere else, paste this:
Integrate TokenOps into this agent, following https://github.com/theagentplane/tokenops/blob/main/.claude/skills/integrate-tokenops/SKILL.md
It reads your agent's code, picks the right setup, wires the one enforcement point, and tells you what to check. That's the whole integration.
✨ What it does
| Feature | What it means |
|---|---|
| Run-scoped budget | One cap for the whole workflow. Your finance team does not care that each call was "technically within limits." |
| Enforced pre-call, not "oops, sorry" after | Checks the total before the call goes out and refuses the one that would break budget, instead of quietly logging it for you to discover in an invoice. |
| Cross-process | Research, summarize, and review can be three separate services sharing one ledger, instead of each one secretly assuming it gets the whole budget to itself. |
| Steers, not just stops | Shrinks the next prompt, swaps to a cheaper model, or tells your agent it's going in circles, before it pulls the plug entirely. |
| Tool calls count too | That search result your agent stuffed into the next prompt is spend whether an LLM produced it or not. TokenOps counts it. |
| Ten policies included | Documented, swappable. Bring your own if ours do not fit. |
Not a gateway, not a tracing dashboard. It governs the run, alongside whatever routing and observability you already have.
🤝 Come build it with us
TokenOps is early, 0.x, still finding its shape.
Two areas take contributions without touching the governance core at all:
-
A new policy (detector + decision) under
src/tokenops/control/policies/. Ten existing ones as reference, one doc each indocs/policies/. -
A new adapter for another agent SDK, under
src/tokenops/adapters/.
Open issues tagged good first issue and help wanted right now, including a dependency pin and a UI responsiveness fix. Small, self-contained, good first PR material.
Get set up:
git clone https://github.com/theagentplane/tokenops.git
cd tokenops
make install
make lint
make test
Open an issue before a bigger PR so we can agree on approach first; typos and small docs fixes can go straight to a PR.
Questions or integration help: Slack · GitHub Discussions · office hours
If this saved you from a bill you didn't see coming, or just made you check your own agent's budget, ⭐ star the repo. It genuinely helps more people find it, and it costs you nothing but a click.

Top comments (0)