Interface InputGuardrail<TContext>


public interface InputGuardrail<TContext>
InputGuardrail

Validates user input before the first model call in an agent execution.

Input guardrails support two execution modes:

  • Parallel (default): Runs concurrently with the model call for efficiency
  • Blocking: Runs before the model call, halting execution if tripwire triggered

Input guardrails only execute on the first turn of a conversation.

Ported from TypeScript OpenAI Agents SDK Source: guardrail.ts

  • Method Details

    • getName

      String getName()
      Unique name for this guardrail.
      Returns:
      The guardrail name
    • execute

      Execute the guardrail validation on user input.
      Parameters:
      args - The input arguments containing user input and context
      Returns:
      A CompletableFuture with the guardrail result
    • isRunInParallel

      default boolean isRunInParallel()
      Whether this guardrail runs in parallel with the model call or blocks before it.

      Default: true (run in parallel)

      Returns:
      true to run in parallel, false to block