Portal Community

What the AI Agent Node Does

When a workflow reaches an AI Agent Node, the ProcessServer calls the Octopus API with a prompt built from workflow data. The Octopus agent runs a full reasoning turn — including tool calls — and returns its response as the node output:

// Flow Studio workflow definition snippet
{
  "nodes": [
    {
      "id":   "extract-invoice-data",
      "type": "AIAgentNode",
      "config": {
        "agentId":  "document-extractor",
        "promptTemplate": "Extract the following fields from this invoice:\n- Vendor name\n- Total amount\n- Due date\n- Invoice number\n\nInvoice content:\n{{invoiceText}}",
        "inputs": {
          "invoiceText": "{{nodes.load-document.outputs.text}}"
        },
        "outputMapping": {
          "extractedData": "$.response"
        }
      }
    }
  ]
}

AIAgentNodeExecutor (C#)

public class AIAgentNodeExecutor : BaseNodeExecutor<AIAgentNodeSettings>
{
    private readonly IOctopusAgentClient _octopusClient;

    protected override async Task<NodeOutput> ExecuteAsync(
        AIAgentNodeSettings settings,
        NodeDataContext ctx,
        CancellationToken ct)
    {
        // Build the prompt from the template + workflow data
        var prompt = TemplateEngine.Render(settings.PromptTemplate, ctx.GetAllData());

        // Call Octopus agent
        var response = await _octopusClient.ChatAsync(new AgentChatRequest
        {
            AgentId   = settings.AgentId,
            Message   = prompt,
            SessionId = $"workflow-{ctx.ExecutionId}-{settings.NodeId}",
            TenantId  = ctx.TenantId
        }, ct);

        // Map agent response to node outputs
        var outputs = new Dictionary<string, object>
        {
            [settings.OutputMapping.GetValueOrDefault("response", "response")]
                = response.Content
        };

        return NodeOutput.Success(outputs);
    }
}

Node Configuration Properties

PropertyTypeDescription
agentIdstringThe Octopus agent to invoke. Must be accessible to the workflow's tenant.
promptTemplatestringHandlebars template for the message sent to the agent. References workflow data via {{variable}}.
inputsobjectWorkflow data bindings to inject into the prompt template
outputMappingobjectMaps agent response fields to node output keys
sessionIdstringOptional. Reuses an existing session for conversation continuity within a workflow.
timeoutSecondsintMax seconds to wait for the agent response. Default 60.

When to Use the AI Agent Node

ScenarioUse AI Agent Node?
Extract structured data from unstructured text in a workflowYes — ideal use case
Classify or categorise an item mid-workflowYes
Generate a draft email or document during a workflowYes
Make a business decision that requires external tool callsYes — agent can call MCP tools
Replace the entire workflow with a single agentNo — use the agent's start_workflow tool instead