Guardrail Rules

Configurable rules that evaluate every AI request and response.

Rule Types

TypeDescription
contains_piiDetects emails, phone numbers, SSNs, custom PII patterns
contains_secretDetects API keys, tokens, AWS keys, high-entropy strings
token_limit_exceededEnforces maximum token limits per request
model_allowlistRestricts which AI models can be used

Actions

ActionBehavior
allowLog the violation but allow the request
warnLog a warning and allow the request
blockBlock the request entirely
redactReplace matched spans with [REDACTED:pii] or [REDACTED:secret] before storage, then allow the request. The original text is never persisted.

How Redaction Works

Redaction happens inside the ingest layer, before encryption — raw text never reaches the database.

  • The redactions array in the API response lists what was redacted and the character offsets where it occurred.
  • The dashboard prompt/response viewer shows the redacted version because the encrypted field stores the already-redacted text.
  • Redaction applies to both ai.request prompts and ai.response outputs.
  • When redaction fires, the raw messages / output keys are also removed from the stored JSONB payload.

Decision Hierarchy

When multiple rules fire, the strictest action wins: block > redact > warn > allow.

Managing Rules

Rules are managed per-app in the dashboard under the Rules tab. You can create, edit, enable/disable, and delete rules. Each rule can be scoped to a specific environment or applied to all environments.