Class AgentUtil
java.lang.Object
com.flowable.agent.engine.impl.util.AgentUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidapplyClassificationResult(CoreContentEngineConfigurationApi contentEngineConfiguration, AgentInvocationResult agentInvocationResult, List<org.flowable.content.api.ContentItem> contentItems, String tenantId, AgentDefinitionModel agentDefinitionModel) protected static voidapplyDataExtractionResult(CoreContentEngineConfigurationApi contentEngineConfiguration, AgentInvocationResult agentInvocationResult, List<org.flowable.content.api.ContentItem> contentItems, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) protected static voidapplyDocumentAgentResults(org.flowable.common.engine.impl.interceptor.CommandContext commandContext, AgentInvocationContext agentInvocationContext, AgentInvocationResult agentInvocationResult) static AgentInvocationEntityauditAiInvocation(AgentEngineConfiguration engineConfiguration, AgentInstance agentInstance, String agentInvocationId, AgentInvocationResultResponse.Invocation aiInvocation, String userId, boolean storeAsHumanContent) static AgentInvocationEntityauditAiInvocation(AgentEngineConfiguration engineConfiguration, AgentInvocationContext agentInvocationContext, AgentInvocationResultResponse.Invocation aiInvocation, boolean storeAsHumanContent) protected static DatecalculateDueDate(org.flowable.common.engine.impl.runtime.Clock clock, int initialRetryCount, Duration retryTimeout) protected static voidcreateAgentEngineTimerJob(AgentEngineConfiguration agentEngineConfiguration, String jobHandlerType, String scopeId, String tenantId, String subScopeId, tools.jackson.databind.JsonNode jobConfiguration, Duration retryTimeout) static voidcreateAsyncJob(AgentEngineConfiguration agentEngineConfiguration, AgentInstance agentInstance, String jobHandlerType, tools.jackson.databind.JsonNode jobConfiguration, boolean exclusive) static voidcreateAsyncJob(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId, String jobHandlerType, String jobHandlerConfiguration, boolean exclusive) static voidcreateAsyncJob(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId, String jobHandlerType, tools.jackson.databind.JsonNode jobConfiguration, boolean exclusive) protected static org.flowable.common.engine.api.delegate.ExpressioncreateExpression(String expression, AgentEngineConfiguration agentEngineConfiguration) protected static voiddispatchOperationEvaluators(AgentEngineConfiguration engineConfiguration, AgentInvocationContext context, String agentType) Sync auto-dispatch for a just-completed, persisted turn: skips when evaluators are disabled or the turn was guardrail-blocked (its output is synthetic, not the agent's answer), then defers to the shared scheduler.static voiddispatchOperationEvaluators(AgentEngineConfiguration engineConfiguration, String invocationId, AgentDefinitionModel model, AgentDefinitionModel.AgentOperation operation) Poll-path dispatch.static StringgetAgentDefinitionKey(org.flowable.cmmn.model.CmmnModel cmmnModel) getOperation(AgentDefinitionModel agentDefinitionModel, String operationKey) getOperationSafe(AgentDefinitionModel agentDefinitionModel, String operationKey) Resolves a declared operation by key, returningnullwhen absent — e.g. a synthetic/default operation built at runtime rather than declared ingetOperations().protected static StringgetPromptMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentBehavior behavior, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer, Function<AgentDefinitionModel.AgentBehavior, String> messageStringSupplier, Function<AgentDefinitionModel.AgentBehavior, AgentDefinitionModel.TemplateReference> messageTemplateSupplier) static Collection<String> getSupportedMimeTypes(AgentDefinitionModel agentDefinitionModel) static StringgetSystemMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentOperation agentOperation, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) static StringgetUserMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentOperation agentOperation, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) static voidhandleAgentInstanceCallback(AgentInstance agentInstance, AgentInvocationResult agentInvocationResult, GuardrailResult guardrailResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) static voidhandleAgentInstanceCallback(AgentInstance agentInstance, AgentInvocationResult agentInvocationResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) static voidhandleAgentInstanceCallback(String callbackId, String callbackType, AgentInvocationResult agentInvocationResult, GuardrailResult guardrailResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) static voidhandleAgentInstanceCallback(String callbackId, String callbackType, AgentInvocationResult agentInvocationResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) static voidhandleAgentInvocationResponse(org.flowable.common.engine.impl.interceptor.CommandContext commandContext, AgentInvocationContext agentInvocationContext, AgentInstanceEntity agentInstance, AgentInvocationResultResponse resultResponse, boolean storeInteractionsAsHumanContent) static booleanhasDefaultBehavior(AgentDefinitionModel.AgentOperation agentOperation) static voidpersistGuardrailViolationExchanges(AgentEngineConfiguration engineConfiguration, AgentInvocationContext agentInvocationContext, FlowableGuardrailViolationException ex) Persists the guardrail exchanges that were recorded on aFlowableGuardrailViolationExceptionbefore it is (re)thrown.protected static AgentInvocationEntityprocessExchangeMessages(AgentEngineConfiguration agentEngineConfiguration, AgentInvocationContext agentInvocationContext, boolean storeInteractionsAsHumanContent, AgentInvocationResultResponse resultResponse) protected static StringresolveTemplate(AgentDefinitionModel.TemplateReference templateReference, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) static voidscheduleAgentDefinitionDeletion(AgentEngineConfiguration engineConfiguration, Collection<String> agentDefinitionIds, String tenantId) Schedules a history job that wipes all agent-instance, agent-invocation and agent-invocation-evaluation ES documents referencing one of the supplied agent definition IDs.static voidscheduleAgentInstanceDeletion(AgentEngineConfiguration engineConfiguration, String agentInstanceId, String tenantId) static voidscheduleAgentInstanceIndexing(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId) static voidscheduleAgentInstancesBulkDeletion(AgentEngineConfiguration engineConfiguration, Collection<String> referenceIds, String referenceType, String tenantId) Schedules a history job that wipes the agent-instance, agent-invocation and agent-invocation-evaluation ES documents for the given parent scope (process or case instance).static voidscheduleAgentInvocationEvaluationIndexing(AgentEngineConfiguration engineConfiguration, String evaluationId, String tenantId) static voidscheduleAgentInvocationIndexing(AgentEngineConfiguration engineConfiguration, String invocationId, String tenantId) protected static voidscheduleOperationEvaluation(AgentEngineConfiguration engineConfiguration, String invocationId, String agentType, AgentDefinitionModel.AgentOperation operation) Schedules async scoring of an operation's declared evaluators.static voidscheduleTriggerJobIfNeeded(AgentInstance agentInstance, org.flowable.common.engine.impl.interceptor.CommandContext commandContext, String customValues) static voidscheduleTriggerJobIfNeeded(AgentInstance agentInstance, org.flowable.common.engine.impl.interceptor.CommandContext commandContext, String jobHandlerType, String configuration, String customValues)
-
Field Details
-
DEFAULT_SUPPORTED_MIME_TYPES
-
AGENT_INVOCATION_RESULT_TRANSIENT_VARIABLE_NAME
- See Also:
-
AGENT_GUARDRAIL_RESULT_TRANSIENT_VARIABLE_NAME
- See Also:
-
AGENT_SIGNAL_TRANSIENT_VARIABLE_NAME
- See Also:
-
EXTENSION_ELEMENT_AGENT_ASYNC
- See Also:
-
AGENT_COMPLETED_SIGNAL_NAME
- See Also:
-
-
Constructor Details
-
AgentUtil
public AgentUtil()
-
-
Method Details
-
getAgentDefinitionKey
-
getUserMessage
public static String getUserMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentOperation agentOperation, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) -
getSystemMessage
public static String getSystemMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentOperation agentOperation, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) -
getPromptMessage
protected static String getPromptMessage(AgentEngineConfiguration agentEngineConfiguration, AgentDefinitionModel.AgentBehavior behavior, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer, Function<AgentDefinitionModel.AgentBehavior, String> messageStringSupplier, Function<AgentDefinitionModel.AgentBehavior, AgentDefinitionModel.TemplateReference> messageTemplateSupplier) -
resolveTemplate
protected static String resolveTemplate(AgentDefinitionModel.TemplateReference templateReference, String getParentDeploymentId, org.flowable.common.engine.api.variable.VariableContainer variableContainer) -
createExpression
protected static org.flowable.common.engine.api.delegate.Expression createExpression(String expression, AgentEngineConfiguration agentEngineConfiguration) -
getOperationSafe
public static AgentDefinitionModel.AgentOperation getOperationSafe(AgentDefinitionModel agentDefinitionModel, String operationKey) Resolves a declared operation by key, returningnullwhen absent — e.g. a synthetic/default operation built at runtime rather than declared ingetOperations(). -
getOperation
public static AgentDefinitionModel.AgentOperation getOperation(AgentDefinitionModel agentDefinitionModel, String operationKey) -
hasDefaultBehavior
-
getSupportedMimeTypes
-
handleAgentInvocationResponse
public static void handleAgentInvocationResponse(org.flowable.common.engine.impl.interceptor.CommandContext commandContext, AgentInvocationContext agentInvocationContext, AgentInstanceEntity agentInstance, AgentInvocationResultResponse resultResponse, boolean storeInteractionsAsHumanContent) -
dispatchOperationEvaluators
protected static void dispatchOperationEvaluators(AgentEngineConfiguration engineConfiguration, AgentInvocationContext context, String agentType) Sync auto-dispatch for a just-completed, persisted turn: skips when evaluators are disabled or the turn was guardrail-blocked (its output is synthetic, not the agent's answer), then defers to the shared scheduler. -
dispatchOperationEvaluators
public static void dispatchOperationEvaluators(AgentEngineConfiguration engineConfiguration, String invocationId, AgentDefinitionModel model, AgentDefinitionModel.AgentOperation operation) Poll-path dispatch. KNOWN GAP: a polled reply scored here bypassed output-guardrail validation (it wraps only the synchronous invoke). -
scheduleOperationEvaluation
protected static void scheduleOperationEvaluation(AgentEngineConfiguration engineConfiguration, String invocationId, String agentType, AgentDefinitionModel.AgentOperation operation) Schedules async scoring of an operation's declared evaluators. No-ops when the operation declares no evaluators or the agent is itself a judge/guardrail (which declare none anyway). Callers pass the persisted invocation's id. -
auditAiInvocation
public static AgentInvocationEntity auditAiInvocation(AgentEngineConfiguration engineConfiguration, AgentInvocationContext agentInvocationContext, AgentInvocationResultResponse.Invocation aiInvocation, boolean storeAsHumanContent) -
auditAiInvocation
public static AgentInvocationEntity auditAiInvocation(AgentEngineConfiguration engineConfiguration, AgentInstance agentInstance, String agentInvocationId, AgentInvocationResultResponse.Invocation aiInvocation, String userId, boolean storeAsHumanContent) -
persistGuardrailViolationExchanges
public static void persistGuardrailViolationExchanges(AgentEngineConfiguration engineConfiguration, AgentInvocationContext agentInvocationContext, FlowableGuardrailViolationException ex) Persists the guardrail exchanges that were recorded on aFlowableGuardrailViolationExceptionbefore it is (re)thrown. -
scheduleAgentInstanceIndexing
public static void scheduleAgentInstanceIndexing(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId) -
scheduleAgentInvocationIndexing
public static void scheduleAgentInvocationIndexing(AgentEngineConfiguration engineConfiguration, String invocationId, String tenantId) -
scheduleAgentInvocationEvaluationIndexing
public static void scheduleAgentInvocationEvaluationIndexing(AgentEngineConfiguration engineConfiguration, String evaluationId, String tenantId) -
scheduleAgentInstanceDeletion
public static void scheduleAgentInstanceDeletion(AgentEngineConfiguration engineConfiguration, String agentInstanceId, String tenantId) -
scheduleAgentDefinitionDeletion
public static void scheduleAgentDefinitionDeletion(AgentEngineConfiguration engineConfiguration, Collection<String> agentDefinitionIds, String tenantId) Schedules a history job that wipes all agent-instance, agent-invocation and agent-invocation-evaluation ES documents referencing one of the supplied agent definition IDs. -
scheduleAgentInstancesBulkDeletion
public static void scheduleAgentInstancesBulkDeletion(AgentEngineConfiguration engineConfiguration, Collection<String> referenceIds, String referenceType, String tenantId) Schedules a history job that wipes the agent-instance, agent-invocation and agent-invocation-evaluation ES documents for the given parent scope (process or case instance). -
processExchangeMessages
protected static AgentInvocationEntity processExchangeMessages(AgentEngineConfiguration agentEngineConfiguration, AgentInvocationContext agentInvocationContext, boolean storeInteractionsAsHumanContent, AgentInvocationResultResponse resultResponse) -
createAgentEngineTimerJob
-
calculateDueDate
-
handleAgentInstanceCallback
public static void handleAgentInstanceCallback(AgentInstance agentInstance, AgentInvocationResult agentInvocationResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
handleAgentInstanceCallback
public static void handleAgentInstanceCallback(AgentInstance agentInstance, AgentInvocationResult agentInvocationResult, GuardrailResult guardrailResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
handleAgentInstanceCallback
public static void handleAgentInstanceCallback(String callbackId, String callbackType, AgentInvocationResult agentInvocationResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
handleAgentInstanceCallback
public static void handleAgentInstanceCallback(String callbackId, String callbackType, AgentInvocationResult agentInvocationResult, GuardrailResult guardrailResult, org.flowable.common.engine.impl.interceptor.CommandContext commandContext) -
createAsyncJob
public static void createAsyncJob(AgentEngineConfiguration agentEngineConfiguration, AgentInstance agentInstance, String jobHandlerType, tools.jackson.databind.JsonNode jobConfiguration, boolean exclusive) -
createAsyncJob
public static void createAsyncJob(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId, String jobHandlerType, tools.jackson.databind.JsonNode jobConfiguration, boolean exclusive) -
createAsyncJob
public static void createAsyncJob(AgentEngineConfiguration agentEngineConfiguration, String agentInstanceId, String tenantId, String jobHandlerType, String jobHandlerConfiguration, boolean exclusive) -
scheduleTriggerJobIfNeeded
public static void scheduleTriggerJobIfNeeded(AgentInstance agentInstance, org.flowable.common.engine.impl.interceptor.CommandContext commandContext, String customValues) -
scheduleTriggerJobIfNeeded
public static void scheduleTriggerJobIfNeeded(AgentInstance agentInstance, org.flowable.common.engine.impl.interceptor.CommandContext commandContext, String jobHandlerType, String configuration, String customValues) -
applyDocumentAgentResults
protected static void applyDocumentAgentResults(org.flowable.common.engine.impl.interceptor.CommandContext commandContext, AgentInvocationContext agentInvocationContext, AgentInvocationResult agentInvocationResult) -
applyClassificationResult
protected static void applyClassificationResult(CoreContentEngineConfigurationApi contentEngineConfiguration, AgentInvocationResult agentInvocationResult, List<org.flowable.content.api.ContentItem> contentItems, String tenantId, AgentDefinitionModel agentDefinitionModel) -
applyDataExtractionResult
protected static void applyDataExtractionResult(CoreContentEngineConfigurationApi contentEngineConfiguration, AgentInvocationResult agentInvocationResult, List<org.flowable.content.api.ContentItem> contentItems, org.flowable.common.engine.impl.interceptor.CommandContext commandContext)
-