AgentGate
A CI release gate for LLM agents. Before a new agent version ships (a prompt, model, tool or retrieval change), AgentGate runs the candidate and the current baseline on a golden dataset and an adversarial security suite, K times each. It compares them case by case with a paired bootstrap and blocks the merge if quality, safety, cost or latency regress by a statistically significant amount. The verdict appears on the pull request as one updating comment and an AgentGate check.
The system under test is a small LangGraph research assistant over a synthetic "Northwind Cloud" knowledge base. The gate is the product.
Dashboard: agentgate-dashboard.pages.dev: every scored version, its verdict, and each run's metrics with confidence intervals (a snapshot exported 2026-12-05). Demo video: to be recorded. Status (2026-12-05): v1 is built and measured (milestones 1–8 code on
main). The dashboard is live as a static snapshot (link above); the PyPI upload is prepared but not live yet. No new gate runs are being made in this repository: every number below was measured with OpenAI models, and the credits that paid for them have run out. In your own repository the gate runs on your own API key. See Status and limits.
pull request changes agents/
│
┌─────────────────────▼─────────────────────┐
│ GitHub Action (runs from the PR's BASE) │
└─────────────────────┬─────────────────────┘
baseline (cached) │ candidate (git worktree, own process)
┌─────────────┴─────────────┐
▼ ▼
50 golden cases × K + 25 security cases × K
scored by deterministic checks + a pinned LLM judge (DeepEval)
└─────────────┬─────────────┘
▼
paired bootstrap per metric (10,000 resamples, seeded)
BLOCK = worse than threshold AND 95% CI excludes 0
BLOCK = any critical security case fails
▼
one PR comment + AgentGate check (success / failure / neutral)
every decision stored in Postgres: version_id, dataset hash, judge fingerprint, git SHA
Try it in one minute (no API key, no database)
uvx --from git+https://github.com/romit-23/AgentGate agentgate demo # or, in a clone: uv run agentgate demo
agentgate demo replays five comparisons of real recorded runs through the gate's code and prints the PR comment for each: an unchanged agent (✅ pass), the same agent against a baseline from another day (⚠️ warn, ADR 0010), and three planted regressions (❌ block: one-chunk retrieval, a cheaper model, emails without approval). The runs ship inside the package (scores, latency and cost per case-run, no answers), so nothing is scored and no model is called. --list names the scenarios, --format json gives the full reports. CI checks that the installed wheel reproduces all five verdicts with an empty environment.
Results
All from docs/benchmarks/RESULTS.md. Each number links to a run report with its run ids. Small samples are shown with their 95% bounds, because "0 of 10" is not "0%".
| What was measured | Result |
|---|---|
| False blocks: an unchanged agent gated against itself (A/A) | 0 of 10 trials blocked (upper bound 26%). Replaying all 110 pairs of those runs across two days found 5 blocks from latency and cost drift; since ADR 0010, 0 (§8) |
| Catches: deliberately broken versions, predictions committed before the runs | 5 of 5 blocked, all as predicted (lower bound 55%). Two of them rested on 1 of 3 repeats (§9) |
| Judge vs a human (35 blind labels, Cohen's κ, target 0.6) | answer_correctness 0.81 ✅. groundedness 0.42 ❌, so groundedness only warns and never blocks (§7, ADR 0009) |
| Real PRs | PR #7: a weakened prompt was ❌ blocked (tool_selection_accuracy −0.19, CI [−0.31, −0.09]), and the fix turned the same comment ✅ green. PR #21: a comment-only change ✅ passed |
| Gate time and cost (cached baseline) | 7–8 minutes, about $2 per push that changes the agent. The PRD target was $1 per run, so that target was missed. $0 for PRs that don't touch the agent |
| Session isolation (50 concurrent sessions, real model) | 0 leaks, 0 errors (§6) |
| Unit-test coverage of stats, gate and scorers | 97% |
The full PRD scorecard is in RESULTS.md.
Quickstart (local)
cp .env.example .env # fill in keys in .env only (never in .env.example or a chat)
make install
make up # Postgres 16 + pgvector and the API, both health-checked
make ingest # embed the synthetic KB (needs the embedding model's key)
curl localhost:8000/health
make test # unit tests: no network (a socket guard enforces it), no DB
make test-integration # needs `make up`; uses a separate agentgate_test database
The compose Postgres publishes on host port 5433, so it doesn't clash with a local Postgres (override with AGENTGATE_DB_PORT). Local tools default to DATABASE_URL=postgresql://agentgate:agentgate@localhost:5433/agentgate.
Models are configured in .env and agentgate.yaml, through LiteLLM:
| Role | Model used for every published number | Key |
|---|---|---|
Agent (AGENT_MODEL) |
openai/gpt-5.4-mini |
OPENAI_API_KEY |
Judge (agentgate.yaml, pinned, temperature 0, prompts judge-v1) |
openai/gpt-5.2 |
OPENAI_API_KEY |
Embeddings (EMBEDDING_MODEL, 768 dims) |
openai/text-embedding-3-small |
OPENAI_API_KEY |
Another provider is a config change (gemini/…, anthropic/…; the key is chosen from the model's prefix), but a different judge gives a different judge fingerprint. Stored baselines then no longer match and are re-scored, and the judge validation above doesn't carry over. The embedding dimension is fixed by vector(768) in migrations/0001_kb.sql.
Commands
| Command | What it does | Cost |
|---|---|---|
agentgate run --version HEAD |
score one version on the golden set (--suite security for the security suite) |
~$1.71 per 50 × 3 |
agentgate run --baseline main --candidate my-branch |
the gate: score both (baseline cached when stored), compare, print the report, exit 0 pass / 1 block / 2 no verdict | ~$2 cached |
agentgate demo |
the gate's verdicts on five bundled real comparisons, no key and no database | $0 |
agentgate compare --baseline-run <uuid> --candidate-run <uuid> |
replay the gate on two stored runs | $0 |
agentgate report --run <uuid> |
print a stored decision as the PR comment (--format json) |
$0 |
agentgate aa-test --version main --trials N |
false-block rate: gate a version against itself N times | ~$2 per trial |
agentgate planted-test --manifest evals/planted/v1.yaml |
catch rate: gate pre-registered broken versions | ~$2 per variant |
agentgate judge-sample / judge-label / judge-validate |
judge vs human agreement on stored answers (the labels must come from a person) | $0 |
agentgate load --sessions 50 --concurrency 25 |
session isolation under load, against a running app | ~$0.25 |
agentgate migrate |
create the gate's own tables in any Postgres | $0 |
Commands that spend estimate first, ask before spending (or take --yes), and stop at budget.max_usd_per_gate_run per version scored. A run that hits the cap is budget_exceeded and can't become a baseline.
How the gate decides (ADR 0004). Each version runs in its own worker process from a git worktree. A metric blocks only if it is worse than its threshold in agentgate.yaml and its 95% CI excludes 0. If it crosses the threshold but the CI includes 0, it warns and the gate still passes. Quality metrics use −0.05; latency p95 and cost per success use +25% and +20%, and block only when both runs finished within 12 h of each other, because latency and token use drift between days. Against an older cached baseline they warn (ADR 0010); the action's no-cache: true re-scores the baseline in the same job (about twice the cost) when you want those rules to be able to block. An infra-error or judge-error rate above 5% on either side gives no verdict, so provider noise is neutral. Agent failures (step or token limit) above 5% on the candidate block. A critical security case that fails in any repeat blocks (ADR 0005).
Use AgentGate in your repo
| Verdict | Check | Meaning |
|---|---|---|
| ✅ PASSED | success | no metric regressed beyond its threshold |
| ⚠️ PASSED WITH WARNINGS | success (failure with fail-on-warn: true) |
a metric crossed its threshold, but the 95% CI includes 0 |
| ❌ BLOCKED | failure | a significant regression, or a critical security case failed |
| ⏸️ NO VERDICT | neutral | provider noise, budget exceeded, or runs not comparable: not the PR's fault |
Copy this to .github/workflows/agentgate.yml:
name: AgentGate
on:
pull_request: # every PR; the action skips (green, $0) if the agent didn't change
permissions:
contents: read
pull-requests: write # the PR comment
checks: write # the AgentGate check
concurrency:
group: agentgate-${{ github.event.pull_request.number }}
cancel-in-progress: true # don't pay for superseded pushes
jobs:
gate:
runs-on: ubuntu-latest
timeout-minutes: 60
services:
db: # used when AGENTGATE_DATABASE_URL isn't set
image: pgvector/pgvector:pg16
env: { POSTGRES_USER: agentgate, POSTGRES_PASSWORD: agentgate, POSTGRES_DB: agentgate }
ports: ["5432:5432"]
options: --health-cmd "pg_isready -U agentgate" --health-interval 5s --health-retries 10
env:
DATABASE_URL: ${{ secrets.AGENTGATE_DATABASE_URL || 'postgresql://agentgate:agentgate@localhost:5432/agentgate' }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGFUSE_PUBLIC_KEY: ${{ secrets.LANGFUSE_PUBLIC_KEY }}
LANGFUSE_SECRET_KEY: ${{ secrets.LANGFUSE_SECRET_KEY }}
steps:
- uses: romit-23/AgentGate/action@main
with:
paths: agents/ # your agent's code and prompts (space-separated pathspecs)
config: agentgate.yaml # optional; also: repeats, fail-on-warn, no-cache, install-command, setup-command
In this repository the workflow uses the local copy (uses: ./action) after checking out the base.
Secrets (Settings → Secrets and variables → Actions):
| Name | Required | What for |
|---|---|---|
OPENAI_API_KEY, ANTHROPIC_API_KEY or GEMINI_API_KEY |
yes, one or more | your agent's model and the judge, on your account (see Bring your own key) |
AGENTGATE_DATABASE_URL |
no | a persistent Postgres (e.g. Neon; the gate's tables need no extension, this repo's agent needs pgvector). Baselines are cached there, so a push costs ~$2 instead of ~$4 |
LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY |
no | traces of every gate run |
Things to know:
- The gate runs from the PR's base. Its config, datasets, thresholds, scorers and even the action come from the base commit, so a PR can't loosen the gate that judges it. One exception: GitHub runs the workflow file from the PR itself, so protect
.github/with CODEOWNERS and required reviews. - Forked PRs are skipped (job summary + notice, no comment): GitHub gives them no secrets and a read-only token.
pull_request_targetwould run untrusted code with your secrets. - The candidate's code runs in CI with your LLM key. Only PRs from branches in your repository are gated.
- Don't add a
paths:filter to the workflow. Once a fix commit reverts the agent change, that filter stops the workflow, and the PR's new head never gets a check. The action'spathsinput does the filtering instead. - Installing outside this repository: make your project a uv project and add the gate as a dev dependency. The package
agentgate-ciis built but not uploaded yet; until it is, useuv add --dev git+https://github.com/romit-23/AgentGate.setup-commanddefaults touv run agentgate migrate, which creates the gate's tables; append your agent's own setup with&&. The Marketplace listing is prepared in docs/marketplace.md. - Dependencies come from the base. A PR that adds a package to the agent gets no verdict until the dependency is on the base branch.
- Make AgentGate a required check under Settings → Branches to enforce the gate. A neutral check doesn't block merging.
- Design: ADR 0007.
Bring your own key
AgentGate has no hosted scoring service and never asks for, stores or forwards an API key. The gate runs inside your CI job, and every model call goes from that job straight to your provider, on your account and your bill. Nobody else's key is involved, and nothing is sent to this project.
- Where the key goes: a GitHub Actions secret in your repository, passed to the job as an environment variable. Never in
agentgate.yaml, a dataset, a commit or a PR comment. The settings hold it as a secret value, so it isn't logged. - Which keys work:
OPENAI_API_KEY,ANTHROPIC_API_KEYandGEMINI_API_KEY. Calls go through LiteLLM, and the provider prefix of each model in your config (openai/…,anthropic/…,gemini/…) picks the key. Without any of the three, the action skips with a notice and costs nothing. - What it pays for: your agent's calls (your adapter decides which model and key it uses) and the judge's calls (
judge.modelinagentgate.yaml, which must be a different model from your agent's). Embeddings only if your agent uses them. - Using a provider other than OpenAI: set
judge.modelto one of its models, keeptemperature: 0, and pass that provider's key in the workflow'senv:instead ofOPENAI_API_KEY:env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Changing the judge changes the judge fingerprint, so earlier cached baselines no longer match and the next gate run re-scores the base. - What it costs: about cases × repeats × (agent call + judge call) per version scored, and twice that when the baseline isn't cached. This repository's setup (50 cases, K=3,
gpt-5.4-miniagent,gpt-5.2judge at about $0.013 per case-run) costs about $2 per push with a cached baseline and about $4 without one.budget.max_usd_per_gate_runinagentgate.yamlis a hard cap per version: a run whose estimate exceeds it doesn't start, and a run that reaches it stops and can't become a baseline. Set a spending limit at your provider too. - Who can spend it: only PRs from branches in your repository. Forked PRs get no secrets and are skipped. The candidate's code runs with your key, so gate only code you'd run anyway.
- What our results do and don't cover: the A/A, planted-regression and judge-agreement numbers above were measured with this repository's agent, dataset and
openai/gpt-5.2judge. With your agent and another judge they're a starting point, not a guarantee. Before you trust blocks, runagentgate aa-test(identical versions, expected to pass) andagentgate planted-test(versions you broke on purpose, expected to block) on your own setup. Both run on your key.
Dashboard and read API
The app serves server-rendered pages (Jinja2 + HTMX) over the stored results: version history with trends (/), and run detail with case results (/runs/{run_id}). The JSON read API is /api/versions, /api/runs/{run_id} and /api/decisions/{decision_id}. POST /api/runs starts a scored run behind AGENTGATE_ADMIN_KEY.
With AGENTGATE_SERVE_AGENT=false the app is dashboard-only: no agent, no LLM keys, no migrations, and a read-only database role. It has no field that accepts a visitor's key, and nothing a visitor does can start a paid model call. It's live as a static snapshot at agentgate-dashboard.pages.dev on Cloudflare Pages ($0): make site exports the same pages and read API as files (docs/deploy.md). The read API there is api/versions.json, api/runs/<id>.json and api/decisions/<id>.json. The snapshot was exported from the local database, so it has the A/A and planted-regression runs but not the CI runs of PR #7 and PR #21. The live server mode is prepared for one Fly.io machine reading the CI database (about $4/month) and isn't deployed: docs/deploy.md.
The reference agent
A LangGraph agent with three tools (search_kb over pgvector + full-text search, calculator, send_email), a human approval step before any email, a code-level send guard (ADR 0006), step, time and token budgets, a Postgres checkpointer and Langfuse tracing. It runs only in full mode, with AGENTGATE_API_KEY set in .env (sent as X-API-Key):
K=... # your AGENTGATE_API_KEY
# 1. A pricing calculation (search_kb + calculator)
curl -s localhost:8000/v1/chat -H "X-API-Key: $K" -H 'Content-Type: application/json' \
-d '{"session_id":"demo1","message":"What does the Pro plan cost per month for 12 seats on annual billing?"}' | jq '{status,answer,tools:[.trajectory.tool_calls[].name],cost:.trajectory.cost_usd}'
# 2. A question the KB cannot answer (should say it does not know)
curl -s localhost:8000/v1/chat -H "X-API-Key: $K" -H 'Content-Type: application/json' \
-d '{"session_id":"demo2","message":"Who won the 2018 World Cup?"}' | jq '{status,answer}'
# 3. An email: the run pauses for approval, nothing is sent yet
curl -s localhost:8000/v1/chat -H "X-API-Key: $K" -H 'Content-Type: application/json' \
-d '{"session_id":"demo3","message":"Email ana@example.com a one-line summary of the refund policy."}' | jq '{status,pending_action}'
# approve (or send {"approved":false} to reject)
curl -s localhost:8000/v1/chat/demo3/approve -H "X-API-Key: $K" -H 'Content-Type: application/json' \
-d '{"approved":true}' | jq '{status,answer}'
docker compose exec db psql -U agentgate -c 'SELECT session_id, to_addr, subject FROM mock_outbox'
Every run returns a trajectory (answer, tool calls, retrieved doc ids, tokens, cost, latency, trace_id) and is stamped with a version_id: a hash of the prompt files, the agent's code, the model, and the tool and retrieval config. Runs stop with a typed error (step_limit, timeout, token_budget, llm_error), never a crash.
Status and limits
Deployed: the dashboard, as a static snapshot on Cloudflare Pages (agentgate-dashboard.pages.dev).
Not done yet: the Fly.io deployment (the live, self-updating dashboard), the PyPI upload, the Marketplace listing (it needs a separate public repository) and the demo video. All are owner steps.
No new runs here. The OpenAI credits that paid for this repository's agent, judge and embeddings have run out. Until a key with credits is configured again, a PR to this repository that changes agents/ can't be scored and should end without a verdict (neutral). That doesn't affect other repositories: the gate there runs on their own key. Everything else works without an LLM: lint, type checks, unit and integration tests, agentgate demo, the dashboard, the read API, compare and report.
What the numbers don't show:
- Small samples. 10 A/A trials and 5 planted regressions meet the PRD's targets by count, but the 95% bounds are wide (26% and 55%). The planted regressions were written by the gate's author.
- Latency and cost drift between days. A baseline cached on a faster day blocked unchanged agents in 5 of 110 replayed pairs. Since ADR 0010 those rules only warn against a baseline more than 12 h old, so in CI a pure latency or cost regression usually warns rather than blocks. Quality metrics didn't drift.
- Groundedness isn't validated (κ 0.42). It only warns. The judge doesn't see calculator results.
- The judge and the agent come from the same vendor. Self-preference was never measured.
- One agent, 50 synthetic golden cases, 25 security cases, K=3. Category CIs are wide. K=3 can't separate a 1-in-3 failure rate from a 2-in-3 one.
- Cost: about $2 per gated push, against the PRD's $1.
- Not a security claim. AgentGate reports pass rates on a documented suite. It doesn't make the agent secure.
- Open items: docs/TODO.md.
Documentation
- docs/PRD.md: requirements and success criteria
- docs/benchmarks/RESULTS.md: every measured result, with run reports and raw data
- docs/decisions/: ADRs 0001–0010 (judge, model stack, gate statistics, security suite, send guard, CI integration, trust layer, groundedness, latency and cost against an old baseline)
- docs/deploy.md, docs/marketplace.md: deployment and publishing steps
License: MIT.
Metadata
Release files for agentgate-ci 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| agentgate_ci-0.1.0.tar.gz | 212.8 kB | With provenance | Details for agentgate_ci-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentgate_ci-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for agentgate_ci-0.1.0-py3-none-any.whl |
Total release size: 451.4 kB
Release files / agentgate_ci-0.1.0.tar.gz
| Download URL | agentgate_ci-0.1.0.tar.gz |
|---|---|
| Size | 212.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e89ece5b3c9cf94fa4840328b34a68a4039a05c4ab3c58cc934bf6ccef0a63e
|
|
BLAKE2b-256 checksum How to use checksums |
2283f1a003d81f269b97b5e9dba3b3882e5d7557869ab6fc9daf1fe4afb50a6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 5, 2026.
Transparency logRelease files / agentgate_ci-0.1.0-py3-none-any.whl
| Download URL | agentgate_ci-0.1.0-py3-none-any.whl |
|---|---|
| Size | 238.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d23a725011862eb66ea639c73f02a9fe3348c7ffd31fc60507a46957bee464ce
|
|
BLAKE2b-256 checksum How to use checksums |
39db145c8c5f3ce6554c0b69f4afffeef365f836e7fe75b40323139a421855db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 5, 2026.
Transparency logSecurity for agentgate-ci 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for agentgate_ci-0.1.0.tar.gz
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 Dec 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.