Governance for AI agents, in one self-hosted gateway.
Gardagent sits between your agents and their model providers. Each agent gets its own key, a daily budget and a list of allowed models and tools, and every call is written to a tamper-evident log. Open source, Apache 2.0.
View on GitHub Quick start Release v0.4.2How it works
Your agents keep their usual SDK. You change the base URL and give each agent its own key. The gateway checks, forwards, counts and records.
One key per agent
No more shared API key. Each agent is named, limited to the models you allow, and can be cut off on its own without stopping the others.
A cap that holds
Each agent has a daily budget. The cost is reserved before the call, so parallel streaming requests cannot run past the limit.
A tamper-evident log
Every request is appended to a hash-chained log in PostgreSQL. The database refuses updates and deletes, and an integrity check shows any break in the chain.
Check it without trusting us
Export the log and verify it offline with a standalone, dependency-free verifier. Keep a checkpoint outside the database to also detect truncation.
Who allowed what
Named, revocable operator tokens, immutable policy revisions and correlated approval decisions are recorded in the log. A token proves possession of a credential, not a human identity.
Features
- MCP proxy: governs
tools/calland can hold write tools for human approval. In enforce mode, unsupported methods and server requests are refused instead of passing through silently. - OpenAI and Anthropic compatible:
/v1/chat/completionsand/v1/messages, streaming included. observeandenforcemodes: measure what the rules would block before blocking it.- Per-agent rate and concurrency limits (optional), shared by model calls and MCP. Counters are kept in the process and reset on restart.
- Versioned database migrations: the gateway refuses to start on an unrecognized or newer schema.
- Admin API and console (English and French): agents, spend, ledger search, CSV export, integrity check.
- Self-hosted: one container plus PostgreSQL. The real provider key never leaves the gateway. A Compose profile with Ollama and three runnable examples (OpenAI, Anthropic, MCP) are included.
Get started
git clone https://github.com/bedfir/gardagent.git
cd gardagent
cp .env.example .env # set the admin token, then your provider URL and key
docker compose up -d --build
curl http://127.0.0.1:8080/health
A prebuilt image is available: ghcr.io/bedfir/gardagent:0.4.2. The release workflow builds it with a signature, an SBOM and provenance; the steps to check them are in verify-release. Version 0.4.2 stops the gateway from following upstream redirects with credentials and validates the Origin header on MCP; 0.4.1 fixed two issues in 0.4.0, including one that let a disabled agent keep calling MCP tools: read the advisory and upgrade. No-key local trial: the README's local quickstart uses a small local model, with one measured run of about 4 minutes on a small machine (details). Upgrading from 0.3.0? Read the upgrade guide first, it contains breaking changes. Full instructions are in the README and the docs.
Honest limits
Contribute
Issues, questions and pull requests are welcome on GitHub. Security reports go through GitHub's private vulnerability reporting, see the security policy.