Class GuardrailValidatingAiModelInvoker

java.lang.Object
com.flowable.agent.engine.impl.guardrail.GuardrailValidatingAiModelInvoker
All Implemented Interfaces:
AiModelInvoker

public class GuardrailValidatingAiModelInvoker extends Object implements AiModelInvoker
Decorator around an AiModelInvoker that enforces guardrails before and after the LLM invocation.

Before the LLM call (input validation):

  1. Parameter constraints on input parameters (cheapest, in-process)
  2. Operation guardrails in configured order (guardrail agents and external guardrails)

After the LLM call (output validation):

  1. Parameter constraints on output parameters (uses the already-parsed AgentInvocationResult)
  2. Operation guardrails in configured order (guardrail agents and external guardrails)

This wrapper is only applied to agent models that have guardrails configured. Each guardrail supports failure modes: fail (throw exception), warn (log and continue), skip (skip LLM call, set variable), reject (discard LLM output, set variable), and default (resolve from operation's guardrailDefaults). Validation is fail-fast: if any step fails with fail, skip, or reject, subsequent steps are skipped.