Ritesh Kumar · Open source

AI Governance Platform

A multi-agent AI system where every request passes seven governance layers — real identity, policy, data, model, guardrail, tool-authorization and audit controls — before it is allowed to answer. No mocked checks. Runs on a 16 GB laptop.

The seven layers

Every request walks this chain in order. Any layer can short-circuit straight to logged the moment it denies — a blocked request is still recorded, because you need the record of the denial as much as the allow.

1
IdentityKeycloak (human login, OIDC) + SPIFFE/SPIRE (the agent's own workload certificate). No static API key as identity.
2
PolicyOpen Policy Agent — has this identity been revoked by the kill switch?
3
DataWhich columns are PII? OPA decides what gets masked before any row reaches the model.
4
ModelMLflow registry — is this model version actually approved for production traffic?
5
GuardrailsInput screened for prompt injection; output screened for leaks.
6
Tool-callOPA again — may this role call this tool, and may it hand off to this agent?
7
LoggedLangfuse traces plus a hash-chained, tamper-evident audit log in Postgres.

Layers 3, 5 and 6 all query the same OPA instance. It is one shared policy hub, not a single stage — which is why authorization rules live in four readable .rego files instead of scattered if statements.

The dashboard

The AI Governance Dashboard showing the agent's SPIFFE identity, kill-switch controls, login role selector and scenario presets.
The live dashboard. Note the agent's SPIFFE identity at the top, and that the role comes from which account you log in as — there is no role field a caller could set on the request.

What a blocked request looks like

A student tries to reach the admin agent. The handoff itself requires permission, so it is refused before the admin agent's tools are even reachable:

$ docker compose exec agent python demos/scenario_b_policy_block.py

blocked=True  blocked_at_layer=tool_call  role=demo-agent

  identity          pass   Keycloak user 'student' + SPIFFE ID attached
  policy            pass   identity is active, not revoked
  data              pass   columns to mask this request: ['email']
  model             pass   using version 2 (groq/qwen/qwen3.8-27b, risk_tier=low)
  agent_guardrails  pass   input check passed
  tool_call         FAIL   routing to 'admin_agent' forced by request, but denied:
                           role 'demo-agent' not permitted to call tool
                           'route:admin_agent'
  logged            pass   trace 747520e6-999c-4a61-aede-0d314e7a470a recorded

Captured from a real run while the project was still configured against Groq, which is why the model layer names a Groq model. It now ships OpenAI-only; the transcript is left as it was actually produced rather than edited to match the current config.

Most multi-agent systems authorize tool calls. This one authorizes the handoff too — so a compromised orchestrator cannot reach a privileged agent's toolset at all.

The bug worth talking about

A quality gate that silently passed everything

The model-promotion pipeline runs each candidate through four gates and promotes whichever scores best. The quality gate reads an LLM-judge score out of 5. It read the metric key answer_correctness/v1/mean — a key only MLflow's built-in judge emits. A custom metric emits answer_correctness/mean.

quality = metrics.get("answer_correctness/v1/mean", 0.0)   # always 0.0

Every candidate scored 0.0. The gate never failed anything, and the "best" model was chosen on coherence and latency alone. Nothing errored — the pipeline ran green and promoted models, just on the wrong criterion.

Fixing it changed which model actually reached production:

ModelMeasured qualityBefore fixAfter fix
gpt-oss-20b3.5 / 5promoted, on a 0.0 tie-breakStaging
qwen3.8-27b4.1 / 5StagingProduction
A governance control that silently passes everything is worse than no control, because you trust it. The lesson: every gate needs a test proving it can actually fail.

Verified state

6 / 6
demo scenarios passing — one allow path, four block paths, one authorized write
18
Rego policy tests, run in CI
10
Python tests, 0.11s, no heavy deps
7 / 8
compliance items satisfied with real log evidence
2.16 GB
measured RAM for 12 services
$0
to run — Groq free tier, no OpenAI credit needed

The eighth compliance item needs a companion package that is currently a name-reservation stub on PyPI. The report says so rather than claiming a pass — which is rather the point of the project.

What I contributed

This builds on the AI Governance Teaching Platform by @data-guru0, which is the origin of the seven-layer architecture, the Compose topology, the Rego policies and the dashboard. Credit for that design belongs to its author. My work was getting it to actually run, and hardening it:

#BugImpact
1Quality gate read the wrong metric keyScored every candidate 0.0; picked winners on the wrong criterion
2Pinned Groq model had been retiredEvery model evaluation crashed with a 404
3No max_tokens on any completion callFree tier rejected requests outright (est. 1168 vs a 1000/min ceiling)
4No PYTHONUNBUFFEREDAll startup logging invisible; failures looked like silence
5Data layer failed open when the catalog was unreachableServed unmasked PII. An unreachable catalog is not evidence a column is safe.

Plus new functionality:

Known limits

Stated plainly, because a governance project that hides its own weaknesses has missed the point:

The agent refusing to boot without a valid workload identity is not on this list — that is a control working correctly.