Lab 17: Building a Hybrid News Aggregator
Goalโ
In this lab, you will build a sophisticated News Aggregator using a hybrid graph architecture. You will learn how to:
- Run two specialized research nodes in parallel (Fan-out).
- Synchronize the results using a JoinNode (Fan-in).
- Process the combined data in a sequential step.
The Architectureโ
โโโโโ Node A (Tech News) โโโโโ
START โโโผ โโโโ JoinNode โ Summarizer โ END
โโโโโ Node B (Market News) โโโ
Step 1: Create the Projectโ
Environment setup:
- 1-Click Launch (Browser): Open in GitHub CodespacesOpen in Google Cloud Shell
- Local machine: If you're continuing the course in sequence,
cdinto theadk-trainingproject you created in Module 2 and skip the block below -- your environment and dependencies already carry forward. If you're starting fresh at this module, create that project first:uv init adk-training --python 3.10 && cd adk-training
uv add "google-adk>=2.1.0" python-dotenv- DevContainer / Codespaces (Alternative): If you opened this repository in a DevContainer or GitHub Codespaces, Python 3.11,
uv,gcloud, and all core ADK dependencies are pre-installed in your container environment.
uv run adk create news_aggregator
cd news_aggregator
Step 2: Implement the Specialist Nodesโ
Open agent.py. Your task is to define three agents: two for research and one for synthesis.
# In agent.py (Starter Code)
from google.adk import Agent, Workflow
from google.adk.workflow import JoinNode
# TODO: Define 'tech_researcher'
# Instruction: Find 3 headlines about AI and Robotics.
# Output key: "tech_news"
tech_researcher = ...
# TODO: Define 'market_researcher'
# Instruction: Find 3 headlines about Stock Market trends.
# Output key: "market_news"
market_researcher = ...
# TODO: Define 'summarizer'
# Instruction: Combine {tech_news} and {market_news} into a newsletter.
summarizer = ...
Step 3: Assemble the Hybrid Graphโ
Exercise: Complete the root_agent definition using the edges parameter to implement the Fan-out/Join pattern.
Tip: A 3-element edge tuple
(A, B, C)is shorthand for two chained edges,A โ BandB โ C. So a parallel branch that both starts at"START"and converges on thesyncercan be written as one tuple,("START", tech_researcher, syncer), instead of two separate tuples.
# 1. Create the synchronization point
syncer = JoinNode(name="news_sync")
# 2. Build the Workflow
# TODO: Define the edges to:
# - Start both researchers in parallel from "START".
# - Converge both researchers at the 'syncer'.
# - Connect the 'syncer' to the 'summarizer'.
root_agent = Workflow(
name="NewsSystem",
edges=[
# Parallel Branch 1
("START", ..., ...),
# Parallel Branch 2
(..., ..., ...),
# Sequential Final Step
(..., ...)
]
)
Step 4: Run and Verifyโ
- Return to the parent directory and start the Dev UI:
(Select
cd ..
uv run adk webnews_aggregatorfrom the agent dropdown in the UI). - Test: Send the prompt "Give me today's update."
- Inspect: Open the Graph View. Verify that the researchers start at the same time and the summarizer only runs after both finish.
Known issue (upstream
google-adk2.8.0): the main static Graph View tab works fine forWorkflow/JoinNodegraphs like this one. However, clicking into an individual event's Graph inspector (the per-event highlight view in the Trace) currently throws a 500 error --AttributeError: 'Workflow' object has no attribute '_graph'-- for this graph type specifically. This is an upstream ADK tooling bug, not something you did wrong. Workaround: use the main Graph View tab to inspect the overall structure instead of the per-event inspector.
Lab Summaryโ
You have built a hybrid multi-agent graph!
- You mastered Fan-out by defining multiple edges from START.
- You mastered Fan-in using the
JoinNode. - You learned that sequential and parallel execution are just different edge configurations.
- A few things worth internalizing: the
JoinNodewaits for every incoming edge -- if one parallel branch fails, it won't fire, so production graphs need retry/error handling to guarantee convergence.
Self-Reflection Questionsโ
- What happens if one of the parallel researchers fails?
- Can you add a third researcher (e.g.,
'sports_researcher') to this hybrid graph? What single line would you add? - Why use
output_keyhere if ADK 2.0 already passes data between sequential nodes automatically?
๐ Reference Solution Vaultโ
Official Solution Vault โ Module 17
Locked Challenge โ Active Pedagogical Socratic Gate