executeInParallel handles this: run multiple steps concurrently with optional rate limiting, and get all results back in order.
Basic Usage
Wrap each job in an arrow function and pass them as an array. Results come back in the same order you submitted them, with each result telling you whether the job succeeded or failed:workflow.ts
Parameters
Result Type
The function returnsPromise<Array<ParallelJobResult<T>>>, sorted by original job index (so results stay in the same order you submitted them).
Each element is a discriminated union:
Handling successes and failures:
Concurrency Limit
When you’re calling an external API that has rate limits, useconcurrency to cap how many jobs run at once:
concurrency: 3, at most three enrichment calls run at a time. When one finishes, the next starts.
onJobCompleted Callback
onJobCompleted fires once per job in completion order (fastest first), not submission order. Use it for logging progress or streaming partial results:
Examples
Batch enrichment with rate limiting
Enrich a list of leads, capping concurrency to respect API rate limits:workflow.ts
Gather data from multiple sources
Run different steps in one batch — results stay in job order:Child workflows in parallel
Run multiple child workflows with a concurrency cap:Important: Wrap in arrow functions
Jobs must be functions that return the step, evaluator, or child workflow call. Do not pass promises:executeInParallel control when each job runs and respect the concurrency limit.