Skip to main content
Execute multiple steps concurrently and combine their results. This pattern is ideal for independent tasks that can run simultaneously.
Steps inside this pattern inherit the same max_retries, guardrails, and output_file policies as top-level steps. See Nested workflows → Retry, guardrails, and output_file.
The user starts one workflow; independent steps run concurrently and merge results.

Quick Start

1

Define parallel workers

2

Run parallel workflow

Output:

API Reference

parallel()

Parameters

Accessing Results

After parallel execution, results are available in ctx.variables:

Examples

With Agents

Mixed Steps

Nested Parallel

Performance

Parallel execution uses Python’s ThreadPoolExecutor:
  • Concurrent I/O: Ideal for API calls, file operations
  • Thread-safe: Each step gets its own copy of variables
  • Automatic joining: All results collected before next step

Use Cases

How It Works


Best Practices

Branches must not depend on each other’s output in the same parallel group.
Rate-limited tools may need sequential execution or throttling despite parallel support.
Read the aggregated error list after ParallelExecutionError before retrying.
Large parallel results inflate context — summarise before merging downstream.

Failure Handling

Choose how a parallel block reacts when a branch fails using the on_failure parameter.

Failure Strategies

Examples

Error Handling with partial_ok

Exception Handling with fail_fast/fail_all

Workflow Patterns

Overview of routing, parallel, loop, and repeat

Workflow Routing

Decision-based branching

Workflow Loop

Iterate over lists and files

Workflow Repeat

Repeat until a condition is met