Workflow Parallel Execution
Execute multiple steps concurrently and combine their results. This pattern is ideal for independent tasks that can run simultaneously.Quick Start
API Reference
parallel()
Parameters
| Parameter | Type | Description |
|---|---|---|
steps | List | List of steps to execute concurrently |
Accessing Results
After parallel execution, results are available inctx.variables:
| Variable | Type | Description |
|---|---|---|
parallel_outputs | List[str] | List of all outputs in order |
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
| Use Case | Description |
|---|---|
| Multi-source Research | Query multiple APIs simultaneously |
| Data Processing | Process independent data chunks |
| Report Generation | Generate sections in parallel |
| Validation | Run multiple validators concurrently |
| A/B Comparison | Run different approaches and compare |
Best Practices
- Independent tasks only - Parallel steps shouldn’t depend on each other
- Handle errors gracefully - One failure shouldn’t break all tasks
- Aggregate results - Always follow with a step that combines outputs
- Consider rate limits - Don’t overwhelm external APIs

