DEV Community

Sathish Chelliah
Sathish Chelliah

Posted on

Announcing agent-gov: Open-Source AI Agent Cost Governance

Announcing agent-gov: Open-Source AI Agent Cost Governance

Stop waking up to surprise $500 bills from your AI agents.


The 3 AM Wake-Up Call

It was 3:47 AM on a Tuesday. My phone buzzed — a Cloudflare bill alert. Then another. Then Stripe. By the time I stumbled to my laptop, three different providers had collectively racked up $487 in just six hours.

What happened? A single AI coding agent had gotten stuck in a loop. It was re-analyzing the same bug, calling the same expensive LLM endpoint over and over, spawning sub-agents that spawned their own sub-agents. Nobody put a governor on it. Nobody thought they needed to.

If you've built anything with AI agents — auto-PR reviewers, customer-support bots, code-gen pipelines, web-research assistants — you've either had this nightmare or you're one sleep cycle away from it. The fundamental problem is simple: agents spend money the same way junior devs write code — enthusiastically, autonomously, and without asking permission.

Most teams solve this with spreadsheets and hope. Some bolt on a cloud budget alert after the first blowup. A few give up on agents entirely.

We wanted a real answer.

Enter agent-gov

Today I'm releasing agent-gov — an open-source, MIT-licensed cost governance platform purpose-built for AI agents. It's a lightweight reverse proxy that sits between your agents and their LLM providers, tracking every cent, enforcing daily budgets, and auto-pausing agents that overspend.

pip install agent-gov-saas
agent-gov start
Enter fullscreen mode Exit fullscreen mode

That's it. Thirty seconds from zero to governance.

How It Works

Agent-gov is transparent to your agents. You point them at a local proxy endpoint instead of directly at the API, and agent-gov handles the rest:

  1. Intercept — every model call routes through agent-gov's FastAPI proxy
  2. Look up real costs — the built-in tool registry knows exact per-token pricing for hundreds of models
  3. Enforce budgets — if an agent exceeds its daily allocation, agent-gov blocks the call
  4. Persist everything — all usage is written to SQLite via aiosqlite

No lock-in. No cloud dependency. No per-seat licensing.

Features in v0.5

  • Reverse proxy middleware — drop-in for any OpenAI-compatible client
  • SQLite persistence — full audit trail of every call, token, and dollar
  • Tool registry with real cost tables — priced by model, provider, and input/output token rates
  • Daily budgets with auto-reset — configure per-agent, per-workspace, or globally
  • Auto-pause on over-budget — agents get a structured policy block
  • Multi-tenant workspaces — isolate costs by team or project
  • Docker supportdocker compose up
  • 45 tests, 0.3 seconds — tight, fast, well-tested codebase

Quickstart

pip install agent-gov-saas
agent-gov start
Enter fullscreen mode Exit fullscreen mode

Set a $5 daily budget:

agent-gov config set budget 5.00 --agent code-review-bot
Enter fullscreen mode Exit fullscreen mode

Why We Built This

The AI agent ecosystem is exploding. But the operational maturity around it is where web apps were in 2009. We're all running agents without guardrails because nobody has built the guardrails yet.

Agent-gov is the circuit breaker for your agent infrastructure — the thing that prevents a single runaway loop from costing you a week of GPU credits.

The project is MIT-licensed because cost governance isn't a moat — it's table stakes.

Get Involved

Don't learn you need cost governance at 3 AM.


Built with FastAPI, SQLite, and a healthy fear of surprise bills.

Top comments (0)