Interface Guardrail

All Known Subinterfaces:
AgentResponseGuardrail, ModelCallGuardrail, TextGuardrail, ToolCallGuardrail
All Known Implementing Classes:
ModelCallSimilarityGuard, SimilarityGuard

public sealed interface Guardrail permits TextGuardrail, ToolCallGuardrail, ModelCallGuardrail, AgentResponseGuardrail
Guardrails can protect against harmful inputs and outputs to/from model and tool calls.

A Guardrail needs to implement exactly one of ToolCallGuardrail, ModelCallGuardrail or AgentResponseGuardrail, which extend this interface, and have a public constructor optionally taking a GuardrailContext parameter (the guardrail's configured name and config section).

Guardrails are enabled for agents with configuration, see agent documentation.