Learn › n8n Foundations: From Zero to First Automation › Sub-Workflows: Modular Automation Design

Sub-Workflows: Modular Automation Design

Beginner 🕐 12 min Lesson 14 of 15
What you'll learn
  • Build a reusable sub-workflow with an Execute Workflow Trigger as its entry point
  • Call a sub-workflow from a parent workflow using the Execute Workflow node
  • Identify logic in existing workflows that is worth extracting into a reusable sub-workflow

When Workflows Get Complicated

A workflow that does five things is manageable. A workflow that does twenty things becomes hard to read, harder to debug, and impossible to reuse. Sub-workflows solve this by letting you break large automations into smaller, focused workflows — each with a clear purpose — and then call one from another.

The Execute Workflow Node

The Execute Workflow node calls another workflow and waits for it to finish before continuing. The called workflow (the sub-workflow) runs, produces output, and returns that output to the calling workflow. From the caller's perspective, it looks like any other node — items go in, transformed items come out.

To use it: add an Execute Workflow node, select the workflow you want to call, and map the input fields. The sub-workflow receives the passed items as its trigger data (it needs to start with an Execute Workflow Trigger node to accept them).

Building a Reusable Sub-Workflow

Create a new workflow. Add an Execute Workflow Trigger node as the first node — this is the entry point when another workflow calls it. Build your logic. At the end, make sure your final node outputs the data you want returned to the caller.

Good candidates for sub-workflows:

  • Data enrichment — a workflow that takes a company name and returns company size, industry, and LinkedIn URL from several APIs
  • Notification dispatcher — a workflow that takes a message and severity level and routes to Slack, email, or PagerDuty accordingly
  • Format converter — a workflow that converts raw webhook payloads from different sources into your standard data shape
  • AI processing — a workflow that runs text through an AI model and returns structured output

Benefits of the Sub-Workflow Pattern

Once you have a "Send Slack Notification" sub-workflow, every other workflow in your account can call it with one node instead of duplicating three nodes. When the Slack channel changes, you update one sub-workflow and all callers benefit automatically.

Sub-workflows also help with debugging. A twenty-node workflow that fails is hard to isolate. A workflow that calls four sub-workflows makes it immediately obvious which sub-workflow failed — each one is a clear unit of functionality with its own execution log entries.

Calling Sub-Workflows in Parallel

If you need to call the same sub-workflow for every item in a list, the Execute Workflow node processes them sequentially by default. For parallel execution (faster, but uses more concurrent execution slots on Cloud plans), enable Execute in parallel in the node settings. Each item spawns a separate execution of the sub-workflow, dramatically reducing total processing time for large lists.

Key takeaways
  • Sub-workflows use the Execute Workflow Trigger as entry point and the Execute Workflow node as the caller — the caller waits for the sub-workflow to finish and receives its output
  • Good candidates for sub-workflows: notification dispatchers, data enrichment routines, format converters, and AI processing steps used across multiple workflows
  • Enable 'Execute in parallel' on the Execute Workflow node to process list items concurrently — faster but uses more concurrent execution slots