Interface TextGuardrail

All Superinterfaces:
Guardrail
All Known Implementing Classes:
SimilarityGuard

@Deprecated(since="3.6.0", forRemoval=true) public non-sealed interface TextGuardrail extends Guardrail
Deprecated, for removal: This API element is subject to removal in a future version.
Implement ToolCallGuardrail, ModelCallGuardrail or AgentResponseGuardrail instead. The new interfaces return a Decision (Allow / Deny / Fail) and receive a per-call context. For MCP tool calls, TextGuardrail is still the only guardrail type.
Guardrails can protect against harmful inputs and outputs to/from model and tool calls.

A Guardrail needs to implement this interface, have a public constructor with optionally a GuardrailContext parameter, which includes the name and the config section for the specific guardrail.

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

  • Method Details

    • evaluate

      Guardrail.Result evaluate(String text)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Evaluates if the text passes the guardrail or not.