Demonstrating that AI governance doesn't slow delivery—it enables it.
A production-ready system proving governance and velocity aren't trade-offs—they're synergies.
This repository demonstrates integrated AI governance: embedding risk management, compliance, and ethical controls directly into the development lifecycle—not as gates, but as guardrails that accelerate safe deployment.
Built to showcase expertise in LLMOps, GenAI program leadership, and responsible AI operationalization for organizations deploying enterprise AI at scale.
Most AI governance fails at the handoff. Data scientists build models. Risk teams review after the fact. Compliance blocks deployment. Speed and safety become adversaries.
The pattern of failure:
- Epic Systems' sepsis model missed 2/3 of cases while generating false alerts for 18% of patients—deployed without adequate governance review
- A major financial institution paid $18.5M in fines after AI-driven loan approvals ran for months with 37% racial bias undetected
- Governance reviews that take weeks, blocking launches that needed days
This framework fixes that by moving governance inline with delivery:
✅ Policy-as-Code enforcement at runtime (not post-deployment audits) ✅ Automated compliance gates in CI/CD (quality, fairness, safety thresholds validated pre-merge) ✅ Evidence collection built into the pipeline (audit trails generate automatically) ✅ Real-time observability of governance metrics (Prometheus + Grafana dashboards)
The result: AI teams ship faster because governance catches issues early, not late.
- Reduce time-to-deployment by 40-60% through automated governance gates vs. manual review cycles
- Mitigate regulatory risk with built-in NIST AI RMF, ISO 42001, and EU AI Act compliance mapping
- Demonstrate due diligence with tamper-evident audit trails and automated evidence collection
- Accelerate responsible innovation by making safety a competitive advantage, not a bottleneck
- Ship with confidence: Pre-commit checks enforce quality (pass@5 ≥ 0.82), fairness (subgroup delta ≤ 5%), and safety (harmful rate ≤ 0.5%) thresholds
- Automate the boring stuff: Model cards, bias reports, and compliance artifacts generate from pipeline metadata
- Observability by default: Prometheus metrics expose drift, quality degradation, and fairness violations in real-time
- Production-grade architecture: Kubernetes-ready Helm charts, sidecar policy enforcement, and GitOps-native deployment
┌─────────────────────────────────────────────────────────────┐
│ Developer Workflow (Governed Speed in Action) │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. Code Commit │
│ ↓ │
│ 2. Pre-Commit Gate (pac_ci.py) │
│ • Validates quality/fairness/safety metrics │
│ • Blocks merge if thresholds violated │
│ ↓ │
│ 3. CI/CD Pipeline │
│ • Builds Docker images │
│ • Runs integration tests │
│ • Submits evidence to RES │
│ ↓ │
│ 4. Runtime Enforcement (Policy Gateway Sidecar) │
│ • Filters prompts (PII, jailbreaks) │
│ • Monitors outputs (copyright, toxicity) │
│ • Proxies to vLLM with policy checks │
│ ↓ │
│ 5. Continuous Monitoring (Prometheus + Grafana) │
│ • Tracks quality drift (PSI > 0.2 → retrain) │
│ • Alerts on fairness violations │
│ • Generates compliance snapshots │
│ │
└─────────────────────────────────────────────────────────────┘
| Component | Purpose | Technology |
|---|---|---|
| Policy Gateway | Runtime sidecar enforcing Policy-as-Code rules | FastAPI, sidecar pattern |
| Risk & Evidence Service | Collects evaluation artifacts, exposes governance metrics | FastAPI, Prometheus, SHA256 hashing |
| ADR-006 Config | Single source of truth for thresholds and policy rules | YAML/JSON, mounted as ConfigMap |
| Observability Stack | Real-time monitoring of quality, fairness, safety, drift | Prometheus, Grafana, Loki |
| Pre-Commit Gate | Local governance validation before push | Python CLI tool |
Deployment Model: Policy Gateway runs as a sidecar container alongside vLLM inference, intercepting requests/responses for policy enforcement without modifying model serving code.
- Required: Docker & Docker Compose
- Recommended:
devboxfor reproducible environment (install guide) - Production: Kubernetes cluster + Helm 3
# 1. Clone and enter reproducible environment
git clone https://github.com/SPRIME01/GovernedSpeed.git
cd GovernedSpeed
devbox shell # Provides Python 3.11, kubectl, helm, just
# 2. Start full stack
docker compose -f deployments/docker-compose.yml up --build
# 3. Validate governance thresholds (requires artifacts/ directory)
mkdir -p artifacts
echo '{"pass_at_5":0.84}' > artifacts/eval_quality.json
echo '{"subgroup_delta":0.03}' > artifacts/eval_fairness.json
echo '{"harmful_rate":0.002}' > artifacts/eval_safety.json
echo '{"psi":0.08}' > artifacts/eval_drift.json
just ci-check # Exit 0 = passed, 1 = violations
# 4. Access services
# Gateway: http://localhost:8081/health
# RES: http://localhost:8080/health
# Grafana: http://localhost:3000 (admin/admin)Test the policy gateway:
curl -X POST http://localhost:8081/filter/prompt \
-H "Content-Type: application/json" \
-d '{"prompt":"test","context":{"jailbreak_score":0.9}}'
# Expected: {"allowed":true,"action":"safe_mode","reasons":["high jailbreak score"]}For a one-command developer setup that creates a local .venv, installs dev dependencies, runs the linter and tests, you can use the helper target:
just dev-setupThis runs scripts/dev_setup.sh (which prefers uv if available, falling back to python3 -m venv + pip).
This repository includes a small adapter pattern for connecting the Policy Gateway to LLM providers via a lightweight adapter layer (LiteLLM). The gateway exposes a proxy endpoint that forwards completion requests to an upstream LLM after policy checks:
- POST /proxy/completion — accepts a JSON body
{ "prompt": "...", "model": "..." }and returns{ "content": "...", "model": "...", "usage": {...} }.
Configuration:
PAC_UPSTREAM_URL— base URL of your LLM service (defaults tohttp://localhost:8000). The HTTP adapter forwards requests to${PAC_UPSTREAM_URL}/completionby default.
You can select the LLM adapter used by the Policy Gateway at runtime via the
PAC_LLM_PROVIDER environment variable. Supported values:
http(default) — forward to an upstream HTTP LLM endpoint (usesPAC_UPSTREAM_URL).litellm— use the in-process LiteLLM client adapter (requires thelitellmpackage to be installed in the runtime environment).
Examples:
# Use the HTTP forwarder (default)
export PAC_LLM_PROVIDER=http
export PAC_UPSTREAM_URL=http://localhost:8000
# Use the litellm adapter (requires litellm installed in the venv/container)
export PAC_LLM_PROVIDER=litellmThe gateway exposes a Server-Sent-Events endpoint for streaming completions:
- POST /proxy/completion/stream — returns
text/event-streamchunks where each chunk is prefixed withdata:and terminated by a blank line.
Curl example (reads the full stream until the server closes the connection):
curl -N -H "Content-Type: application/json" \
-X POST http://localhost:8081/proxy/completion/stream \
-d '{"prompt":"Write a short poem","model":"gpt-mock"}'JavaScript streaming examples (browser)
Native EventSource only supports GET requests. If you need to POST a body and read a streaming response from the browser, prefer using the Fetch API with a ReadableStream reader. Example:
// POST and read streaming response using fetch + ReadableStream
async function streamCompletion() {
const resp = await fetch('/proxy/completion/stream', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt: 'Hi' }),
});
if (!resp.body) throw new Error('No streaming body on response');
const reader = resp.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value, { stream: true });
console.log('chunk:', chunk);
}
}
streamCompletion().catch((err) => console.error('stream error', err));If you specifically want an EventSource-style API and are willing to add a
small polyfill, you can use a library such as event-source-polyfill in
Node/browser environments that require POST/advanced behavior — but be
explicit: native EventSource is GET-only.
Testing:
- The test suite includes an integration test that spins up a lightweight mock HTTP server to simulate a vLLM backend and asserts the gateway forwards requests and returns the backend response (
services/policy-gateway/tests/test_llm_proxy.py).
# 1. Create ADR-006 ConfigMap
kubectl create configmap adr-006-config \
--from-file=adr-006.embedded-governance.yaml=./policies/adr-006.embedded-governance.yaml \
-n default
# 2. Deploy via Helm
helm upgrade --install policy-gateway ./charts/policy-gateway -n default
helm upgrade --install risk-evidence-service ./charts/risk-evidence-service -n default
# 3. Verify
kubectl get pods -l app=policy-gateway
kubectl logs -f deployment/policy-gateway -c policy-gatewayPROJECT_STATE.md for:
- Secret management (API keys, webhook secrets)
- StorageClass configuration for PVCs
- Real vLLM integration (currently mocked)
- Automated testing setup
Traditional approach: Post-deployment audit finds bias → emergency rollback → reputational damage
Governed Speed approach: Pre-commit gate blocks merge → developer fixes locally → no deployment risk
# policies/adr-006.embedded-governance.yaml
thresholds:
fairness:
subgroup_delta: { target_max: 0.05, block_above: true }# Developer runs before pushing
just ci-check
# Output if violated:
# ❌ Governance Gate FAILED
# - fairness.subgroup_delta 0.08 > max 0.05
# Fix required before mergeImpact: Catches bias in development, not production. Prevents the $18.5M fine scenario.
# Policy Gateway decides at request time
POST /filter/prompt
{
"prompt": "Email me at user@example.com",
"context": {"contains_pii": true, "lawful_basis": false}
}
# Response:
{
"allowed": false,
"action": "block",
"reasons": ["PII without lawful basis"]
}Impact: Prevents privacy violations at runtime, creating tamper-evident audit trail.
- Production observability: Prometheus metrics for drift detection, Grafana dashboards for governance KPIs
- CI/CD integration: GitHub Actions workflow with automated threshold validation
- Model lifecycle management: Evidence collection, model cards, system cards auto-generated from pipeline
- Infrastructure-as-Code: Helm charts, Docker Compose, GitOps-ready configurations
- Framework synthesis: Unified NIST AI RMF + ISO 42001 + EU AI Act + CPMAI+E implementation
- Stakeholder alignment: Documentation structured for executives (business value), practitioners (technical depth), auditors (compliance evidence)
- Change management: Integrated governance model proven to reduce deployment cycles while increasing safety
- Risk operationalization: Live risk register, incident response playbooks, SLO-driven alerting
- Sidecar architecture: Policy enforcement without modifying inference code
- Cryptographic evidence: SHA256 hashing for tamper-evident audit trails
- Real-time enforcement: FastAPI-based policy gateway with <10ms overhead
- Cloud-native design: Kubernetes-ready, multi-environment (dev/staging/prod) support
| Document | Audience | Purpose |
|---|---|---|
| Quick Start Guide | Everyone | 10-minute walkthrough |
| AI Agent Instructions | AI Assistants | Architecture patterns, workflows |
| Technical Reference | Engineers | API specs, configuration details |
| LLMOps Runbook | MLOps teams | SLOs, monitoring, incident response |
| Policy-as-Code Starter | Governance leads | Rule syntax, evaluation matrix |
| Project State & Roadmap | Contributors | TODOs, expert guidance needed |
| Testing Guide | Developers | Unit/integration/e2e test patterns |
Full handbook: docs/IAGPM_GenAI_Handbook/
- Quality: pass@5 ≥ 82% (code generation benchmark)
- Fairness: Subgroup delta ≤ 5% (demographic parity)
- Safety: Harmful output rate ≤ 0.5% (red-team validated)
- Drift: PSI ≤ 0.2 (data distribution monitoring)
- PII detection and lawful basis validation
- Jailbreak attempt detection (score > 0.8 → safe mode)
- Copyright protection (verbatim ratio > 20% → summarization)
- Configurable rules via YAML (no code changes required)
- SHA256-hashed evidence artifacts
- Tamper-evident storage with timestamps
- Automated model card generation
- Compliance snapshot API (
GET /risk/snapshot)
- Prometheus metrics:
llm_pass_at_5,fairness_subgroup_delta,harmful_output_rate,drift_psi - Pre-built Grafana dashboard with threshold visualization
- Alerting rules for governance violations
- Integration with existing monitoring infrastructure
Challenge: AI-driven lending must comply with fair lending laws Solution: Automated fairness gates prevent biased models from reaching production Outcome: Continuous compliance monitoring, reduced regulatory risk
Challenge: HIPAA requires auditable evidence of data handling Solution: Policy Gateway blocks PII without lawful basis, RES logs all decisions Outcome: Real-time privacy protection with tamper-evident audit trail
Challenge: Customer-facing AI must avoid toxic/harmful outputs Solution: Runtime safety checks with configurable harm thresholds Outcome: Brand protection through automated content filtering
Challenge: EU AI Act requires risk management documentation Solution: Automated evidence collection aligned to compliance frameworks Outcome: Audit-ready documentation generated from development pipeline
Current State: MVP with manual validation → Production hardening in progress
- Unit/integration test suite (80%+ coverage)
- Secret management (SealedSecrets or ESO)
- Production StorageClass configuration
- CI enhancements (security scanning, coverage reports)
- Real vLLM deployment with GPU support
- Model storage strategy (PVC-based)
- API key authentication
- Autoscaling configuration
- Prometheus alerting rules
- Loki log aggregation
- OpenTelemetry distributed tracing
- Runbook automation
See PROJECT_STATE.md for detailed implementation plan.
This is a portfolio project demonstrating production-grade AI governance patterns. Contributions welcome for:
- Production deployment experiences (cloud provider-specific guidance)
- Additional policy rule examples
- Integration with other LLM serving frameworks (Ollama, TGI, etc.)
- Compliance framework mappings (SOC 2, HIPAA, FedRAMP, etc.)
Development setup: See .github/copilot-instructions.md for architecture patterns, workflows, and conventions.
License: MIT (see LICENSE) Author: Samuel Prime Year: 2025
Frameworks Synthesized:
- NIST AI Risk Management Framework (AI RMF)
- ISO/IEC 42001:2024 (AI Management System)
- EU AI Act (Risk-Based Regulation)
- CPMAI+E (Cognitive Project Management for AI + Ethics)
This repository demonstrates: AI governance doesn't have to slow delivery when it's embedded in the delivery process.
Key Differentiators:
- Strategic: Governance as a business enabler, not a compliance tax
- Technical: Production-grade hexagonal architecture, not prototypes
- Integration: Unified NIST AI RMF + ISO 42001 + EU AI Act implementation
- Operational: Real monitoring, incident response, and audit trails
For hiring managers: Governance that moves at the speed of innovation. For practitioners: A template you can deploy tomorrow. For auditors: The evidence trail you wish every AI team maintained.
Samuel Prime GitHub | LinkedIn
Demonstrating that the future of AI is governed speed—where safety and velocity reinforce each other.
The justfile provides shortcuts for common workflows:
just ci-check # Validate governance thresholds locally
just deploy-config # Create ADR-006 ConfigMap in K8s
just deploy-res # Deploy Risk & Evidence Service
just deploy-vllm-with-gateway # Deploy Policy Gateway with vLLMSee justfile for full command reference.
This repository provides a complete production-ready kit:
- Architecture: Hexagonal (ports/adapters) Policy Gateway + Evidence Service
- Specs: OpenAPI 3.0 contracts for both services (
specs/) - Deployment: Docker Compose (local) + Helm charts (K8s) (
deployments/,charts/) - Observability: Prometheus metrics + pre-built Grafana dashboards (
observability/) - Policy Configuration: ADR-006 YAML with thresholds/rules (
policies/) - Documentation: Diátaxis-structured handbook (
docs/IAGPM_GenAI_Handbook/) - Tools: Pre-commit gate (
pac_ci.py), evidence viewer (res_viewer/) (tools/)
Core APIs:
| Service | Endpoint | Purpose |
|---|---|---|
| Policy Gateway | POST /filter/prompt |
Runtime prompt filtering |
| Policy Gateway | POST /filter/output |
Runtime output filtering |
| Policy Gateway | POST /ci/check |
Pre-merge threshold validation |
| RES | POST /evidence |
Submit audit artifacts |
| RES | GET /risk/snapshot |
Current compliance state |
| RES | GET /metrics |
Prometheus metrics |
This platform is a governance-embedded operating system for GenAI—policy checks and evidence capture are first-class pipeline citizens, not afterthoughts.