Quick Start
1
Define parallel workers
2
Run parallel workflow
API Reference
parallel()
Parameters
Accessing Results
After parallel execution, results are available inctx.variables:
Examples
With Agents
Mixed Steps
Nested Parallel
Performance
Parallel execution uses Python’sThreadPoolExecutor:
- 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
Parallelise only independent steps
Parallelise only independent steps
Branches must not depend on each other’s output in the same parallel group.
Cap concurrency for external APIs
Cap concurrency for external APIs
Rate-limited tools may need sequential execution or throttling despite parallel support.
Collect and inspect branch errors
Collect and inspect branch errors
Read the aggregated error list after
ParallelExecutionError before retrying.Keep branch outputs small
Keep branch outputs small
Large parallel results inflate context — summarise before merging downstream.
Failure Handling
Choose how a parallel block reacts when a branch fails using theon_failure parameter.
Failure Strategies
Examples
Error Handling with partial_ok
Exception Handling with fail_fast/fail_all
Related
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

