Podcast Title

Author Name

0:00
0:00
Album Art

Building Multi-Agent Systems with Google's ADK Explained in 10 Minutes

By 10xdev team August 09, 2025

This article provides a comprehensive guide to building agents with Google's new Agent Development Kit (ADK). We'll explore why ADK is a compelling framework, focusing on its simplicity and independence from Google-specific technologies. Unlike other platforms, ADK doesn't lock you into the Gemini model; it allows you to integrate various models through libraries like LightLLM, including O-Llama and OpenAI.

Its straightforward design and flexibility make it an enjoyable and powerful tool for agent development. Let's get started.

Getting Started: Installation and Project Setup

First, you need to install Google ADK. Open your terminal and run the following command:

pip install Google-ADK

Once installed, you can set up a Python project to host your agent. We'll create a directory and initialize a project within it.

mkdir test-agents
cd test-agents
uv init

This creates a basic Pi project structure. To integrate with a wide range of large language models, we'll use LightLLM, a Python library that connects to services like OpenAI, Anthropic, and more.

Install and add LightLLM to your project dependencies:

pip install light-llm
uv add light-llm

With the environment set up, we can now begin building our first agent.

Building Your First Agent: The Pirate

Inside your test-agents folder, create a new file named agent.py. This is where we'll define our agent's logic.

First, let's add the necessary imports. We need the Agent class from ADK and LightLLM to connect to our chosen model.

from google.adk.agents import Agent
from google.adk.models.light_llm import LightLLM

# We'll use a local model via O-Llama first
AGENT_MODEL = "ollama/llama3.1"

Note on Model Routing: LightLLM uses a routing mechanism where the string format provider/model_name determines which service to use. For example, ollama/llama3.1 uses O-Llama, while openai/gpt-4o-mini would use OpenAI. You can use any model supported by your chosen provider.

Now, let's define the agent. In ADK, you must specify a root_agent which serves as the main entry point.

root_agent = Agent(
    name="PirateAgent",
    model=LightLLM(
        model=AGENT_MODEL
    ),
    description="Acts like a pirate.",
    instructions="""
        You are a pirate called Jolly Roger.
        You will act as a pirate, including personality traits,
        and will respond in pirate speak.
    """
)

Finally, to make the agent discoverable by ADK's command-line tools, create an __init__.py file in the test-agents folder with the following content:

from .agent import root_agent

Interacting with Your Agent

ADK comes with several commands to interact with your agents. The ADK run command provides a simple command-line interface.

adk run test-agents

The tool will detect the PirateAgent and you can start a conversation.

You: hi

Agent: Arrr, shiver me timbers! Jolly Roger be the name.

This CLI is great for quick tests, but it lacks conversational memory. If you start a new prompt, it won't remember previous interactions.

For a more robust experience, ADK provides a web interface.

adk web test-agents

This command launches a local web server with a chat UI that maintains conversation history through sessions.

Switching to OpenAI

To use a different model provider like OpenAI, you first need to set your API key in a .env file in your project's root directory.

.env OPENAI_API_KEY="sk-..."

Then, simply update the model string in agent.py:

# agent.py
AGENT_MODEL = "openai/gpt-4o-mini"

Restart the adk web server, and your agent will now be powered by GPT-4o mini, with full conversational context.

Multimodal Capabilities

ADK agents are also multimodal. You can upload an image to the web interface and ask the agent to describe it. The agent will analyze the image and respond according to its instructions, for instance, describing the image in pirate speak.

Enhancing Agents with Tools: The Time Agent

To make agents more powerful, we can equip them with tools. Let's build a TimeAgent that can fetch the current time for any specified time zone.

We'll use Pydantic for data validation. If you don't have it installed, add it to your project:

pip install pydantic
uv add pydantic

Create a models.py file inside test-agents to define the input and output structures for our tool.

test-agents/models.py ```python from pydantic import BaseModel, Field

class GetCurrentTimeInput(BaseModel): """Input model for getting the current time.""" timezone: str = Field(..., description="The time zone to get the current time for, e.g., 'America/NewYork' or 'Europe/London'.")

class TimeResult(BaseModel): """The result of a time query.""" timezone: str datetime: str isdaylightsavings: bool ```

Next, create tools.py to house the function itself.

test-agents/tools.py ```python import datetime from zoneinfo import ZoneInfo, ZoneInfoNotFoundError from test_agents.models import GetCurrentTimeInput, TimeResult

def getcurrenttime(time_zone: str) -> dict: """ Get the current time in a specified time zone.

Args:
    time_zone (str): The time zone to get the current time for.

Returns:
    dict: A dictionary containing the status and result or an error message.
"""
try:
    validated_input = GetCurrentTimeInput(time_zone=time_zone)
    tz = ZoneInfo(validated_input.time_zone)
    now = datetime.datetime.now(tz)

    time_result = TimeResult(
        time_zone=validated_input.time_zone,
        date_time=now.strftime('%Y-%m-%d %H:%M:%S'),
        is_daylight_savings=now.dst() != datetime.timedelta(0)
    )

    return {"status": "success", "result": time_result.model_dump()}
except ZoneInfoNotFoundError:
    return {"status": "error", "error_message": f"Unknown time zone: {time_zone}"}
except Exception as e:
    return {"status": "error", "error_message": f"Could not get time: {e}"}

**Note:** The docstrings are critical. The language model uses the function name, description, and argument descriptions to determine when and how to use the tool.

### Constructing the Time Agent

Now, let's create a new agent file, `time_agent.py`, and define our `TimeAgent`.

**test-agents/time_agent.py**
```python
from google.adk.agents import Agent
from google.adk.models.light_llm import LightLLM
from test_agents import tools

AGENT_MODEL = "openai/gpt-4o-mini"

time_agent = Agent(
    name="TimeAgent",
    model=LightLLM(model=AGENT_MODEL),
    description="Provides the current time for a specified time zone.",
    instructions="""
        You are a helpful time assistant. Your primary goal is to provide the
        current time for given time zones or cities. When the user asks for the
        time, you MUST use the get_current_time tool.

        Analyze the tool's response. If the status is 'error', inform the user
        politely about the error. If the status is 'success', present the
        information clearly.
    """,
    tools=[tools.get_current_time]
)

Update your agent.py to set the TimeAgent as the root_agent and run adk web test-agents. You can now ask for the time, and the agent will use the tool to provide an accurate answer.

Simplifying Development with ADK-Tools

The default method for creating tools can be a bit verbose. To simplify this, you can use a helpful utility library called ADK-Tools.

pip install ADK-Tools
uv add ADK-Tools

This library provides decorators and helpers to streamline tool and agent creation. Let's refactor our tools.py using it.

test-agents/tools.py (Refactored) ```python import datetime from zoneinfo import ZoneInfo from adktools import ADKTool from adktools.models import DomainError from test_agents.models import TimeResult

class InvalidTimeZoneError(DomainError): time_zone: str message: str = "Invalid time zone format."

class UnknownTimeZoneError(DomainError): time_zone: str message: str = "Unknown time zone."

@ADKTool(name="getcurrenttime", description="Get current time in a time zone.") def getcurrenttime(timezone: str) -> TimeResult: """Gets the current time.""" try: tz = ZoneInfo(timezone) now = datetime.datetime.now(tz) return TimeResult( timezone=timezone, datetime=now.strftime('%Y-%m-%d %H:%M:%S'), isdaylightsavings=now.dst() != datetime.timedelta(0) ) except Exception: raise UnknownTimeZoneError(timezone=time_zone) ```

The @ADKTool decorator automatically handles JSON serialization and error responses. You can simply return Pydantic models on success or raise custom DomainError exceptions on failure.

You can also simplify agent creation by automatically discovering tools.

test-agents/agent.py (Refactored) ```python from adktools import discoveradk_tools

... other imports

rootagent = Agent( # ... other properties tools=discoveradktools("testagents.tools") ) ```

Advanced Concepts: Multi-Agent Coordination

The true power of ADK shines in multi-agent workflows. We can create a coordinator agent that delegates tasks to our specialized PirateAgent and TimeAgent.

First, ensure your PirateAgent and TimeAgent are defined in their own files (pirate_agent.py, time_agent.py). Then, update agent.py to define the coordinator.

test-agents/agent.py (Coordinator) ```python from google.adk.agents import Agent from google.adk.models.lightllm import LightLLM from testagents.pirateagent import pirateagent from testagents.timeagent import time_agent

AGENT_MODEL = "openai/gpt-4o-mini"

rootagent = Agent( name="Coordinator", model=LightLLM(model=AGENTMODEL), description="I coordinate getting the time and translating to pirate speak.", subagents=[timeagent, pirate_agent] ) ```

With this setup, the Coordinator acts as a router. When you run adk web and make a request, it intelligently delegates the task.

You: Tell me the current time in New York in pirate speak.

The coordinator will first pass the request to the TimeAgent to get the time, then pass the result to the PirateAgent to translate it into pirate speak, delivering a combined response.

Conclusion

Google ADK is a powerful and flexible framework for building sophisticated AI agents. Its key strengths include: - Simplicity: An intuitive API for creating agents and tools. - Model Agnostic: Freedom to use various language models from different providers. - Multi-Agent Coordination: Built-in support for creating complex workflows with multiple specialized agents. - Excellent UI: A user-friendly web interface for testing and interaction.

As a straightforward framework for agent development, ADK is one of the most promising options available today. It's easy to get started, so go have some fun with it.

Join the 10xdev Community

Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.

Recommended For You

Up Next