DEV Community

Cover image for Create Your First Google ADK Agent: A Beginner's Guide
Anand Kumar R
Anand Kumar R

Posted on

Create Your First Google ADK Agent: A Beginner's Guide

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

  1. Get a Gemini API Key: You'll need a Gemini API key for this project. Create a .env file in your project root and add your key:

    GEMINI_API_KEY="YOUR_API_KEY_HERE"
    
  2. Set up a Virtual Environment:

    python -m venv .venv
    source .venv/bin/activate
    
  3. Install or Upgrade Google ADK: The Visual Builder requires version 1.18 or 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.

  1. Launch the ADK Web Console:

    adk web
    
  2. 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).

  3. 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.

  4. Save and Test: Once you approve the generated YAML, the agent's instructions and the required GoogleSearch tool 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.

  1. Run the create Command: Use the adk create command with the --configuration flag.

    adk create --name "My-YAML-Agent" --configuration
    
  2. 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.
  3. Agent Created: This process generates a root_agent.yaml file with a minimal configuration. You can now run adk web to 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)