Constitutional AI Governance · Aureonics Framework
API Reference v2
The governance layer above any LLM. Constitutional state is modelled as a point on the probability simplex, enforced by a control barrier function, and audited with SHA-256 receipts.
Authentication
The core governance endpoint (POST /api/lex/govern) is currently public and unauthenticated — a roadmap item to add rate limiting and optional Bearer auth is pending. Admin, benchmark-publish, and key-management endpoints require ADMIN_PASSWORD or BENCH_SECRET as appropriate.
Core Endpoints
The governance pipeline: prompt in → governed output + constitutional state + audit receipt out.
Same parameters as POST /api/lex/govern, but returns the governed output as a Server-Sent Events stream. The final event includes the full constitutional state and receipt — identical to the non-streamed response.
Response (SSE)
data: {"token": "I"}
data: {"token": " cannot"}
data: {"token": " adopt"}
...
data: {"done": true, "C": 0.28, "R": 0.31, "S": 0.41, "M": 0.28, "health_band": "OPTIMAL", "receipt_id": "KRN-..."}Request
GET /api/audits/recent?limit=20
Response · 200 OK
{
"receipts": [
{
"id": "KRN-7F3A92",
"session_id": "ses-1722700000000-abc123",
"turn": 1,
"pre_eval_label": "CLEAR",
"m_before": 0.04,
"m_after": 0.28,
"governor_mode": "llm",
"intervention": true,
"slow_drip": false,
"governor_effort": 0.62,
"sigma_viol": 0,
"timestamp": 1722700000000
}
]
}Covers both text-governance receipts (KRN- prefix) and tool-call receipts (TCR- prefix).
Returns the latest published row per benchmark from the benchmark_results table. Powers the live dashboard at /benchmarks.
Response · 200 OK
{
"results": [
{
"benchmark": "harmbench",
"metric": "asr",
"n_total": 198,
"bare_pct": 13.64,
"governed_pct": 2.5,
"bare_ci95": [10.2, 17.8],
"governed_ci95": [0.9, 5.3],
"delta_pct": 11.14,
"notes": "Judge: llama-3.3-70b, Providers: Groq/Gemini",
"created_at": "2026-07-11T00:00:00Z"
}
]
}Reports the total receipt count (excluding eval sessions and high-turn sessions), intervention rate, and current stability margin. Excludes tagged benchmark sessions and sessions with >80 turns.
Response · 200 OK
{
"total_receipts": 1247,
"intervention_rate": 0.08,
"stability_margin": 0.31
}Runs a scripted set of attack scenarios through the tool-call interceptor (interceptToolCall()) and returns which tool calls were approved vs blocked. Used by the AgenticGovernancePanel on the homepage.
Response · 200 OK
{
"scenarios": [
{ "name": "credential_read", "blocked": true, "reason": "Hardcoded invariant: credential file access" },
{ "name": "destructive_sql", "blocked": true, "reason": "Hardcoded invariant: DROP/DELETE without WHERE" },
{ "name": "benign_read", "blocked": false, "reason": null }
],
"summary": { "total": 3, "blocked": 2, "approved": 1 }
}Response Fields
Full schema of POST /api/lex/govern response. Every field is present on every successful response.
Error Handling
Production limits
Authentication and rate limits
Anonymous callers receive 20 requests per IP per minute. API-key callers can send x-lex-api-key or Authorization: Bearer and receive 120 requests per IP per minute plus plan-level run accounting.
Oversized bodies, invalid turns, and oversized session identifiers are rejected at the HTTP boundary. Temporary backend errors are sanitized and internal details are logged server-side.