Package com.axelor.ai

Class WorkflowAgentInvokerImpl

java.lang.Object
com.axelor.ai.WorkflowAgentInvokerImpl
All Implemented Interfaces:
WorkflowAgentInvoker

public class WorkflowAgentInvokerImpl extends Object implements WorkflowAgentInvoker
The AI implementation of the workflow <agent> node SPI. Runs the agent through AiService: the workflow — not the agent — performs any record changes.

That rule is enforced where it cannot be argued with. Every call from here is programmatic, and ToolAvailability.deniedToProgrammatic(com.axelor.ai.db.AiTool, com.axelor.ai.tool.system.SystemTool<?>) withholds any tool that could write from the model entirely, with ToolExecutorPlugin refusing one called anyway. The note below only explains the situation to the model so it answers usefully instead of reaching for a tool it does not have; it is not what stops it.

  • Method Details

    • invoke

      public String invoke(String agentCode, String message, Map<String,Object> context, List<AgentOutputField> output)
      output is ignored here: the declared shape is already described to the model inside message, and the engine checks the answer against it. It reaches this method so that a later implementation can constrain generation provider-side where the provider supports it -- uneven across the six AiProviderTypes today, and a feature that silently degrades on half of them is worse than one that behaves the same everywhere.
      Specified by:
      invoke in interface WorkflowAgentInvoker
    • validateAgent

      public String validateAgent(String agentCode)
      Description copied from interface: WorkflowAgentInvoker
      Checks at save time that agentCode names an enabled, invokable agent that is neither internal nor a template. Returns null when usable, else a short reason; the default accepts any.
      Specified by:
      validateAgent in interface WorkflowAgentInvoker