Interface Guardrail

All Known Implementing Classes:
HITLApproval

public interface Guardrail
A guardrail that checks whether an agent action is permitted.

Guardrails are used by SupervisorAgent to enforce safety constraints on agent actions. Each guardrail evaluates an action request and returns a result indicating whether the action is allowed.

Usage Example


 Guardrail readOnly = new Guardrail() {
     public String getName() { return "read-only"; }
     public GuardrailResult check(String agentId, String action, Map<String, Object> ctx) {
         if (action.startsWith("write")) {
             return new GuardrailResult(false, "Write operations not allowed", GuardrailSeverity.BLOCK);
         }
         return new GuardrailResult(true, "Allowed", GuardrailSeverity.INFO);
     }
 };
 
See Also:
  • Method Details

    • getName

      String getName()
      Returns the name of this guardrail.
      Returns:
      guardrail name, must be unique within a supervisor
    • check

      Guardrail.GuardrailResult check(String agentId, String action, Map<String,Object> context)
      Checks whether an agent action is allowed.
      Parameters:
      agentId - the ID of the agent attempting the action
      action - the action being attempted
      context - additional context about the action
      Returns:
      result indicating whether the action is allowed