ToolMessage result back to the calling Agent.
Use Agent Workflow when a tool result needs multi-step orchestration, such as retrieving data, running logic branches, iterating over records, calling other tools, and formatting a final result.
:::note
Agent Workflow replaces the legacy Agent Tool workflow node. Existing agent-tool nodes continue to run for compatibility, but new workflows should use agent-workflow.
:::
How It Works
-
Tool registration
- The node is registered as a tool that an upstream Agent can call.
Tool Name,Tool Description, andTool Parametersbecome the tool name, description, and schema seen by the Agent model.
-
Argument passing
- When the Agent calls the tool, the call arguments are stored in the Agent Workflow node state.
- Each configured input parameter is exposed to downstream workflow nodes as
args.<parameterName>.
-
Sub-workflow execution
- Connected workflow nodes run as the implementation of the tool.
- The sub-workflow can include branches, iteration, tool invocation, HTTP requests, code, templates, knowledge retrieval, and Agent nodes.
-
Return to the caller Agent
- After the sub-workflow completes, Agent Workflow creates a
ToolMessageand writes it back to the calling Agent. - The caller Agent then continues reasoning with that tool result.
- After the sub-workflow completes, Agent Workflow creates a
Configuration
Return Content
Agent Workflow supports three return modes:
When the downstream path ends with an Iteration node, do not rely on Last message. Select the iteration output variable, usually
output_str, or add an Answer node after the iteration and return that result. Validation reports an error when an Agent Workflow ends on an iterator path while still using the legacy last-message return mode.
Compatibility
- New nodes use
WorkflowNodeTypeEnum.AGENT_WORKFLOWwith the valueagent-workflow. - Legacy nodes with
WorkflowNodeTypeEnum.AGENT_TOOLand the valueagent-toolare still loaded and executed for existing workflows. - The old Agent Tool documentation page is kept only as a deprecated compatibility entry.
Best Practices
- Give the tool a clear name and description so the Agent model can choose it reliably.
- Define explicit input parameters instead of expecting the downstream workflow to infer context.
- Prefer Variable or Template return content for production workflows.
- Use Last message only for simple legacy-style flows that end with an Answer or Agent response.
- For branches, make sure the selected return variable is produced on every possible path, or use a template or Answer node on each branch.