Sub-Workflow
Execute another workflow as a child step with input/output mapping, fire-and-forget, and run-per-item modes.
The Sub-Workflow node invokes a separate workflow as a child execution. Use it to compose reusable workflow modules, fan out processing across items, or trigger background jobs without waiting for results.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
| workflowId | string | Yes | The ID of the child workflow to execute. |
| executionMode | enum | No | How the child workflow runs. One of waitForCompletion (default), fireAndForget, or runPerItem. |
| itemsSourcePath | string | When mode is runPerItem | Variable path to the array of items. Each item is passed as _item to the child workflow. |
| inputMapping | MappingRow[] | No | Maps parent workflow variables to child workflow input keys. Each row has a parentVariable (template expression) and a childKey (plain string). |
| outputMapping | OutputMappingRow[] | No | Maps child workflow output keys back to parent variable names. Each row has a childKey and a parentKey. Hidden when mode is fireAndForget. |
| timeout | number | No | Timeout in milliseconds for child execution. Range is 1000 to 300000. Defaults to 60000 (60 seconds). |
| maxDepth | number | No | Maximum nesting depth for sub-workflow calls. Range is 1 to 10. Defaults to 3. Prevents infinite recursion. |
Execution Modes
Wait for Completion -- Starts the child workflow, blocks until it finishes, and returns its output to the parent via the output mapping.
Fire and Forget -- Starts the child workflow and immediately continues the parent workflow without waiting. No output mapping is available in this mode.
Run Per Item -- Iterates over an array of items and executes the child workflow once per item, passing each item as _item. Waits for all executions to complete and returns an array of results.
Recursion Protection
The engine tracks a workflow chain across nested sub-workflow calls. If the same workflowId appears twice in the chain (circular reference), execution is halted with a CYCLE_DETECTED error. The maxDepth setting provides an additional guard against deep nesting.
Output
| Field | Type | Description |
|---|---|---|
| executionId | string or null | ID of the child execution. null for fire-and-forget mode. |
| status | string | Status of the child execution (e.g., COMPLETED, STARTED). |
| isComplete | boolean | Whether the child workflow finished. |
| mode | string | The execution mode that was used. |
| results | array | Array of per-item results. Only present in runPerItem mode. |
| itemCount | number | Number of items processed. Only present in runPerItem mode. |
| (mapped keys) | varies | Any keys defined in the output mapping are merged into the top-level output. |
Example
Reuse an "Enrich Contact" workflow for each lead in a batch.
Workflow ID: wf_enrich_contact_abc123
Execution Mode: Run Per Item
Items Source: {{httpRequest_1.body.leads}}
Input Mapping:
{{httpRequest_1.body.apiKey}} -> apiKey
Output Mapping:
enrichedData -> enriched
Timeout: 120000
Max Depth: 2After execution, subWorkflow_1.results contains an array of enrichment results, one per lead.