Interface GuardrailOutputPayload

Payload for output guardrail evaluation.

Provided to IGuardrailService.evaluateOutput before response chunks are emitted to the client. Use this to filter, redact, or block agent output.

Remarks

Every guardrail is called for each chunk of the turn's output stream that carries isFinal: true (the FINAL_RESPONSE, an ERROR the turn yields). With GuardrailConfig.evaluateStreamingChunks set, it is also called for each TEXT_DELTA chunk (real-time filtering), and with GuardrailConfig.evaluateToolCalls set, for each TOOL_CALL_REQUEST chunk. Other chunks are not evaluated, and neither is the ERROR that processRequest() yields from its own catch or for an input guardrail's BLOCK.

interface GuardrailOutputPayload {
    context: GuardrailContext;
    chunk: AgentOSResponse;
    ragSources?: RagRetrievedChunk[];
}

Properties

Conversational context for policy decisions

The response chunk to evaluate

ragSources?: RagRetrievedChunk[]

RAG source chunks retrieved for this request. Available to output guardrails for grounding verification. Persists across all chunks in a stream (not just the final chunk). Undefined when no RAG retrieval was performed.