Class GuardrailAgentEvaluator
java.lang.Object
com.flowable.agent.engine.impl.guardrail.GuardrailAgentEvaluator
Evaluates content by invoking a guardrail agent (an agent model of type "guardrailAgent").
The guardrail agent is expected to always return a JSON response with:
{"pass": true/false, "confidence": 0.0-1.0, "reason": "..."}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult from evaluating content with a guardrail agent. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AgentRuntimeServiceprotected final tools.jackson.databind.ObjectMapper -
Constructor Summary
ConstructorsConstructorDescriptionGuardrailAgentEvaluator(AgentRuntimeService agentRuntimeService, tools.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionevaluate(AgentDefinitionModel.GuardrailReference guardrailRef, String content, String tenantId) Evaluates the given content using the specified guardrail agent.evaluate(AgentDefinitionModel.GuardrailReference guardrailRef, String content, String tenantId, Map<String, Object> additionalVariables) Evaluates the given content using the specified guardrail agent.parseStructuredResult(AgentInvocationResult invocationResult)
-
Field Details
-
agentRuntimeService
-
objectMapper
protected final tools.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
GuardrailAgentEvaluator
public GuardrailAgentEvaluator(AgentRuntimeService agentRuntimeService, tools.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
evaluate
public GuardrailAgentEvaluator.GuardrailAgentResult evaluate(AgentDefinitionModel.GuardrailReference guardrailRef, String content, String tenantId) Evaluates the given content using the specified guardrail agent.- Parameters:
guardrailRef- the guardrail reference (must be of type "agent")content- the content to validate (user input or LLM output)tenantId- the tenant ID for multi-tenant environments- Returns:
- the evaluation result
-
evaluate
public GuardrailAgentEvaluator.GuardrailAgentResult evaluate(AgentDefinitionModel.GuardrailReference guardrailRef, String content, String tenantId, Map<String, Object> additionalVariables) Evaluates the given content using the specified guardrail agent.- Parameters:
guardrailRef- the guardrail reference (must be of type "agent")content- the content to validate (user input or LLM output)tenantId- the tenant ID for multi-tenant environmentsadditionalVariables- additional variables to pass to the guardrail agent (e.g. parent agent input parameters)- Returns:
- the evaluation result
-
parseStructuredResult
protected GuardrailAgentEvaluator.GuardrailAgentResult parseStructuredResult(AgentInvocationResult invocationResult)
-