Interface Guardrail

All Known Implementing Classes:
PiiGuardrail

public interface Guardrail
SPI for content guardrails that evaluate input and/or output.

Implementations can check for PII leakage, toxicity, off-topic responses, format compliance, etc. Register implementations via GuardrailRegistry.

  • Method Summary

    Modifier and Type
    Method
    Description
    evaluate(String input, String output)
    Evaluates the given input/output pair.
    Returns the unique name of this guardrail.
  • Method Details

    • name

      String name()
      Returns the unique name of this guardrail.
    • evaluate

      GuardrailResult evaluate(String input, String output)
      Evaluates the given input/output pair.
      Parameters:
      input - the input text (user prompt or tool input), may be null
      output - the output text (agent response or tool output), may be null
      Returns:
      the evaluation result