The list in force: its version and when and by whom it was reviewed.
Static createLoads the list and compiles it. Refuses a list that does not load, is empty, or has judge entries and no judge.
Evaluate user input before orchestration.
Called once per request before the orchestration pipeline starts. Use this to validate, sanitize, or block user messages.
Input and context to evaluate
Evaluation result, or null to allow without action
BLOCK to prevent the request from being processedSANITIZE with modifiedText to clean the inputnull or ALLOW to let the request throughEvaluate agent output before streaming to client.
Called for each chunk of a guarded output stream (the turn's, and the
continuation after an external tool result) that carries
isFinal: true (the FINAL_RESPONSE, an ERROR the turn yields), for each
TEXT_DELTA chunk when GuardrailConfig.evaluateStreamingChunks is
set (real-time filtering), and for each TOOL_CALL_REQUEST chunk when
GuardrailConfig.evaluateToolCalls is set. Other chunks are not
passed to it, nor is the ERROR that processRequest() yields from its own
catch.
Response chunk and context to evaluate
Evaluation result, or null to allow without action
BLOCK to immediately terminate the stream with an error chunk, or
with a FINAL_RESPONSE holding replacementText when the result carries a
non-empty oneSANITIZE with modifiedText to redact/modify content; on a
TOOL_CALL_REQUEST chunk it is applied as BLOCKReadonly idA stable id for this guard. A required guard is named by it (AgentOSConfig.requiredGuardrails), and it travels
with every verdict as metadata.guardrailId. Without one, a registered guard is known by its descriptor's id.
Readonly configConfiguration for evaluation behavior. Controls streaming vs final-only evaluation and rate limiting.
Readonly stagesThe stages this guard evaluates; a required guard is held to them (IGuardrailService.stages).
Contract for implementing custom guardrail logic.
Guardrails intercept content at two points:
Both methods are optional—implement only what you need.
Example: Basic content filter
Example: Mid-stream "changing mind" (cost ceiling)
Example: PII redaction mid-stream