In 5 minutes, I'll show you how to build AI agents from scratch
Source: Dev.to
What Is an AI Agent? (Simple Explanation)
A normal AI model (like ChatGPT or Gemini) only gives you text answers.
An AI agent can:
- Perform tasks, not just answer questions
- Use tools, such as Google Search, calculators, APIs, or databases
- Make decisions and plan steps
- Work autonomously with minimal human help
Think of an AI agent as a small “AI worker” that can do tasks for you.
What You Need Before Starting
- Python installed on your computer
- Any code editor (e.g., VS Code or Google Antigravity IDE)
- Google ADK – the open‑source framework we will install (see the Google ADK overview)
- A Gemini API key (free to generate)
Build AI Agents From Scratch
Step 1: Create a Project Folder and Virtual Environment
mkdir my_first_agent
cd my_first_agent
Create a virtual environment:
python -m venv .venv
Activate it:
# macOS / Linux
source .venv/bin/activate
# Windows
.\venv\Scripts\activate
A virtual environment keeps your project clean and avoids version conflicts.
Step 2: Install Google ADK
pip install google-adk
Step 3: Create Your Agent Project
adk create my_agent
Choose the model (e.g., Gemini 2.5 or Gemini Flash).
After creation you’ll see a folder structure:
my_agent/
├── agent.py
├── .env
└── __init__.py
- agent.py – main file where your code lives
- .env – store your API key
Open the folder in your IDE.

Step 4: Get Your Free Gemini API Key
- Go to and sign in with your Google account.
- In the bottom‑left sidebar click Get API key.
- Click Create API Key, give it a name, select (or create) a project, and copy the key.

Add the key to .env:
GOOGLE_API_KEY="your-key-here"
Step 5: Test the Default Agent
Open agent.py; you’ll see boilerplate code.
Replace the placeholder model name with the internal name of a Gemini model (e.g., gemini-2.0-flash or gemini-3-pro-preview).
Run the agent:
adk run my_agent
Ask a simple question. If everything works, you’ll receive 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)
Add the following code to agent.py (or a new module) to build a multi‑agent pipeline:
from google.adk.agents.llm_agent import Agent
from google.adk.tools import google_search, AgentTool
# Research Agent – searches the web
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 the top 5 AI news items for a given topic.
Do not answer any user questions directly.
""",
tools=[google_search],
output_key="research_result",
)
print("Research Agent created successfully.")
# Summarizer Agent – creates summaries
summarizert = Agent(
name="Summarizert",
model="gemini-2.5-flash-lite",
instruction="""
Read the research findings {research_result} and create a summary for each topic,
including a link to read more.
""",
output_key="summary_result",
)
print("Summarizert Agent created successfully.")
# Root Coordinator – orchestrates the workflow
root_agent = Agent(
model="gemini-2.5-flash-lite",
name="root_agent",
description="A helpful assistant for user questions.",
instruction="""
You are the coordinator. First, 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 defines a three‑step pipeline: research → summarization → coordination.
Step 7: Run the Multi‑Agent System
adk run my_agent
When prompted, enter the topic you want researched. You’ll see:
- The Research Agent gathering information
- The Summarizer Agent producing summaries
- The Coordinator compiling the final response
All agents work together to deliver the result.
Step 8: Use the Web Interface (Much Easier)
Google ADK includes a built‑in web UI that lets you interact with your agents through a browser, making testing and iteration even simpler. Launch it with the same adk run command and open the provided local URL in your browser.