In this tutorial, we'll walk through how to create your first agent using Google's Agent Development Kit (ADK). We'll explore two primary methods: using the intuitive Visual Builder and a straightforward, no-code YAML configuration.
Understanding the Anatomy of an ADK Agent
Before we build, let's break down the core components of a Google ADK agent:
- Name: A unique identifier for your agent.
- Model: The engine powering your agent. This can be a first-party Google model (like Gemini) or any third-party/open-source model via the LightLLM integration.
- Instructions: This is where you define the agent's persona, its core logic, and the desired output schema. Think of it as a detailed, structured prompt.
- Description: A concise summary of the agent's purpose. This is crucial in multi-agent systems, where agents interact based on each other's descriptions.
- Tools: These equip your agent with external capabilities. ADK provides several built-in tools like Google Search and File Retrieval. You can also integrate with third-party tools (LangChain, CrewAI) or build your own custom logic using a Function Tool.
Prerequisites
-
Get a Gemini API Key: You'll need a Gemini API key for this project. Create a
.envfile in your project root and add your key:
GEMINI_API_KEY="YOUR_API_KEY_HERE" -
Set up a Virtual Environment:
python -m venv .venv source .venv/bin/activate -
Install or Upgrade Google ADK: The Visual Builder requires version
1.18or higher.
pip install --upgrade google-adk
Method 1: Create an Agent with the Visual Builder & AI Assist
The fastest way to get started is with the ADK web interface and its natural language capabilities.
-
Launch the ADK Web Console:
adk web Create a New Agent: In the web UI, select "Create a new agent in visual mode" and give it a name (e.g.,
Visual-Agent-1).-
Use the AI Assistant: On the right-hand side, you'll find an assistant. Let's give it a prompt to create a research agent.
Prompt: "Create a bull and bear research agent for a given stock. It should use Google Search to analyze the bull and bear cases for the stock and return a summary in a bulleted list."
The assistant will generate the necessary YAML configuration.
Save and Test: Once you approve the generated YAML, the agent's instructions and the required
GoogleSearchtool will be auto-populated. Save the agent and test it directly in the UI by providing a stock ticker like "Nvidia".
The agent will now perform a search and return a formatted analysis of the bull and bear cases for the stock.
Method 2: Create an Agent with YAML Configuration
If you prefer a code-free, configuration-driven approach from the start, you can use the CLI.
-
Run the
createCommand: Use theadk createcommand with the--configurationflag.
adk create --name "My-YAML-Agent" --configuration -
Follow the Prompts: The CLI will guide you through a series of questions to set up your agent:
- Select the model you want to use (e.g.,
gemini-2.5-pro). - Choose the provider (e.g.,
Google AI). - Enter your API key.
- Select the model you want to use (e.g.,
Agent Created: This process generates a
root_agent.yamlfile with a minimal configuration. You can now runadk webto test it or begin customizing the YAML file with more detailed instructions and tools.
And that's it! You've successfully created your first ADK agent using three different approaches: the AI-assisted builder, the visual workflow, and the no-code YAML configuration. In future posts, we'll dive into more advanced concepts like multi-agent systems and callbacks.
Short videos
(Google ADK Visual Builder)- https://youtube.com/shorts/fIv6fvUM3gg?si=6U_DeU2NRXFaBy8M
(Anatomy of a Google Agent Development Kit (ADK) Agent) - https://youtube.com/shorts/pkttZnC5DCU?si=DvaLy5Z-F1Tg1EgQ
Top comments (0)