ADK Parallel Agents
A ParallelAgent executes its sub-agents concurrently.
Original Notion page had a screenshot of the orchestration diagram. See
migrated_fromURL.
Pattern: parallel info-gathering, then sequential synthesis
A common pattern is to put a ParallelAgent (info gathering) inside a SequentialAgent (gather → synthesize).
"""
System Monitor Root Agent
This module defines the root agent for the system monitoring application.
It uses a parallel agent for system information gathering and a sequential
pipeline for the overall flow.
"""
from google.adk.agents import ParallelAgent, SequentialAgent
from .subagents.cpu_info_agent import cpu_info_agent
from .subagents.disk_info_agent import disk_info_agent
from .subagents.memory_info_agent import memory_info_agent
from .subagents.synthesizer_agent import system_report_synthesizer
# --- 1. Create Parallel Agent to gather information concurrently ---
system_info_gatherer = ParallelAgent(
name="system_info_gatherer",
sub_agents=[cpu_info_agent, memory_info_agent, disk_info_agent],
# these 3 wrapped in a system_info_gatherer
)
# --- 2. Create Sequential Pipeline: gather info in parallel, then synthesize ---
root_agent = SequentialAgent(
name="system_monitor_agent",
sub_agents=[system_info_gatherer, system_report_synthesizer],
)Keep things lightweight
Each sub-agent gets its own folder:
agent_name/
├── __pycache__/
├── __init__/
├── agent.py
└── tools.py
Sub-agents still use output_key
The synthesizer reads each parallel sub-agent’s output via state interpolation:
system_report_synthesizer = LlmAgent(
name="SystemReportSynthesizer",
model=GEMINI_MODEL,
instruction="""You are a System Report Synthesizer.
Your task is to create a comprehensive system health report by combining information from:
- CPU information: {cpu_info}
- Memory information: {memory_info}
- Disk information: {disk_info}
...
""",
)See next
- ADK-Sequential-Agent — the wrapper for the synthesis step
- ADK-Loop-Agents — iteration on top of sequential