Skip to main content

Parallel Context Node

The Parallel Context Node runs the same flow many times in parallel, once per item in a context collection, and collects all the results into a single dictionary property.

This is the node you reach for when you have an array of inputs in your dictionary, you don't know up front how many items there are, and you want each one processed by the same pipeline simultaneously.

What it serves

Given:

  • An array in the dictionary (e.g. dictionary.context = [{x:1, y:2}, {x:3, y:4}, ...])
  • The name of a pipe to run
  • The name of a property to put results into

…the node:

  1. Reads the array.
  2. For each item, starts a parallel run of the named pipe.
  3. Each parallel run gets its own dictionary — set to that item.
  4. Waits for all runs to finish.
  5. Collects every run's final dictionary back into the parent's <Assign To> property as an array.

Use it when the task count is non-deterministic — sometimes 2, sometimes 10 — but the pipeline that handles each one is fixed.

Visual

The node has two dotsIN at the top, OUT at the bottom — and a forking icon in the body.

The empty-state node displays three diagnostic lines:

  • "Pipe not set"
  • "Assign target not set"
  • "Context source not set"

Each disappears once the corresponding setting is filled in.

Settings

Click the node to open Parallel Context Node Settings:

FieldPurpose
Context CollectionThe property in the dictionary that holds the array. Accepts a one-word name (e.g. context) — the node prepends dictionary. for you. The value at that key must be an array of objects.
PipeThe pipeline or script identifier to run for each item — same shape as Run Flow, e.g. MyFlow-Test.
Assign ToThe property where the collected results will be written. Accepts a one-word name (e.g. results, asyncResponse).
Node DescriptionFree-text — for other developers. Doesn't affect execution.
ApplySaves the settings.

How dictionary works inside each parallel run

Crucially different from Run Flow and Loop:

Each parallel run gets its OWN dictionary, set to its context item.

So if Context Collection = context and dictionary.context[0] = {x:1, y:2}, then inside the first parallel run the called pipe sees:

dictionary === { x: 1, y: 2, /* + the two extras below */ }

There is no shared mutation between parallel runs. They each operate on their own dictionary.

Two extra fields the called pipe sees

While running under Parallel Context, every parallel pipe's dictionary has two extra properties added by the engine:

PropertyValueMeaning
__callContext'tool'Agent responses inside this pipe get written to the result prop in this run's dictionary instead of being added to the agent's prompt stack. Lets you collect each parallel run's answer cleanly.
caller'parallel'Tells the called pipe it's running inside a Parallel Context invocation. Useful for branching scripts that behave differently in this mode.

What <Assign To> looks like after the node finishes

The destination is filled with an array — same length as the source — where each item is the parallel run's final dictionary, including the original context fields, anything the pipe wrote, plus a result and errors field.

// Before
dictionary.context = [
{ x: 1, y: 2 },
{ x: 3, y: 4 },
{ x: 5, y: 6 }
];

// After (assuming Assign To = "contextResults")
dictionary.contextResults = [
{ x: 1, y: 2, someProp1: ..., someProp2: ..., result: ..., errors: ... },
{ x: 3, y: 4, someProp1: ..., someProp2: ..., result: ..., errors: ... },
{ x: 5, y: 6, someProp1: ..., someProp2: ..., result: ..., errors: ... }
];

The order in contextResults matches the order in context. Whatever the parallel pipe wrote into its dictionary is preserved on the way back, plus a result and errors slot per run.

Common pattern — same agent, many contexts

You want to ask one agent the same kind of question about a list of inputs, then analyze the answers as a group. Parallel Context is the right tool:

  1. Build dictionary.context as an array of input objects upstream.
  2. Drop a Parallel Context node, point it at that array, give it a small flow that calls the agent and lets the agent's response land in result.
  3. Set Assign To = contextResults.
  4. Downstream, you have dictionary.contextResults — an array where each entry pairs the original input with its agent answer. Analyze, aggregate, summarize.

Compared to other iteration shapes

NeedUse
Iterate sequentially, one-after-the-other, body re-enters Loop on NEXTLoop Node
Iterate in parallel when each item runs the same pipe and you want all results back as an arrayParallel Context Node
Run independent fixed-shape branches in parallel from one decision pointParallel / Parallel Flow
Call a sub-flow once and continueRun Flow
Hand off to another flow without coming backJump Flow

Tips

  • Context Collection must be iterable AND each element should be an object (so the per-run dictionary is well-formed). Arrays of primitives may work for a trivial case, but the result-collection pattern relies on per-item objects.
  • Distinct property names if you nest — if you ever put a Parallel Context inside another Parallel Context's pipe, give them different Context Collection and Assign To names so they don't collide. Each level operates on its own dictionary, but consistent naming helps you read the flow.
  • The pipe should write its answer into result to take advantage of the __callContext: 'tool' behaviour. If you write somewhere else, the engine still preserves it — but result is the convention the collection step expects.