When the items do not depend on each other, running them one by one wastes the time they could have run together. ADK’s ParallelAgent runs its sub-agents concurrently for exactly this case, and LangGraph’s Send API does the same for independent items in a graph. Use parallel only when the items are truly independent: same input shape, no shared state, and no order between them. If one item’s result changes another’s, they are not independent, and running them in parallel will produce a wrong answer faster.
What you need
- A list of items to process, each independent of the others
- A subtask that handles one item and returns one result
- A way to collect the results in order afterwards
Step 1: Confirm the items are independent
Check that no item’s result is an input to another item, and that the subtask writes to no shared state. If any item depends on another, keep those sequential.
Step 2: Fan out one subtask per item
Run one copy of the subtask per item in parallel, each with only its own item as input. Give each run its own state so results cannot mix.
Step 3: Collect the results in order and check the count
Gather the results and confirm you have one per item, in the original order. A missing result means one branch failed silently, so check the branch logs before trusting the set.
Worked example: synthetic parallel run
The table below is a synthetic example. It shows the expected result of parallel subtasks; no agent was run.
| Item | Ran in parallel? | Result returned? |
|---|---|---|
| Supplier A price check | Yes | Yes |
| Supplier B price check | Yes | Yes |
| Supplier C price check | Yes | Yes |
| Results collected in order | Yes | Pass |
Expected result (UNTESTED). all three price checks run in parallel and their results are collected in order, one per item. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- Parallel only fits independent items; dependent items run in parallel give wrong answers.
- Each parallel branch costs model calls at the same time, so the spend spikes together.
- A branch that fails silently leaves a gap in the results, so count them before trusting the set.
- Shared state between branches mixes results, so give each branch its own state.
