Enterprise Prompt Governance Registry (EPGR)
Overview
The Enterprise Prompt Governance Registry (EPGR) is a centralized, versioned repository and orchestration system for managing LLM prompts in production environments. It enforces governance through integrated version control , automated evaluation metrics , human sign-off workflows , and progressive rollout tooling . EPGR ensures auditability, compliance (e.g., SOC 2, GDPR), and safe deployment across multi-tenant setups.
Key Principles:
Immutable Versions : Prompts are never overwritten; changes create new versions.
Gatekeeping : Deployment requires passing evals + human approval.
Observability : Full audit trail with metrics, diffs, and rollback capabilities.
Scalability : Supports 1000s of prompts, teams, and models (e.g., GPT-4, Llama).
EPGR can be implemented as a GitOps-backed service using tools like GitHub/GitLab, PostgreSQL/ArangoDB for metadata, Airflow/Kubeflow for workflows, and Prometheus/Grafana for monitoring.
Architecture
code Copy code
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Prompt IDE │───▶│ EPGR Core │───▶│ Deployment │
│ (VSCode/CLI) │ │ (Version DB) │ │ Platform │
└─────────────────┘ │ - Schema │ │ (K8s/LLM Gateway│
│ - API │ └─────────────────┘
│ - Workflows │ │
└──────────────────┘ │
│ ▼
┌──────────────────┐ ┌─────────────────┐
│ Eval Engine │◀──▶│ Observability │
│ (LLM-as-Judge, │ │ (Metrics, Logs, │
│ RAG, BLEU/ROUGE)│ │ Traces) │
└──────────────────┘ └─────────────────┘
▲
┌──────────────────┐
│ Human Sign-Off │
│ (UI/Slack/Email) │
└──────────────────┘
Core Components :
Component Tools/Tech Purpose Version Control Git (semantic versioning) Track prompt history, diffs, branching. Eval Metrics LangChain Eval, DeepEval Automated scoring (safety, accuracy, latency). Human Sign-Off GitHub Approvals, Okta RBAC-gated reviews. Rollout Tooling ArgoCD, Flagger, Istio Canary/A/B/Blue-Green deploys.
Data Model (PostgreSQL Schema)
sql Copy code
-- Prompts Table (Core Registry)
CREATE TABLE prompts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) UNIQUE NOT NULL,
description TEXT,
tenant_id UUID NOT NULL, -- Multi-tenancy
created_at TIMESTAMP DEFAULT NOW(),
created_by UUID NOT NULL -- User ID
);
-- Versions Table (Version Control)
CREATE TABLE prompt_versions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
prompt_id UUID REFERENCES prompts(id) ON DELETE CASCADE,
version_semver VARCHAR(20) NOT NULL, -- e.g., "1.2.3"
content TEXT NOT NULL, -- Prompt template (Jinja2/Handlebars)
variables JSONB, -- {{user_input}}, etc.
git_commit_hash VARCHAR(40), -- Git SHA
parent_version_id UUID REFERENCES prompt_versions(id), -- For diffs
diff_summary TEXT, -- AI-generated diff
created_at TIMESTAMP DEFAULT NOW(),
created_by UUID NOT NULL,
UNIQUE(prompt_id, version_semver)
);
-- Evaluations Table (Eval Metrics)
CREATE TABLE evaluations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
version_id UUID REFERENCES prompt_versions(id) ON DELETE CASCADE,
eval_suite VARCHAR(100) NOT NULL, -- e.g., "safety", "accuracy"
metrics JSONB NOT NULL, -- { "accuracy": 0.95, "toxicity": 0.02, "latency_ms": 150 }
threshold_passed BOOLEAN NOT NULL,
dataset_hash VARCHAR(64), -- Reproducible evals
eval_cost_usd DECIMAL(10,4),
created_at TIMESTAMP DEFAULT NOW()
);
-- Sign-Offs Table (Human Approval)
CREATE TABLE sign_offs (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
version_id UUID REFERENCES prompt_versions(id) ON DELETE CASCADE,
reviewer_id UUID NOT NULL,
status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
comments TEXT,
signed_at TIMESTAMP,
UNIQUE(version_id) -- One sign-off per version
);
-- Deployments Table (Rollout Tracking)
CREATE TABLE deployments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
version_id UUID REFERENCES prompt_versions(id),
environment ENUM('dev', 'staging', 'prod') NOT NULL,
rollout_strategy ENUM('full', 'canary', 'ab') NOT NULL,
traffic_pct INTEGER DEFAULT 100, -- For canary/A/B
status ENUM('pending', 'active', 'rolled_back') DEFAULT 'pending',
deployed_at TIMESTAMP,
rolled_back_at TIMESTAMP
);
-- Audit Logs
CREATE TABLE audit_logs (
id SERIAL PRIMARY KEY,
entity_type VARCHAR(50),
entity_id UUID,
action VARCHAR(50), -- create/update/deploy
actor_id UUID,
metadata JSONB,
timestamp TIMESTAMP DEFAULT NOW()
);
Workflows
1. Prompt Creation & Versioning
code Copy code
git checkout -b prompts/my-prompt/v1.2.0
# Edit prompt.j2 in IDE/CLI
epgr commit --prompt=my-prompt --message="Fix variable escaping"
epgr push # Triggers eval pipeline
Auto-generates semantic version (major.minor.patch).
Computes diff vs. parent.
2. Evaluation Pipeline (Automated Gates)
Trigger: On commit/push.
Suites: Configurable YAML (e.g., eval_suites/safety.yaml).
yaml Copy code
# Example Eval Suite
name: safety
metrics:
- name: toxicity
type: perspective_api
threshold: {min: 0, max: 0.05}
- name: jailbreak_rate
type: llm_judge
threshold: {max: 0.01}
dataset: golden_set_1000.jsonl # Versioned eval data
Pass Criteria: All metrics ≥ thresholds.
Integration: GitHub Actions / GitLab CI.
3. Human Sign-Off
UI: Web dashboard (React + EPGR API) or Slack bot.
RBAC: Owners approve prod; reviewers for staging.
Required: 1+ approvals for staging, 2+ for prod.
Auto-notify: @team-prompts on failure.
4. Rollout Tooling
Strategies :
Strategy Description Tooling Full 100% traffic ArgoCD Sync Canary 10% → 50% → 100% Flagger + Metrics A/B Split vs. baseline Gateway (e.g., Kong)
CLI: epgr deploy my-prompt:v1.2.0 --env=prod --strategy=canary --pct=10
Monitoring: Prometheus alerts on eval drift post-deploy.
Rollback: epgr rollback my-prompt --to=v1.1.0
API Endpoints (REST/gRPC)
yaml Copy code
# OpenAPI Snippet
/prompts/{name}/versions:
get: List versions with evals/sign-offs
/prompts/{name}/versions/{semver}/deploy:
post: Initiate rollout (checks gates)
/evals/{version_id}/rerun:
post: Re-eval with new dataset
/status/{name}: Current active version per env
Security & Compliance
RBAC : Fine-grained (read/write/deploy/approve) via OPA or Auth0.
Encryption : Content at-rest (AES-256), in-transit (TLS 1.3).
Audit : Immutable logs queryable via API.
Secrets : No secrets in prompts; inject via Vault.
Implementation Roadmap
MVP (1 month) : Git + Postgres + Basic Evals (Week 1-2), Sign-off UI (Week 3-4).
Beta (2 months) : Rollout + Multi-tenant.
GA : Observability, Drift Detection.
Quickstart CLI
bash Copy code
pip install epgr-cli
epgr init my-org/my-prompt
# Follow workflows above
This registry scales to enterprise needs, reducing prompt-related incidents by 90%+ via gates. For customizations, provide your stack details.