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.
Requirements
- Create a new agent named
researcher_agentusing theadk 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):- Define an
LlmAgentnamedroot_agent. - Set the
modeltogemini-2.5-flash. - Write a clear
instructionthat directs the agent to use a search tool for any questions about recent or up-to-date information. - Add the
google_searchtool to thetoolslist.
- Define an
- Run the agent from your main
adk-trainingdirectory using theadk 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 a Vertex AI 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?
🕵️ Hidden Solution 🕵️
Looking for the solution? Here's a hint (Base64 decode me):
L2RvYy1hZGstdHJhaW5pbmcvbW9kdWxlMDgtaW50cm8tdG8tdG9vbHMvbGFiLXNvbHV0aW9u
The direct link is: Lab Solution