Skip to content
Docs

How-to: Process items in parallel

The Split / Parallel connector takes an array, splits it into individual elements, and runs the iteration sub-graph concurrently for each one. Use it to process batch API responses, enrich a list of records, or fan out any array-shaped data.

Upstream (array) → Split/Parallel ─── iteration ──→ [per-element sub-graph]
└── output ──→ [runs after all elements complete]

Each element runs as its own child run, visible in the parent run’s tree in Runs. The output handle emits an aggregated array of all children’s outputs after every element is processed, or only {"count": n} when outputMode is summary.

A run report where the Each pallet connector's combined output sits above its three child runs, each with its own Label the pallet step and output
A run report where the Each pallet connector's combined output sits above its three child runs, each with its own Label the pallet step and output

Wire any node that outputs an array into the connector. For example, a Database / Select that returns a list of records or a Rest / Operation that returns a JSON array.

Step 2 — Place the Split / Parallel connector

Section titled “Step 2 — Place the Split / Parallel connector”
  1. Drag a Split / Parallel connector onto the canvas.
  2. Connect the upstream node’s output to the connector’s input.

The splitPath is a JSONPath resolved against the upstream node’s output. It tells the connector which part of that output to split:

Upstream output shape splitPath
[{...}, {...}] (the output is already an array) $ (the default: the whole output)
{ "items": [{...}, {...}] } (array under a key) $.items
{ "data": { "records": [{...}] } } (nested) $.data.records

If the value at splitPath is an object, the connector splits over its values. An empty array produces zero child runs and an empty [] aggregate on the output handle (this is not an error). Any other non-array value fails the node.

Step 4 — Build the per-element sub-graph

Section titled “Step 4 — Build the per-element sub-graph”

Wire nodes into the connector’s iteration handle. Inside this sub-graph, $prev holds the single element for this iteration, and it reads exactly like any other node’s output: {{ $prev->userId }}, {{ $prev['userId'] }}, or {{ jsonpath($prev, '$.userId') }}. The same element is also available as $page->startData, so expressions written for a Pager sub-graph work here unchanged. See Use expressions for the full surface.

A split on the canvas: Read the order feeds Each pallet, whose box holds Label the pallet, and Hand the labels to the printer runs after it
A split on the canvas: Read the order feeds Each pallet, whose box holds Label the pallet, and Hand the labels to the printer runs after it
OpenApi/Operation → Split/Parallel ─── iteration ──→ Rest/Operation → TableStore/Upsert

The Rest / Operation in the sub-graph uses:

uri: https://api.example.com/users/{{ $prev->userId }}/details

Each element gets its own API call and the result is upserted.

Wire nodes to the connector’s output handle. They run once, after all parallel elements complete. The first of them receives an array of every element’s final output as $prev, in the order of the source array. Any node further down reads the same array by the connector’s name, for example $workflow->node('Split / Parallel').

Use a ConditionalExit after the output handle to stop the flow when no elements were processed. The condition is the exit predicate, so make it truthy for the empty case; the flow continues only when at least one element succeeded:

condition: count($prev) == 0
message: No elements were processed.
  • Keep per-element sub-graphs short. Long-running sub-graphs multiply: 100 elements × 10-second sub-graph = 1000 seconds of wall time if the queue is constrained.
  • Use TableStore / Upsert or Database / Upsert inside the sub-graph to be safe against retries.
  • Monitor the Runs view: each element shows as a child run under the parent run, with its own input/output pair, making it easy to spot failures.
  • On the canvas, show the run with Show on the canvas in the Runs rail, and the split counts its elements under its own state, for example “40 done · 4 running · 1 failed”.