Subflow
Subflow exposes a whole flow as a single tool that an Agent can call. When the agent decides to use it, the target flow runs to completion as its own run and its final output is handed back to the agent as the tool result. The agent keeps reasoning with that result. You find it on the node picker’s AI shelf.
Use a subflow to give an orchestrator agent a focused specialist: a research sub-flow, a lookup sub-flow, a formatting sub-flow. The orchestrator stays small and delegates instead of carrying every instruction and tool itself.
Handles
Section titled “Handles”The node has an input and an output handle, but it does not sit in the flow’s control path. It exists to carry a reference to the target flow on the wire you connect to an agent: connect the Subflow node’s output to the agent’s tool handle (labelled Tools). The agent then offers the target flow to the model as a callable tool.
Configuration
Section titled “Configuration”

| Field | Type | Default | Description |
|---|---|---|---|
Target flow (targetFlow) | string ✦ (required) | — | The Flow to expose to the agent as a callable subflow tool; the agent runs it inline and gets its final output back as the tool result. |
Run the draft (runDraft) | boolean (optional) | false |
Run the target flow’s current draft instead of its published version. Every run of this flow then runs the child’s unpublished edits, including runs a trigger starts, so use it while you are still building the child. |
On error (onError) | string ✦ (optional) | — | What to do when the sub-flow fails: fail this flow too, or continue. |
Timeout (seconds) (timeoutSeconds) | integer ✦ (optional) | — | Wall-clock timeout in seconds for the subflow run; when empty it inherits the parent agent’s timeout. |
Tool name (toolName) | string ✦ (optional) | — | Name the agent sees for this tool; defaults to a slug of the target flow’s title. |
Tool description (toolDescription) | string ✦ (optional) | — | When the agent should call this flow. It is added to the flow’s own description, which says what the flow does, so say here only what is particular to this agent. |
Approval (requiresApproval) | one of inherit, always, never (optional) |
— | Whether a human must approve this before it runs. “Follow the agent’s approval mode” is almost always right — the agent’s mode already decides, based on what this node actually does. Override it only to pin this one node: always ask (even on Autopilot), or never ask. |
Compensating tool (compensatingTool) | string ✦ (optional) | — | Name of another tool the agent has that undoes this subflow’s effect if the run later unwinds. |
Param overrides (paramOverrides) | key-value map (optional) | — | Per input property: who fills it — the model, a constant, or an expression resolved from this run. Pin anything that is an identity or a scope (a customer number, an account) rather than a detail of the request. |
Fields marked ✦ accept expressions.
The agent decides whether to call the subflow from what it reads about it: the target flow’s Description (its title when it has none), followed by this node’s toolDescription. Describe what the flow does and what it needs on the flow itself, in Flow settings, so every agent that uses it reads the same thing. Use toolDescription for what is particular to this agent, such as when to call it.
Calls to a subflow can be approval-gated. By default the gate follows the agent’s approval mode, judged by what the target flow actually contains: a child flow with a node that changes something raises the risk of the whole call. Pin requiresApproval to always ask (even on autopilot) or to never ask. See Add human approval.


How arguments and inputs work
Section titled “How arguments and inputs work”The tool’s parameters come from the target flow’s input schema. If the target flow declares an input JSON schema, the agent sees those fields as the tool’s arguments, and the model fills them when it calls the subflow. The supplied values become the target flow’s own start data: inside the target flow, read them as $start->fieldName.
If the target flow has no input schema, the model’s arguments are passed through as-is and the flow can read them the same way.
Pinning an argument
Section titled “Pinning an argument”Not every input should be the model’s to choose. A customer number, an account, a scope: these come from the flow that is calling, not from whatever the message claims. Under Pinned arguments on the Subflow node, each input of the target flow can be set to:
- The model decides: the default. The argument is part of the tool the agent sees.
- A constant: the same value on every call.
- From the run: an expression resolved against the calling flow’s run, for example
{{ $workflow->node('Build Context')->customer->debtorNumber }}.
A pinned input is removed from the tool the model sees, and its value always wins over anything the model sends under that name. If a pinned expression resolves to nothing, the call fails with an error result and the target flow does not start: a pin exists to scope what the child may see, so running without it is never the right fallback. Pins apply when the subflow is called by a top-level agent and when it runs nested.
When a call needs human approval, the approval card shows the model’s arguments and marks the pinned ones as pinned, without their values: they are filled after the approval, from the run.
The subflow runs in its own context. It does not see the orchestrator’s start data or the orchestrator’s conversation. It only sees the arguments the model passed in. This isolation is the point: the specialist works from a clean, narrow input.
Using it as a node
Section titled “Using it as a node”A Subflow node also runs in the flow itself: connect it between two nodes like any other, and the target flow runs as its own child run at that point. There is no model in this role, so the target’s inputs are filled from the run:
- each input named in the target flow’s input schema takes the same-named field of the previous node’s output (
$prev->fieldName), unless a Pinned argument sets it to a constant or to another expression; - a target with no input schema receives the previous node’s whole output as its start data.
A required input the previous node did not produce fails the node, and the run fails there; an optional one is simply left out. The subflow’s output is the target flow’s final node output, so the node after it reads that as $prev. The child run appears in the runs list, linked to the parent, exactly as a tool call’s does. On the parent’s run report, the Subflow node links to it as Subflow run, and the child’s report links back under Parent run.


When the target flow fails, the calling flow fails at the Subflow node too. Set On error to continue to let it go on instead: the node completes with {"error": true, "message": "…", "childFlowRunId": "…"} as its output, so the next node can log the failure, and the failed child run stays in the runs list with its own error. This suits a Subflow inside a Pager or a Parallel, where one item may fail without stopping the rest. The calling run then reports how many failures it continued past. A missing target flow, a call that would recurse or nest too deep, and a missing required input still fail the node.
Which version of the target runs
Section titled “Which version of the target runs”A subflow runs the target flow’s published version, in both roles: as an agent’s tool and as a node in the flow. A target that has never been published runs its draft. See Draft, publish & versions.
This holds even when you start the calling flow with Run by hand: the calling flow runs its draft, but the target still runs its published version. After you change the target flow, publish it before its callers pick the change up.
Turn on Run the draft (runDraft) to make this Subflow node run the target’s current draft instead. Use it while you are still building the target. Every run of the calling flow then executes the target’s unpublished edits, including runs a schedule or webhook starts, so turn it off (or publish the target) before the calling flow goes live. When it is on, the Subflow node’s row on the run report says so.
What the target flow may contain
Section titled “What the target flow may contain”A subflow called from a top-level agent, or placed in the flow as a node, runs the target flow as a real run of its own, with the full flow engine behind it. The target flow may contain anything a normal flow can: connectors and pagers, Switch branching, conditional exits, and signal or await nodes. Each call appears as its own run, linked to the parent and drillable from the parent’s run report.
Output
Section titled “Output”The subflow returns the final node’s output of the target flow to the agent as the tool result. When that final node is an Agent with a response schema, the shape is known in advance: the tool description tells the calling model what comes back, and a node placed after the Subflow gets $prev completions for it before the flow has ever run. A target with several possible endings only reports a shape when they agree. If your target flow ends with an Agent node, the orchestrator receives that node’s answer; if it ends with a Mapper or text node, it receives that shaped value.
When the run fails or is rejected, the agent receives a structured error result it can read and recover from, rather than the whole flow crashing: a JSON object whose status is "error", with a message describing what failed.
Each subflow call is recorded as its own run, so you can inspect it in the runs list or drill into it from the parent’s run report. The template “Smoke / Subagent — flow as tool” shows the smallest working pair: an agent calling an echo flow as its only tool.
Undoing side effects
Section titled “Undoing side effects”When a subflow performs a side effect (creates a record, sends a message, books something), set compensatingTool to the name of another tool the same agent has that undoes that effect. After a successful call, the run remembers how to roll it back. If the run later fails, or a human approval further along is denied, completed side effects are undone in reverse order: each compensated call’s arguments, pinned ones included, are replayed into its compensating tool.
The compensating tool must be a tool the orchestrating agent already has, and it should be safe to run more than once. Leave compensatingTool unset for read-only subflows; without it, a failure or denial returns an error result to the agent and nothing is rolled back.
Example
Section titled “Example”An orchestrator agent that delegates research to a specialist sub-flow:
- Build a small research flow. Give it an input schema with a single
topicfield, an Agent node whose prompt isResearch {{ $start->topic }} and summarise the key findings., and let that agent be the last node so its answer becomes the flow’s output. - In your orchestrator flow, add an Agent node and a Subflow node.
- Give the research flow the Description
Researches a topic and returns a short summary of findings.On the Subflow node, settargetFlowto the research flow. - Connect the Subflow node’s
outputto the orchestrator agent’stoolhandle. - Set the orchestrator agent’s
promptto the user’s question and asystemMessagethat tells it to delegate research before answering.
When the user asks a research question, the orchestrator calls the subflow with a topic, the research flow runs on its own, its summary comes back as the tool result, and the orchestrator writes the final answer using it.
Limitations
Section titled “Limitations”- At most three flows may sit on one call chain (the calling flow plus its nested children). A deeper call returns an error result to the agent instead of running.
- A flow cannot call itself, directly or through a cycle. Recursion is refused the same way, with an error result the agent can read.
timeoutSecondsbounds the in-process path only. A subflow called by a top-level agent runs as its own workflow, where the field has no effect.
Output shape
Section titled “Output shape”The tool’s result is the target flow’s final output as JSON. When that flow ends in an Agent with a response schema, the tool’s description states the shape of that output (the data fields and their allowed values), so the calling agent reads data.category off the result rather than parsing text.
Related
Section titled “Related”- Agent: the agent that calls the subflow.
- How to build a multi-agent flow: split a task into a specialist sub-flow and orchestrate it.
- How to build an AI agent: the single-agent loop.
- How to add human approval: the approval gate
requiresApprovalpins. - Expressions: read subflow inputs with
$start.