Governance in one line of code
Swap a base URL, add middleware or call the guard API. Python and TypeScript SDKs, OpenAI wire format, OpenTelemetry and policy-as-code — no rebuild, no lock-in.
From sign-up to governed traffic in four steps
- 1
Register and get a workspace
We create your organisation with QA → acceptance → performance → production environments.
- 2
Create an application and key
Scoped API keys (gateway, guard, ingest, apigw, mcp) bound to one environment. Rotate with a grace period.
- 3
Connect your agent
Swap the base URL, add the middleware or call the guard API. New agents start in observe mode.
- 4
Review, then enforce
Check findings and would-have-blocked counts, then switch to enforce and promote through your environments.
Pick the integration that fits each agent
Every path uses the same keys, policies, traces and audit trail. Combine them freely.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://gateway.your-company.com/v1",
api_key=os.environ["GOVERNROUTE_API_KEY"],
default_headers={"X-GovernRoute-Agent": "support-bot"},
)
reply = client.chat.completions.create(
model="default", # a GovernRoute model route with failover
messages=[{"role": "user", "content": prompt}],
)Works with any OpenAI-compatible client — OpenAI SDKs, LangChain ChatOpenAI, LlamaIndex, Vercel AI SDK, CrewAI, curl, Java and Go.
What each integration path can do
| Path | Observe | Enforce input | Enforce output | Tool control | Code change |
|---|---|---|---|---|---|
| Inline gateway (OpenAI-compatible) | base_url + key | ||||
| SDK middleware (LangChain / LangGraph, ADK, any) | 1–3 lines | ||||
| Existing LiteLLM proxy | config only | ||||
| OpenTelemetry (OTLP) | env vars | ||||
| MCP / tool gateway | – | – | wrap call_tool | ||
| Customer-hosted gateway | deploy image |
OpenTelemetry ingest is telemetry-only and labelled as such. Every new agent starts in observe mode.
One standard assessment on every decision
Modelled on familiar formats: the action field follows AWS Bedrock ApplyGuardrail, and flagged + categories follow OpenAI Moderation scores — so your code can map it directly.
Response headers
- x-governroute-decision
- allow · redact · block · review
- x-governroute-mode
- observe or enforce
- x-governroute-trace-id
- Joins your W3C traceparent
- x-governroute-request-id
- Look the request up in Activity
- X-GovernRoute-Risk-Score
- 0–1 risk score on every gateway response
Denials are HTTP 403 with an OpenAI-style error body on the AI gateway, and RFC 9457 problem details everywhere else.
{
"schema": "governroute.assessment/v1",
"action": "BLOCKED",
"decision": "block",
"flagged": true,
"risk_score": 0.92,
"mode": "enforce",
"categories": { "prompt_injection": 0.92 },
"guardrails": [{
"name": "Prompt-injection heuristics",
"phase": "inbound",
"decision": "block",
"score": 0.92,
"threshold": 0.7,
"reason_code": "prompt_injection_suspected",
"owasp": ["LLM01:2025", "ASI01:2026"],
"latency_ms": 0.41
}],
"frameworks": ["ASI01:2026", "LLM01:2025"],
"latency_ms": 1.37
}apiVersion: governroute.io/v1
kind: Policy
metadata:
name: Customer data protection
category: data_protection
severity: high
owner: privacy-team
frameworks: [OWASP-LLM:LLM02:2025, GDPR:Art.32]
spec:
mode: enforce # observe | enforce
appliesTo:
environmentKinds: [acceptance, production]
rules:
- id: redact-pii
guardrail: {template: pii_redaction}
action: redact
stages: [input, output]
- id: ssn-hr-only
guardrail: {name: SSN access by role}
action: block
minScore: 0.8
failureMode: fail_closedPolicies live in Git, not in someone's head
Kubernetes-style documents you can review in pull requests, import with a dry run, export to another tenant and test before applying.
- Import — JSON or multi-document YAML, all-or-nothing, with dry-run and conflict handling.
- Test — evaluate sample input and output against a saved or unsaved policy; nothing is recorded as traffic.
- Apply — compile into an immutable workflow version and assign it to an application, environment or workspace.
- Templates — OWASP LLM Top 10 baseline, Customer data protection, Agent tool safety, Regulated environment.
Python and TypeScript, with the same operations
Python and TypeScript SDKs provided with your workspace — fail-closed by default, RFC 9457 errors as typed exceptions.
| Python helper | Endpoint | Purpose |
|---|---|---|
| check_input · check_output · check_tool | POST /v1/guard/check | One-call guard for any stage |
| guard_input · guard_output · guard_tool | POST /v1/guard/input | output | tool | Stage-specific guard checks |
| pre_llm · post_llm · guarded_completion | POST /v1/guardrails/pre-llm | post-llm | Phase-checked evaluate API around your own model |
| restore | POST /v1/guardrails/restore | Restore tokenized values for the caller |
| retrieve | POST /v1/retrievals | Permission-aware retrieval |
| store_memories · search_memories | POST /v1/memories | /search | Guarded agent memory |
| approval_status | GET /v1/approvals/{id} | Poll a human approval |
| emit | POST /v1/events | Telemetry events (never raises) |
Standards we follow
- RFC 9457 problem details
- IETF RateLimit headers
- ETag / If-Match
- Idempotency-Key
- W3C Trace Context
- OpenAPI 3.1
- OpenTelemetry GenAI conventions
- RFC 7239 Forwarded
Ready to connect your first agent?
Register as a client and we'll issue your workspace and keys, and pair you with an onboarding engineer.