Skip to main content

Interface: GuardrailOutputPayload

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:196

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.

Properties​

chunk​

chunk: AgentOSResponse

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:201

The response chunk to evaluate


context​

context: GuardrailContext

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:198

Conversational context for policy decisions


ragSources?​

optional ragSources: RagRetrievedChunk[]

Defined in: packages/agentos/src/safety/guardrails/IGuardrailService.ts:209

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.