Build an AI Agent with Gemini 3

By Google for Developers

AI Agent DevelopmentLarge Language ModelsPython DevelopmentGoogle AI
Share:

Key Concepts

  • Gemini 3 Pro: A new, advanced AI model from Google, excelling in complex reasoning and instruction following, making it suitable for building AI agents.
  • Agentic Operations: The process of building AI agents that can perform tasks autonomously.
  • Agent Development Kit (ADK): A framework or set of tools for developing AI agents.
  • UV (Universal Virtual Environment): A Python package manager used for initializing and managing project dependencies.
  • Google AI Studio API Key: A credential required to access Google's AI models.
  • ADK Agent Scaffolding: Pre-generated code structure for an AI agent created using the ADK.
  • Google Search Tool: A specific tool integrated into the ADK that allows an agent to perform web searches.
  • Thought Signature (Gemini): A feature in Gemini 3 Pro that helps the model understand the context of a conversation and its reasoning process.
  • Chain of Thinking: The step-by-step reasoning process an AI model follows to arrive at a conclusion.
  • ADK Web: A platform or interface for deploying and interacting with ADK-built agents.

Building Your First AI Agent with Gemini 3 Pro and ADK

This guide details the process of creating an AI agent using Gemini 3 Pro and the Agent Development Kit (ADK). The focus is on leveraging Gemini 3 Pro's advanced reasoning capabilities for building sophisticated AI agents.

Project Setup and Initialization

  1. Create Project Folder:

    • Start by creating an empty project folder. The example names the folder "Gemini 3 Pro AI agent".
    • Open a terminal within this folder.
  2. Initialize Project with UV:

    • Use the uv package manager to initialize the project. Instructions for installing uv are available in the video description.
  3. Add Necessary Libraries:

    • Install the required Python libraries:
      • google-adk
      • google-generativeai (referred to as "Google's JDI library" in the transcript, likely a shorthand for the generative AI SDK)
  4. Configure API Key:

    • Obtain your Google AI Studio API key by navigating to Google AI Studio.
    • Export the API key as an environment variable using a command similar to: export GOOGLE_API_KEY='YOUR_API_KEY'.
  5. Activate Python Environment:

    • Activate the Python virtual environment created by uv.

Creating the Agent Scaffolding

  1. Generate Agent Structure:
    • Use the ADK command adk create followed by the desired name for your agent (e.g., adk create my_search_agent).
    • When prompted to select a model, choose option two, which corresponds to Gemini 3 Pro.
    • This command generates the initial file structure for your agent.

Customizing the Agent Code

  1. Open agent.py in VS Code:

    • Navigate to the generated project folder and open the agent.py file in Visual Studio Code.
    • Remove any existing boilerplate code.
  2. Integrate Google Search Tool Code:

    • Refer to the ADK documentation for the "Google search tool" section.
    • Copy the provided code snippet for the Google search tool. The link to the documentation and the final agent repository are provided in the video description.
    • Paste this code into your agent.py file.
  3. Modify Code for Gemini 3 Pro and Enhanced Instructions:

    • Model Selection: Change the model name from gemini-2.0-flash to gemini-3-pro.
    • Instruction Set:
      • Replace the single-line instruction with a more detailed set of instructions.
      • Crucially, instruct the agent to "cite its sources implicitly by providing the answers clearly based on search results."
    • Tool Configuration: Ensure the agent is configured with the "Google search tool" as its primary tool.
    • Import asyncio: Add import asyncio to the imports section.

Deploying and Interacting with the Agent

  1. Deploy to ADK Web:

    • Return to the terminal.
    • Deploy the agent to ADK Web using the appropriate ADK command (not explicitly detailed in the transcript, but implied by the next step).
    • A link will be provided to access your deployed agent.
  2. Interact with the Agent:

    • Access the agent via the provided ADK Web link.
    • Example Interaction: The user asks, "I've been meaning to take horse riding lessons in my city and but I just don't know where to get started."
    • Agent Response: The agent provides detailed information on where to find horse riding lessons, listing specific places, locations, and categorizing them by seriousness or basic level.

Exploring the Agent's Reasoning (Chain of Thinking)

  1. Access Events Tab:

    • In ADK Web, navigate to the "Events" tab to examine the agent's internal processes.
  2. Analyze Model Output:

    • The "text" tab shows the model's final output.
  3. Examine Thought Signature:

    • The next event reveals the "thought signature" of Gemini 3 Pro. This signature helps the model understand the conversational context and its reasoning.
  4. Review Searched Websites:

    • The agent's search history shows the websites it accessed, such as horseport.com, thebesttoronto.com, and Reddit.
  5. Trace Web Search Queries:

    • The sequence of web search queries demonstrates the agent's progressive refinement:
      • Initial broad search: "horse riding lessons Toronto"
      • Deeper search: "horseback riding near downtown Toronto"
      • Specific school search: "best horse riding schools Toronto"
      • Further refinement: Checking accessibility by public transit and the operational status of stables.

Conclusion and Next Steps

Gemini 3 Pro, combined with the ADK, enables the creation of powerful AI agents capable of complex reasoning and task execution. The ability to trace the agent's "chain of thinking" and search queries provides valuable insight into its decision-making process. The video encourages further exploration of ADK and Gemini 3 Pro for building more advanced agents, with links to resources provided in the description.

Key Arguments and Perspectives

  • Gemini 3 Pro's Superiority: The core argument is that Gemini 3 Pro is a significant upgrade, particularly for building AI agents due to its enhanced "advanced high-level reasoning" and ability to follow "complex instructions."
  • ADK as an Enabler: The ADK is presented as the practical framework that simplifies the development and deployment of agents powered by models like Gemini 3 Pro.
  • Transparency in AI Reasoning: The emphasis on exploring the "chain of thinking" and "thought signature" highlights the importance of understanding how AI models arrive at their conclusions, fostering trust and enabling debugging.
  • Implicit Source Citation: The instruction to cite sources implicitly is a key feature for ensuring the reliability and verifiability of the agent's responses.

Data, Research Findings, or Statistics

  • No specific quantitative data, research findings, or statistics were presented in this transcript. The focus was on a practical demonstration of building an AI agent.

Notable Quotes or Significant Statements

  • "Gemini 3 Pro just launched and I'm super excited by all the new and improved updates." - Speaker (Expressing enthusiasm for the new model)
  • "The model is really great at advanced high-level reasoning and things like following along with really complex instructions which make it ideal for building agentic operations and ultimately building great AI agents with." - Speaker (Highlighting Gemini 3 Pro's key strengths for agent development)
  • "And the thought signature in Gemini 3 Pro helps the model to understand the context in the conversation." - Speaker (Explaining the function of a new feature)
  • "So from just a single prompt of where can I learn horseback riding in Toronto, Gemini 3 was able to go through this chain of thought thinking in order to arrive at this response. And I think that's pretty cool." - Speaker (Illustrating the model's complex reasoning process with a real-world example)

Chat with this Video

AI-Powered

Hi! I can answer questions about this video "Build an AI Agent with Gemini 3". What would you like to know?

Chat is based on the transcript of this video and may not be 100% accurate.

Related Videos

Ready to summarize another video?

Summarize YouTube Video