|
|
ADK Parallel Agent Execution
Author: Venkata Sudhakar
A ParallelAgent in ADK runs multiple sub-agents simultaneously and waits for all to complete before returning. This is the right pattern for independent tasks that do not depend on each other. For a market research task that previously ran 3 sources sequentially taking 3 minutes, a ParallelAgent completes all three in about 1 minute - the total time is the duration of the slowest agent, not the sum. All parallel agent outputs accumulate in the shared conversation context, making them visible to a synthesiser agent that runs next. You combine ParallelAgent inside a SequentialAgent for the classic fan-out then fan-in pattern: run N specialist agents in parallel, then pass all their outputs to one synthesiser. This architecture is declarative and easy to extend - adding a fourth research agent requires zero changes to existing agents. ParallelAgent and SequentialAgent can be nested in any combination to build complex pipelines that are still readable and maintainable. The below example shows a product team researching a wireless earbuds launch: three agents run simultaneously fetching competitor pricing, customer sentiment, and market size data, then a synthesiser produces a concise go/no-go launch brief.
Running the parallel pipeline with a real product category query,
It gives the following output after all three parallel agents complete,
=== PRODUCT LAUNCH BRIEF (Synthesiser Output) ===
MARKET OPPORTUNITY: India wireless earbuds market is Rs 4,200 crore growing
at 34% YoY, projected to reach Rs 7,100 crore by 2026. The online channel
drives 68% of sales with the under-Rs 2,000 segment growing fastest at 41%.
TARGET PRICE: Rs 2,299 - fills the clear gap between Rs 2,000 and Rs 3,000
where no quality product currently exists.
TOP 2 FEATURES TO BUILD:
1. Battery: 7+ hours (addresses the top complaint of under-4-hour battery)
2. Secure Fit: Sports ear tips with 3 sizes included (top ear tip complaint)
LAUNCH CHANNEL: Online-first (Amazon and Flipkart) given 68% online share.
RECOMMENDATION: GO - clear pricing gap, strong growth market, addressable
customer pain points align with feasible product features.
# 3 parallel agents ran simultaneously - total time ~1 min vs ~3 min sequential
# All 3 research outputs visible to synthesiser in conversation context
# Adding a 4th research agent (e.g. supply chain) requires zero other changes
Parallel agents work best when research or processing tasks are independent - each fetches data from a different source with no dependency on the others. Avoid parallel agents when Stage B needs Stage A output as input (use sequential instead). Measure the real-world speedup by logging timestamps: in production with real API calls the parallel speedup is proportional to the longest single-agent latency versus the sum. For very large parallel batches (10-plus agents), consider the rate limits of your underlying APIs and add concurrency controls to avoid hitting quotas simultaneously.
|
|