Lab 8: Creating a "Researcher" Agent with Google Search Challenge
Goalโ
Your task is to build and configure a new agent that can search the web to answer questions about current events.
Lab Tasksโ
Environment setup:
- 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,
uv, and the core ADK dependencies are already pre-installed in your container environment.
-
Create a new agent named
researcher_agentusing theuv run adk createcommand, specifying the Python type. -
Enable the Vertex AI API in your Google Cloud project.
-
Configure the
.envfile inside theresearcher_agentdirectory to use Vertex AI, providing your project ID and a location. -
Modify the
agent.pyfile (Python approach):# In agent.py
from google.adk import Agent
from google.adk.tools import google_search
# TODO: Define the root_agent node
# - name: "researcher_agent"
# - model: "gemini-3.5-flash"
# - instruction: Tell it to use search for current events.
# - tools: Add the google_search tool.
root_agent = Agent(...) -
Run the agent from your main
adk-trainingdirectory using theuv run adk webcommand (without specifying the agent name). -
Test the agent by asking it a question about a recent event (e.g., "Who won the last major sports championship?").
-
Verify that the
google_searchtool was used by inspecting the "Trace" view in the Dev UI.
Self-Reflection Questionsโ
- Why is it important to explicitly instruct the agent when to use the
google_searchtool? What might happen if you just gave it the tool with no instructions? - The
google_searchtool requires an Agent Platform configuration. Why do you think this is a requirement, as opposed to using a simple Google AI Studio API key? - How does giving an agent access to real-time information fundamentally change the kinds of problems it can solve compared to an agent that only relies on its internal knowledge?
๐ Reference Solution Vaultโ
Module 08 Reference Solution Vault
Active Comprehension Gate โข Zero Guessable URLs โข Guided Verification