Octopus
AI Agent Node in Flow Studio
The AI Agent Node is a Flow Studio workflow node that invokes an Octopus agent turn as part of workflow execution. The agent's response becomes the node's output, enabling AI reasoning within structured business processes.
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
| Property | Type | Description |
|---|---|---|
agentId | string | The Octopus agent to invoke. Must be accessible to the workflow's tenant. |
promptTemplate | string | Handlebars template for the message sent to the agent. References workflow data via {{variable}}. |
inputs | object | Workflow data bindings to inject into the prompt template |
outputMapping | object | Maps agent response fields to node output keys |
sessionId | string | Optional. Reuses an existing session for conversation continuity within a workflow. |
timeoutSeconds | int | Max seconds to wait for the agent response. Default 60. |
When to Use the AI Agent Node
| Scenario | Use AI Agent Node? |
|---|---|
| Extract structured data from unstructured text in a workflow | Yes — ideal use case |
| Classify or categorise an item mid-workflow | Yes |
| Generate a draft email or document during a workflow | Yes |
| Make a business decision that requires external tool calls | Yes — agent can call MCP tools |
| Replace the entire workflow with a single agent | No — use the agent's start_workflow tool instead |