🛡 agent-gov
AI Agent Cost Governance Platform
A reverse proxy that tracks, budgets, and controls what your AI agents spend. Like a credit card with limits — but for your agents.
What Problem Does This Solve?
AI agents call expensive tools (LLMs, browsers, APIs, email services). Without controls:
- A recursive agent burns ₹5,000 in one night on GPT-4
- A buggy loop sends 10,000 emails before you notice
- You discover the bill when your credit card statement arrives
agent-gov sits between your agents and their tools. Every call goes through us. We check budgets, track costs, and auto-pause overspending agents.
Quick Start
1. Install
pip install agent-gov-saas
2. Start the server
agent-gov start
Server starts at http://localhost:8000.
Alternatively, use Docker:
docker compose up(see GitHub repo for docker-compose.yml).
3. Register an Agent
curl -X POST http://localhost:8000/agents/register \
-H "Content-Type: application/json" \
-d '{"name": "My Bot", "daily_budget": 500}'
Response:
{
"api_key": "ag-abc123...",
"name": "My Bot",
"daily_budget": 500,
"message": "Save this API key — it won't be shown again!"
}
4. Route Agent Calls Through the Proxy
Instead of calling tools directly, your agent calls our proxy:
# BEFORE (no governance):
response = call_openai(prompt)
# AFTER (with agent-gov):
gov_response = requests.post("http://localhost:8000/proxy/call", json={
"agent_key": "ag-abc123...",
"tool_name": "openai-gpt4",
"estimated_cost": 12.50 # ₹12.50 for this call
})
if gov_response.status_code == 429:
print("Budget exceeded! Agent auto-paused.")
else:
response = call_openai(prompt) # Proceed with actual call
5. Watch the Dashboard
Open http://localhost:8000/dashboard — live view of all agents, their spend, and budget status.
6. (Optional) Pre-Register Common Tools
# Register 24 common AI tools with realistic costs (₹)
python seed_tools.py
# Preview before registering:
python seed_tools.py --list
API Reference
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check + stats |
POST |
/agents/register |
Create agent, get API key |
POST |
/proxy/call |
Proxy a tool call (budget checking + real cost lookup) |
POST |
/agents/{key}/resume |
Resume a paused agent (resets budget) |
POST |
/agents/{key}/reset |
Reset daily budget counters (no unpause) |
POST |
/workspaces |
Create a workspace (returns API key) |
GET |
/workspaces |
List all workspaces |
POST |
/tools/register |
Register a tool with its known cost per call |
GET |
/tools |
List all registered tools |
GET |
/analytics/tools |
Per-tool spend statistics |
GET |
/dashboard |
Live HTML dashboard |
GET |
/docs |
Interactive OpenAPI docs (Swagger) |
Features
| Feature | What it does |
|---|---|
| Budget enforcement | Auto-pause agents that exceed their daily budget |
| Tool registry | Register tools with known costs — agents can't lie about pricing |
| Real cost lookup | Proxy uses registered tool cost, not client estimate |
| Per-tool analytics | See spend broken down by tool, not just by agent |
| Daily auto-reset | Budgets reset automatically at midnight |
| Multi-tenancy | Workspaces for teams, projects, or clients |
| Dashboard | Live HTML dashboard with per-agent and per-tool views |
| CLI | agent-gov start / status / version |
| Docker | Ready-to-run Docker Compose setup |
Architecture
Agent (your code)
│
│ POST /proxy/call { agent_key, tool_name, estimated_cost }
▼
┌──────────────────────────────┐
│ agent-gov │
│ │
│ 1. Auth: Is key valid? │
│ 2. Budget: Will this exceed? │
│ 3. Log: Track cost + tool │
│ │
│ If approved → return 200 │
│ If denied → return 429 │
└──────────────────────────────┘
│
│ Agent calls actual tool
▼
┌──────────────────────────────┐
│ Actual Tool (OpenAI, etc.) │
└──────────────────────────────┘
Technology Stack
| Component | Technology | Why |
|---|---|---|
| API Framework | FastAPI | Fast, async, auto-docs |
| Validation | Pydantic | Type-safe input validation |
| Server | Uvicorn | Production ASGI server |
| Storage | SQLite via aiosqlite | Persistent, zero setup |
| Templates | Jinja2 | Server-rendered dashboard |
| Tool Registry | SQLite + UPSERT | Known tool costs, agents can't lie |
| Workspaces | SQLite + migrations | Multi-tenancy with workspace isolation |
| Testing | pytest + httpx | Fast, isolated tests |
License
MIT
Release files for agent-gov-saas 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agent_gov_saas-0.6.0.tar.gz | 23.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agent_gov_saas-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:47.7 kB
Release files / agent_gov_saas-0.6.0.tar.gz
| Download URL | agent_gov_saas-0.6.0.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06d9d15042f664ff507cbcd08ff8ef5e95cb174c6161aa01448f94f3e16a4bcc
|
|
BLAKE2b-256 checksum How to use checksums |
fe1bb55618462bfe388bb933caabed571a0945fffcf107fd9572f5931444f39c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2026.
Transparency logRelease files / agent_gov_saas-0.6.0-py3-none-any.whl
| Download URL | agent_gov_saas-0.6.0-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0c47bb7ee425e9064db82d84a0e7ad691e6e04d6da4bca013d4175820463d7d
|
|
BLAKE2b-256 checksum How to use checksums |
8cd5fd8b1e0d72ac78eca021cd4e3da10f97014151ee3aca47aae583ad3875da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 31, 2026.
Transparency log