Optional evaluateEnable real-time evaluation of streaming chunks.
When true, evaluates every TEXT_DELTA chunk during streaming.
When false (default), only evaluates FINAL_RESPONSE chunks.
Performance Impact:
Cost Impact:
Use Cases:
true): Real-time PII redaction, immediate blockingfalse): Policy checks needing full context, cost-sensitivefalse
Optional maxMaximum streaming evaluations per request.
Rate-limits streaming evaluations to control cost and performance.
Only applies when evaluateStreamingChunks is true.
After reaching the limit, remaining chunks pass through unevaluated.
undefined (no limit)
Optional canWhether this guardrail may return SANITIZE actions that modify content.
When true, this guardrail runs in Phase 1 (sequential) of the parallel dispatcher — it sees and can modify text produced by prior sanitizers. Each sanitizer receives the cumulative sanitized text from all preceding sanitizers in registration order.
When false or omitted, this guardrail runs in Phase 2 (parallel) on the already-sanitized text from Phase 1. It may return BLOCK, FLAG, or ALLOW. If a Phase 2 guardrail returns SANITIZE, the action is downgraded to FLAG with a warning logged, because concurrent sanitization would produce non-deterministic results.
false
Optional timeoutMaximum time in milliseconds to wait for this guardrail's evaluation.
If exceeded, the evaluation is abandoned (fail-open), a warning is logged, and the guardrail contributes nothing to the result. Prevents a slow guardrail (e.g., LLM-based) from blocking the entire pipeline.
Safety note: Do NOT set timeoutMs on safety-critical guardrails (e.g., CSAM detection, compliance-mandatory filters) because fail-open on timeout means content passes unchecked. Only use on guardrails where a missed evaluation is acceptable.
undefined (no timeout — wait indefinitely)
Optional streamingStreaming evaluation mode.
'per-chunk' — evaluate every TEXT_DELTA individually (default behavior).'sentence-buffered' — accumulate chunks and evaluate at sentence
boundaries using the internal sentence boundary buffer. The previous sentence
is included as overlap context for safety evaluation.Only applies when evaluateStreamingChunks is true.
'per-chunk'
Configuration for guardrail evaluation behavior.
Controls when and how often guardrails evaluate content. Use these settings to balance safety requirements against performance and cost constraints.
Example