Sub-workflows keep large automations readable and let several workflows share one tested piece of logic.
Big workflows with 60 nodes become hard to read and test. Sub-workflows let you split them, like moving a repeated recipe step into its own card.
A sub-workflow is a normal workflow that starts with the Execute Workflow Trigger (shown as "When Executed by Another Workflow"). It defines what input it accepts:
- Define using fields below: name each input and its type, such as
email(string) andamount(number). Callers then see exactly these fields. - Define using JSON example: paste a sample of the expected data.
- Accept all data: anything goes, so the sub-workflow must cope with missing values.
In the parent workflow, the Execute Sub-workflow node picks the sub-workflow and maps data into its inputs. The data produced by the sub-workflow's last node comes back as the node's output. You can also choose to not wait for the result, for fire-and-forget jobs.
Uses:
- Shared logic: "find or create customer" used by ten workflows.
- Smaller pieces that are easier to test in isolation.
- Tools for AI agents: the Call n8n Workflow Tool lets an agent run a sub-workflow (next lessons).
- Memory relief: heavy work in a sub-workflow frees memory when it finishes.
In the editor you can select nodes and convert them into a sub-workflow directly.
Note for n8n 2.x: when a sub-workflow pauses (waiting for a webhook, form or approval) and resumes, the parent now receives the sub-workflow's final output.
Remember
- Sub-workflows start with the Execute Workflow Trigger
- Define inputs explicitly so callers know what to send
- Execute Sub-workflow passes data in and returns the last node's output