Run This Ai
EN DE

Building Your First AI Agent with Google ADK — Step-by-Step Tutorial

Learn to build multi-agent AI systems with Google ADK in this hands-on tutorial. Create agents, workflows, add human-in-the-loop, and evaluate performance.

Introduction

Google's Agent Development Kit (ADK) makes building AI agents as simple as writing Python functions. In this tutorial, you'll build a multi-agent system from scratch — a fruit recommendation agent that delegates to specialized sub-agents.

🚀 Want to deploy ADK yourself?

Docker configs, system requirements, and installation guides — all on one page.

View ADK Tool Page →

Prerequisites

  • Python 3.10 or later
  • pip package manager
  • A Gemini API key (or another LLM provider supported by ADK)

Step 1: Install ADK

pip install google-adk

Step 2: Create Your First Agent

Let's start simple — a greeting agent:

from google.adk import Agent

greeting_agent = Agent(
    name="greeting_agent",
    model="gemini-2.5-flash",
    instruction="You are a helpful assistant. Greet the user warmly and respond to their questions.",
)

That's it! You've created your first ADK agent. The Agent class takes a name, model identifier, and instruction — the same pattern you'd use when prompting an LLM directly.

Step 3: Build a Multi-Agent Workflow

Now let's create a workflow where a main agent delegates to specialized sub-agents:

from google.adk import Agent, Workflow

# Specialized sub-agents
fruit_agent = Agent(
    name="fruit_agent",
    instruction="Return the name of a random fruit. Return only the name.",
)

benefit_agent = Agent(
    name="benefit_agent",
    instruction="Given a fruit name, return one health benefit. Be concise.",
)

# Workflow orchestrator
recipe_app = Workflow(
    name="fruit_advisor",
    description="Recommends a fruit and its health benefit",
)

# Add nodes
recipe_app.add_node("pick_fruit", fruit_agent)
recipe_app.add_node("explain_benefit", benefit_agent)

# Connect them
recipe_app.add_edge("pick_fruit", "explain_benefit")

# Run
result = recipe_app.run(input_data={"prompt": "Suggest a healthy fruit"})
print(result)

Step 4: Run and Evaluate

ADK includes a built-in evaluation framework. Run your agent through test cases to verify behavior:

from google.adk.eval import Evaluator

eval = Evaluator(agent=recipe_app)
results = eval.run(test_cases=[{"input": "Suggest a fruit", "expected_contains": ["fruit"]}])
print(results.summary())

Step 5: Add Human-in-the-Loop

For production workflows, you can pause execution for human approval:

from google.adk.nodes import HumanApproval

recipe_app.add_node("approve", HumanApproval(
    prompt="The agent recommends this fruit. Approve?"
))
recipe_app.add_edge("explain_benefit", "approve")

Conclusion

You've built a multi-agent AI system with ADK in under 50 lines of code. The framework's strength lies in its simplicity — agents are just Python objects, workflows are graphs, and everything is debuggable with standard Python tools.

🚀 Ready to deploy your ADK agents?

Get Docker configs, system requirements, and production deployment guides.

View ADK Tool Page →
#adk #tutorial #ai-agents #python #multi-agent