AI agents are among the most exciting areas of modern AI development. They are more powerful than simple chatbots because agents can use tools, run code, search the web, plan steps, and even work together with other agents to complete complex tasks.

In this article, I will show you how to build your first AI agent from scratch using Google’s ADK (Agent Development Kit). This is an open-source framework that makes it easier to create agents, test them, add tools, and even build multi-agent systems.

The best part? You can build everything for free and in just a few minutes if you already have Python installed.

Let’s get started.

What Is an AI Agent? (Simple Explanation)

Before we begin, let’s quickly review what an AI agent actually is.

A normal AI model (like ChatGPT or Gemini) only gives you text answers.
AnAI agent is different — it can:

You can think of an AI agent as a small “AI worker” that can do tasks instead of you.

In this tutorial, we will build a simple agent first, then upgrade it into a multi-agent system with separate agents for research, summarizing, and coordination.

What You Need Before Starting

To follow this tutorial, you only need:

If you have everything ready, let’s build!

Build AI Agents From Scratch

Step 1: Create a Project Folder and Virtual Environment

First, open your terminal and create a folder:

mkdir my_first_agent
cd my_first_agent

Now create a virtual environment:

python -m venv .venv

Activate it:

source .venv/bin/activate  # macOS / Linux
# or
.\venv\Scripts\activate    # Windows

A virtual environment keeps your project clean and avoids version conflicts.

Step 2: Install Google ADK

Now install the Agent Development Kit:

pip install google-adk

Step 3: Create Your Agent Project

Inside your terminal, run:

adk create my_agent

Choose the model (you can pick Gemini 2.5 or Gemini Flash).

After that, a folder structure appears:

my_agent/
 ├── agent.py
 ├── .env
 └── __init__.py

Open the folder in VS Code or any IDE.

Step 4: Get Your Free Gemini API Key

Go to: https://aistudio.google.com

Sign in with your Google account → bottom-left sidebar → Get API key.

Click Create API Key, give it a name, select a project (or create one), and copy the key.

Now open your .env file and add:

GOOGLE_API_KEY="your-key-here"

Step 5: Test the Default Agent

Open agent.py. You will see the default boilerplate code.

Before running it, update the model name.

Go to AI Studio → Models → choose a model → copy its internal name
(Example:gemini-2.0-flash or gemini-3-pro-preview)

Replace the placeholder model name in your code.

Now test your agent. Run this command inside the terminal:

adk run my_agent

Ask something simple. If everything works, you should get an answer.
If you hit the free limit for a model, switch to a lighter, free-tier model.

Step 6: Create Multiple Agents (Research + Summarizer + Coordinator)

Now let’s build a real multi-agent system.

1. Research Agent. This agent will search the web and save the result.

2. Summarizer Agent. This takes the research result and writes a summary.

3. Coordinator Agent (Root Agent). This agent decides who should work first and then builds the final answer.

Each agent needs:

You can use this code inside your agent.py file:

from google.adk.agents.llm_agent import Agent
from google.adk.tools import google_search, AgentTool


research_agent = Agent(
    name="Researcher",
    model="gemini-2.5-flash-lite",
    instruction="""You are a specialized research agent. Your only job is to use the
    google_search tool to find top 5 AI news for a give topic. Do not answer any user questions directly.""",
    tools=[google_search],
    output_key="research_result",
)

print("Resereach Agent created successfully.")

summarizert = Agent(
    name="Summarizert",
    model="gemini-2.5-flash-lite",
    instruction="""
    Read the research findings {research_result} and create a summary for each topic with the link to read more
    """,
    output_key="summary_result",
)
print("Summarizert Agent created successfully.")


# Root Coordinator:
root_agent = Agent(
    model='gemini-2.5-flash-lite',
    name='root_agent',
    description='A helpful assistant for user questions.',
    instruction="""
    You are coordinator. First your job is to delegate user questions to the 'research_agent' to gather information. Second pass the findings to the 'summarizert' agent to create a summary. Finally, compile the summaries into a final response for the user.
    """,
    tools=[
        AgentTool(research_agent),
        AgentTool(summarizert),
    ]
)

This is now a real multi-agent pipeline.

Step 7: Run the Multi-Agent System

Run this command inside your terminal:

adk run my_agent

Then type the topic for research. After running the agents, you will see:

Everything works together!

Step 8: Use the Web Interface (Much Easier)

ADK includes a web UI.

Inside the terminal, run this command:

adk web --port 8000

If everything is ok, you will see the server URL:

Open the link in your browser. Select your agent from the menu.

Now you can see:

This helps a lot when debugging multi-agent systems.

All the code is available on my GitHub repository: https://github.com/proflead/how-to-build-ai-agents-from-scratch

Video Tutorial: How to Build AI Agents

If you want visual instruction, please watch my step-by-step video tutorial.

https://youtu.be/lh8LBRXHnGE?si=dCpXkbwk5n1M8fn6&embedable=true

Watch on YouTube: How to Build an AI Agent from Scratch

Conclusion

Building AI agents is easier than most people think. With Google ADK, you can create simple or even multi-agent systems in minutes, test them in a web interface, and expand them with tools, workflows, and real-world integrations. Give it a shot, and please share your experience with me in the comments below.

Cheers! ;)