How guardrails work.
Four pre-call checks and two post-call checks run on every request. Blocked requests return 403 — never enqueued, never billed.
Pipeline order
Guardrails always run before routing
→ Auth + rate limit check
→ [PRE-CALL GUARDRAILS]
1. Prompt injection detection (ML classifier, ~30ms)
2. PII detection (~20ms)
3. Content moderation (keyword + ML, ~5ms)
4. Tool-call policy check (allowlist/denylist, ~10ms)
↳ blocked? Return 403. Request never reaches LLM. Never billed.
→ Semantic cache check → Routing → LLM call
→ [POST-CALL GUARDRAILS]
5. Response content filter
6. Response PII scan
→ Token metering → Response to client
Guardrail types
Four pre-call layers
Prompt Injection
ML-based prompt-injection classifier. Threshold: 0.85 — configurable per customer. ~30ms CPU latency. Cannot be disabled system-wide; threshold is adjustable.
PII Masking
PII detection engine. Entities: EMAIL, PHONE, CREDIT_CARD, SG NRIC, ID NIK, IP_ADDRESS, URL. Four modes: redact, tokenize, synthetic, block.
Content Moderation
Keyword + ML classifier. English + Bahasa Indonesia. ~5ms latency. Configurable per policy group.
Conversational Guardrails
YAML + flow-rule config per policy group. Conversational flow enforcement — blocks topic steering, jailbreaks, system-prompt disclosure.
PII modes
Four ways to handle detected PII
// Input: "My email is [email protected]"
// Output: "My email is [REDACTED]"
// API key setting:
{ "pii_mode": "redact" }Per-key overrides
Override guardrail defaults per API key
// PATCH /anoman/v1/keys/{id}
{
"guardrail_overrides": {
"injectionEnabled": false,
"piiEnabled": true,
"contentModerationEnabled": false
}
}
// Priority stack (highest → lowest):
// 1. System forced (ops emergency)
// 2. Per-key guardrail_overrides
// 3. Policy group defaults
// 4. System defaultsConversational Guardrails
Conversational flow enforcement
Configure via the dashboard Guardrails tab. YAML config + flow rules are stored per policy group and cached by config hash for performance.
# Policy group conversational-guardrail config
models:
- type: main
engine: openai
model: gpt-4o
rails:
input:
flows:
- self check input
output:
flows:
- self check outputFull guardrails overview: Platform / Guardrails →