Provon Guardrails
Guardrails inspect the prompts, tool calls, and streamed responses that cross the AI Gateway, and the tool calls proposed by local agents through agent hooks. They audit, rewrite, or block supported conditions. Sixteen built-in rules run in the engine's fixed evaluation order, optionally overridden by an explicit priority, without changing your client's OpenAI-compatible contract.
Guardrails govern two real-time boundaries: the model-call boundary for traffic routed through the Gateway, and the tool-execution boundary for Claude Code, Codex, and Cursor sessions with PreToolUse hooks. Hooks evaluate the pre-execution tool-call subset — denylist, PII, secret leak, word list, and semantic policy; rules that need a request body or complete model output remain Gateway-only. Guardrails do not grant permissions, execute tools, or prove that an agent completed its task. Application authorization stays in your application and the MCP Gateway; task-level diagnosis lives in Findings.
Where rules run#
| Insertion point | Inspects | Typical rules |
|---|---|---|
| Input rail | Decoded request messages, context, and declared tool calls | PII, secrets, injection, budgets, denylist |
| Tool rail | Tool calls before execution and untrusted tool results | Denylist, duplicate calls, error loops, result injection |
| Output rail | Candidate text, tool-call arguments, and SSE stream chunks | Schema validation, content safety, prompt leakage, redaction |
The input evaluator owns evaluation order, re-scans the rewritten sample after every transform, and runs a single ordered blocking gate. The output side adds a chunk scanner with carry windows for streaming responses and a buffered segment path when a rule needs the complete answer.
Modes and actions#
Every rule sits inside one Gateway-wide mode:
| Mode | Behavior |
|---|---|
| Off | Do not evaluate guardrails |
| Audit | Record the match and allow the exchange |
| Enforce | Apply the configured action for each triggered rule |
A rule supports only the actions it can execute; invalid pairs are rejected with 400 when settings
are written, not reinterpreted at request time.
| Action | Runtime behavior |
|---|---|
| Audit | Record only; do not change the request or response |
| Block | Reject the exchange with HTTP 409, or terminate an in-progress stream when the match is only known after delivery started |
| Transform | Redact supported sensitive content, or rewrite the request to lower a supported limit (for example capping requested completion tokens) |
Start new rules in Audit against representative traffic. Audit records the action Enforce would
have taken as provon.guard.would_action, so false positives can be reviewed before any traffic is
blocked.
How evaluation is layered#
Rules deliberately mix free local checks with bounded model calls:
- Deterministic first. Regex, similarity, schema, and counter rules run locally with no network cost and settle clear cases immediately.
- Escalate the borderline. Injection heuristics emit a high-confidence block verdict or a suspicious verdict; only suspicious input is escalated to a model judge.
- Bound the model path. Checker calls have timeouts, context and output caps, content-hash verdict caching, and an explicit fail-open or fail-closed choice per policy.
- Record everything. Each check emits a bounded execution record and each match a decision with category, action, duration, and field position — never the inspected text.
Slow input judges can run in parallel with the upstream call when parallel checks are enabled, and repeated verdicts are served from a bounded LRU/TTL cache keyed by content hash. See Testing and observability for the evidence model.
Rule families#
The sixteen catalog rules group into six families:
| Family | Rules | Deep dive |
|---|---|---|
| Sensitive data | 2 | Sensitive data |
| Prompt safety | 3 | Prompt safety |
| Tool governance | 4 | Tool governance |
| Semantic policy | 2 | Semantic and output rules |
| Output contracts | 2 | Semantic and output rules |
| Context budgets | 3 | Semantic and output rules |
The full plugin-id, direction, and action matrix is in the rule catalog.
Boundaries#
- Guardrails only control the boundaries you connect. Direct upstream calls bypass Gateway rules; tool execution outside an installed hook bypasses hook rules.
- A pass is not proof the task succeeded; it means no configured rule matched this exchange.
- Rules inspect model-call content. MCP permission decisions, credential sealing, and the deterministic transport scans on the tool gateway belong to MCP security.
- Model-backed rules call the checker through the internal Gateway path, which itself skips guardrails, so a judge can never recurse into another judge.
- Match evidence stores categories, hashes, and measurements. Raw prompts, policy text, and replacement values are never persisted as guardrail evidence.
Task map#
| Want to | Go to |
|---|---|
| Browse every plugin id, direction, and supported action | Rule catalog |
| Redact PII or secrets, choose a redaction mode | Sensitive data |
| Stop prompt injection, jailbreaks, or harmful content | Prompt safety |
| Govern agent tools and untrusted tool results | Tool governance |
| Write natural-language policies or validate output schemas | Semantic and output rules |
| Dry-run rules, read trace evidence, or handle the block contract | Testing and observability |
| Set rate limits and token or cost budgets | Gateway limits |
Next steps#
- Review the rule catalog and pick the families that match your risk model.
- Enable them in Audit mode and inspect matches in the Workbench or via
provon gateway guardrails get. - Switch individual rules to Enforce once false positives are understood, and verify clients
handle the
409block contract.