Parallel
Run a fixed set of named workflow branches concurrently.
Parallel sends the same input to a fixed object of named branches and runs
them concurrently. It returns an object keyed by those branch names.
import { Chain, Parallel } from "@nylorun/agents/define";
export const review = Chain({
id: "review",
steps: [
Parallel({
id: "checks",
branches: {
security: securityReviewer,
style: styleReviewer,
tests: testAuditor,
},
}),
{
run: summarizer,
input: ({ value }) =>
`Summarize these reviews:\n${JSON.stringify(value, null, 2)}`,
},
],
});Use Parallel when the number and names of branches are known while defining
the workflow. Branch names become stable result keys and manifest paths. Each
branch can be an agent, tool, nested workflow, or slot.
The example above produces a value shaped like:
{
security: securityResult,
style: styleResult,
tests: testResult,
}All branches share the workflow session sandbox. Cancelling the parent cancels active branches; completed node effects remain checkpointed.
See the shipped parallel example.
Use Map instead when the branch count comes from input data.