Google ADK Tutorial: Build Your First AI Agent With Gemini

Google's Agent Development Kit, known as ADK, is an open-source framework for building, evaluating and deploying AI agents. It is code-first, supports multi-agent architectures and integrates closely with Gemini models and Google Cloud, while remaining usable with other models. In this google adk tutorial, you will build your first gemini ai agent in Python, give it tools, test it with ADK's built-in developer interface, compose a simple multi-agent system and learn how to deploy to Vertex AI Agent Engine.

Start with the main concepts.

Core ADK Concepts

Agent: the main building block, typically an LLM agent configured with a model, instructions and tools.

Tools: Python functions or built-in capabilities such as Google Search that agents can use.

Workflow agents: deterministic orchestrators, including sequential, parallel and loop agents, that coordinate other agents without using an LLM for routing.

Sessions and state: conversation history and shared data across turns and agents.

Runner: executes agents and manages sessions.

Developer UI: a local web interface for chatting with agents and inspecting events.

What You Need

  • Python 3.10 or later.
  • A Gemini API key from Google AI Studio, or a Google Cloud project with Vertex AI enabled.
  • Basic Python knowledge.

Install ADK with pip install google-adk inside a virtual environment.

Step 1: Create the Project Structure

ADK expects a specific folder structure. Create a parent folder named adk-projects, and inside it a folder named travel_agent. Inside travel_agent, create three files: an init file that imports the agent module, an agent.py file and a .env file.

In the .env file, add your Gemini API key and a setting indicating you are using Google AI Studio rather than Vertex AI. If you use Vertex AI, set the project ID and location instead.

Visual description: your folder tree shows adk-projects containing travel_agent with three files.

Step 2: Write Your First Tool

In agent.py, write a function named get_weather that takes a city name and returns a dictionary with a status and a report. For this tutorial, return mock data for a few cities and an error status for unknown cities.

Write a clear docstring explaining what the function does, its arguments and its return values. ADK uses the function name, type hints and docstring to describe the tool to the model.

Add a second tool named get_local_time that returns the current time in a given city using a time zone mapping.

Step 3: Define the Agent

Create an Agent with:

  • A name, such as travel_assistant.
  • A model, such as a current Gemini Flash model for speed and cost efficiency.
  • A description summarizing what the agent does, which matters when it is used by other agents.
  • Instructions: You help travelers with weather and local time information. Use the tools to get accurate information. If a city is not supported, say so and suggest the user try another major city.
  • A tools list containing get_weather and get_local_time.

Assign the agent to a variable named root_agent, which ADK looks for when running the project.

Step 4: Run the Developer UI

From the adk-projects folder, run adk web. ADK starts a local server and prints a URL.

Visual description: the browser shows a chat panel on the right and a dropdown at the top left to select travel_assistant. Below, an events panel lists each step: user message, model response, function call to get_weather with arguments, function response and final answer.

Ask: What is the weather and local time in Tokyo? The agent calls both tools and combines the results. Click on events to inspect the exact inputs and outputs, which is invaluable for debugging.

You can also run the agent in the terminal with adk run travel_agent.

Step 5: Add a Built-In Tool

ADK includes built-in tools such as Google Search grounding. Create a separate agent named search_agent with the Google Search tool and instructions to find current travel advisories and events.

Built-in tools sometimes have restrictions on how they combine with other tools in a single agent, so placing them in a dedicated agent is a common pattern.

Step 6: Build a Multi-Agent System

Build agent with gemini teams by composing agents:

Option one, delegation: create a coordinator agent with instructions to answer travel questions and delegate to sub-agents. Set its sub agents to travel_assistant and search_agent. The coordinator's model decides which sub-agent should handle each request based on their descriptions.

Option two, agents as tools: wrap search_agent as a tool for the coordinator, so the coordinator calls it and keeps control of the conversation.

Option three, workflow agents: use a SequentialAgent to run agents in a fixed order, such as research followed by itinerary writing, passing results through shared state.

Set the coordinator as root_agent and restart the developer UI. Ask: I am going to Lisbon next week, what is the weather and are there any events I should know about? The events panel shows the coordinator delegating to each specialist.

Step 7: Use State and Memory

ADK sessions store conversation history and a state dictionary. Tools can read and write state through a tool context parameter, for example saving the user's preferred temperature unit. Agents can also write their final outputs to state using an output key, which later agents in a workflow can read.

Step 8: Evaluate Your Agent

ADK includes evaluation support. Create test files with example queries, expected tool calls and reference responses, then run adk eval to check behavior. Evaluating tool use, not just final answers, catches regressions where the agent stops calling the right tools.

Step 9: Deploy to Vertex AI Agent Engine

Vertex ai agent engine is a managed runtime for deploying agents with scaling, sessions and monitoring. To deploy:

  • Enable Vertex AI in your Google Cloud project and authenticate with the gcloud command line tool.
  • Configure your environment for Vertex AI.
  • Use the ADK deployment command or the Vertex AI SDK to package and deploy the agent.

ADK agents can also be deployed to Cloud Run or any container platform.

Troubleshooting Common Issues

Agent not found in the UI: run adk web from the parent folder, and ensure root_agent is defined and the init file imports the agent module.

API key errors: confirm the .env file is in the agent folder and the variable names match the documentation.

Tools not called: improve docstrings and instructions to explain when to use each tool.

Built-in tool conflicts: move built-in tools into a dedicated agent.

Wrong delegation: make sub-agent descriptions specific and distinct.

Frequently Asked Questions

Can ADK use non-Gemini models? Yes. ADK supports other models through integrations such as LiteLLM.

How does ADK compare with other frameworks? It offers strong workflow agents, built-in evaluation and tight Google Cloud integration, making it a natural choice for teams on Google Cloud.

Conclusion

In this google adk tutorial, you built a gemini ai agent with custom tools, explored it in the developer UI, added a search agent, composed a multi-agent system, used state and evaluation, and learned deployment options including Vertex AI Agent Engine.

Key takeaways: write clear docstrings for tools, use distinct agent descriptions for delegation, inspect events in the developer UI, evaluate tool usage and deploy with managed infrastructure when ready. Next, replace the mock tools with a real API and add an evaluation set for your most common requests.