Interface GuardrailOutputOptions

Options for output guardrail wrapping.

interface GuardrailOutputOptions {
    streamId: string;
    personaId?: string;
    inputEvaluations?: null | GuardrailEvaluationResult[];
    ragSources?: RagRetrievedChunk[];
    holdUntilFinal?: boolean;
    onVerdict?: ((verdict) => void | Promise<void>);
}

Properties

streamId: string

Stream identifier for error chunks

personaId?: string

Persona ID for error chunks

inputEvaluations?: null | GuardrailEvaluationResult[]

Input evaluations to attach to first output chunk

ragSources?: RagRetrievedChunk[]

RAG sources to thread through to output guardrails for grounding verification

holdUntilFinal?: boolean

Hold every TEXT_DELTA until the final guards have judged the whole reply. Allowed or flagged, the held deltas go out before the final chunk; blocked or sanitized, they are dropped, so the caller never sees text the guards refused. An actionable tool call closes the window: the text so far is judged as a final reply before it.

onVerdict?: ((verdict) => void | Promise<void>)

Called once with the final verdict on the reply: blocked, sanitized, flagged or allowed. A throw is logged and ignored.

Type declaration