Parallel block
Configure the Parallel block to run independent branches at the same time and collect their results for the steps that come after it.
The Parallel block (type: "parallel") runs several branches at the same time and waits for them before the run moves on. A branch is either a fixed list of steps or a copy of a step template made for each item in a list. For the plain-language guide, see Repeat for each item or run steps side by side.
When to use it
- Pull balances from two or more systems at once before a reconciliation step.
- Look up a customer in the CRM and in the ledger at the same time.
- Fan out one independent call per item, such as fetching each invoice PDF, when order does not matter.
When each item depends on the one before, or must run one at a time, use the Loop block.
Configuration
Set exactly one of branches or forEach.
Field (config key) | Editor label | Type | Required | Meaning |
|---|---|---|---|---|
branches | The paths you draw from the block | array | One of branches or forEach | Fixed branches. Each is { "id", "name", "steps": [step ids] }. Branch names must be unique. |
forEach | ForEach Source and ForEach Binding | object | One of branches or forEach | { "source", "as", "stepTemplate" }. See below. |
strategy | Strategy | wait-all or fail-fast | No | Default wait-all. See Errors and limits. |
maxConcurrency | Max Concurrency | number | No | 1 to 100 in the definition; the editor slider covers 1 to 20 and defaults to 5. When unset, all branches start together. |
timeoutMs | Timeout (ms) | number | No | At least 1000. Time allowed for each branch. |
forEach branches
| Key | Meaning |
|---|---|
source | A template reference that resolves to a list, such as {{steps.list_entities.items}}. |
as | The binding name. Default item. |
stepTemplate | One or more full step definitions, copied once per item. |
Before each copy runs, the exact text {{item}} in its name, action and config is replaced with the item (objects become JSON text), and {{itemIndex}} with its 0-based position. With as: "entity", use {{entity}} and {{entityIndex}}. Paths such as {{item.id}} are not replaced, and forEach copies do not use the variables root. Each copy's step id is the template id followed by __<index>, for example fetch_balance__0.
In the editor, a Parallel block that you draw becomes fixed branches. A forEach Parallel keeps its step template when you edit it in the editor, but the template itself is authored in the workflow definition.
Output
| Field | Type | Meaning |
|---|---|---|
branches | object | Results keyed by branch id. Each has branchId, branchName, success, output (from the branch's last step), error, durationMs and stepResults. |
branchesByName | object | The same results keyed by branch name. |
allSucceeded | boolean | true when no branch failed. |
failedBranches | string array | Ids of failed branches. |
durationMs | number | Time the parallel step took. |
Read one branch's output as {{steps.<step id>.branchesByName.<branch name>.output}}, or a step inside a branch directly as {{steps.<inner step id>.<path>}}.
The editor's output list shows results, errors and completedCount; the executor returns the fields above.
Example
This workflow reads the Stripe balance and the QuickBooks balance sheet at the same time, then compares them in a Code step.
{
"name": "Cash position snapshot",
"trigger": { "type": "api" },
"steps": [
{
"id": "fetch_both",
"type": "parallel",
"name": "Fetch balances",
"config": {
"branches": [
{ "id": "stripe", "name": "Stripe", "steps": ["stripe_balance"] },
{ "id": "ledger", "name": "Ledger", "steps": ["qb_balance_sheet"] }
],
"strategy": "fail-fast",
"timeoutMs": 60000
}
},
{
"id": "stripe_balance",
"type": "action",
"name": "Get Stripe balance",
"action": "stripe.getBalance",
"config": {}
},
{
"id": "qb_balance_sheet",
"type": "action",
"name": "Run balance sheet",
"action": "quickbooks.runReport",
"config": { "reportType": "BalanceSheet" }
},
{
"id": "compare",
"type": "code",
"name": "Compare balances",
"config": {
"input": {
"stripe": "{{steps.stripe_balance}}",
"ledger": "{{steps.qb_balance_sheet}}"
},
"code": "return { stripeAvailable: input.stripe.available, ledgerReport: input.ledger.Header };"
}
}
]
}stripe_balance and qb_balance_sheet appear in the top-level steps array but run only from their branch.
Errors and limits
- A config with both or neither of
branchesandforEach, or with duplicate branch names, is refused when the workflow is saved. wait-all: each branch runs to the end. If any branch failed, the parallel step is recorded as failed and the run carries on.fail-fast: the run fails withParallel execution failedwhen a branch fails.- A branch that runs past
timeoutMsfails. - A
forEachsource that does not resolve to a list fails the step. An empty list completes with no branches.
Loopfour