
If you’re looking to build your very first AI agent or expand your capabilities with multiple specialized agents, Google's Agent Development Kit (ADK) offers a powerful, flexible framework to get started quickly.
But what exactly is Google's ADK?
Simply put, it’s a model-agnostic toolkit designed to help developers build AI agents that can;
All while running locally or on Google Cloud.
In this guide, we’ll take you step-by-step through how to create an AI agent using Google's ADK.
So, whether you want to import agents, deploy them locally, or launch a web interface, this tutorial will provide you with the key concepts, project structure, and commands you need to build your first AI agent confidently.
Let's get started!
Create a dedicated project folder and set up a Python virtual environment :
mkdir xyz_support_agent
cd xyz_support_agent
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
Install Google ADK and required dependencies :
pip install google-adk
pip install httpx python-dotenv
Why this matters: You need an isolated environment to avoid conflicts with other Python projects and ensure your support agent runs reliably.
Create a .env file in your project root to store sensitive credentials:
GOOGLE_GENAI_USE_VERTEXAI=TRUE
GOOGLE_CLOUD_PROJECT=xyz-support-prod
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_API_KEY=your_actual_api_key_here
If using Google Cloud, enable the necessary APIs :
gcloud services enable aiplatform.googleapis.com
Real-world application: You secure API credentials and configure agent to use Vertex AI, ensuring enterprise-grade security and compliance for customer data.
Build a JSON file containing your company's support information at knowledge_base/support_kb.json:
{
"orders": [
{
"question": "How do I track my order?",
"answer": "Log into your account and navigate to 'Order History'. Click on your order number to see real-time tracking information."
},
{
"question": "What is your shipping timeframe?",
"answer": "Standard shipping takes 3-5 business days. Express shipping delivers within 1-2 business days."
}
],
"returns": [
{
"question": "What is your return policy?",
"answer": "We accept returns within 30 days of purchase. Items must be unused and in original packaging."
}
]
}
Implementation: You compile the most frequently asked questions from your helpdesk system into this structured format, covering orders, returns, warranties, and product specs.
Create tools.py to define the capabilities your agent needs :
import json
from pathlib import Path
def get_order_status(order_number: str) -> dict:
"""
Retrieves order status from the database.
Args:
order_number (str): The customer's order number (e.g., "ORD-12345")
Returns:
dict: Order status information including shipping status
"""
# In production, this would query your actual database
return {
"status": "shipped",
"tracking_number": "1Z999AA10123456784",
"estimated_delivery": "2025-10-30"
}
def search_knowledge_base(query: str) -> str:
"""
Searches the FAQ knowledge base for relevant answers.
Args:
query (str): The customer's question
Returns:
str: The most relevant answer from the knowledge base
"""
kb_path = Path(__file__).parent / "knowledge_base" / "support_kb.json"
data = json.loads(kb_path.read_text())
# Simple keyword matching (in production, use RAG/vector search)
for category in data.values():
for faq in category:
if any(word in query.lower() for word in faq['question'].lower().split()):
return f"KB_ANSWER: {faq['answer']}"
return "NO_KB_INFO: I don't have information on that topic."
def escalate_to_human(customer_message: str, urgency: str = "medium") -> str:
"""
Escalates the customer issue to a human support agent.
Args:
customer_message (str): The customer's original message
urgency (str): Urgency level - 'low', 'medium', or 'high'
Returns:
str: Confirmation message for the customer
"""
# In production, this would create a ticket in your support system
ticket_id = f"TICKET-{hash(customer_message) % 10000}"
return f"Your request has been escalated to our support team. Ticket ID: {ticket_id}. A human agent will contact you within 2 hours."
These tools connect the AI agent to XYZ's existing systems—the order database, knowledge base, and ticketing system.
Create the main agent file agent.py :
from google.adk.agents import Agent
from tools import get_order_status, search_knowledge_base, escalate_to_human
# Create the customer support agent
support_agent = Agent(
name='xyz_support_agent',
model='gemini-2.0-flash',
description='AI customer support agent for XYZ electronics store',
instruction="""You are a helpful customer support agent for XYZ.
Your responsibilities:
1. Answer customer questions about orders, returns, and products
2. Use search_knowledge_base for general questions
3. Use get_order_status when customers ask about specific orders
4. Escalate to human agents if:
- The customer is angry or frustrated
- The issue requires refunds or account changes
- You cannot find an answer in the knowledge base
Always be polite, empathetic, and professional. If you're unsure, escalate to a human.""",
tools=[get_order_status, search_knowledge_base, escalate_to_human]
)
Create __init__.py to mark the directory as a Python package :
from . import agent
We've tailored the agent's instruction to match XYZ's brand voice and support policies, ensuring consistent customer experiences.
Run the agent using ADK's command-line interface:
adk run xyz_support_agent
Example interaction:
User: Where is my order ORD-12345?
Agent: Let me check that for you. Your order ORD-12345 has been shipped!
Tracking number: 1Z999AA10123456784
Estimated delivery: October 30, 2025
You can run through 50+ sample customer queries to ensure the agent responds accurately before deploying to production.
Start the ADK web UI for interactive testing:
adk web
Navigate to http://localhost:8000 in your browser to access a chat interface with debugging capabilities.
Team collaboration: You can share this interface with your support team to gather feedback on response quality and identify gaps in the knowledge base.
Enhance your agent with sentiment analysis to detect frustrated customers:
def detect_sentiment(message: str) -> str:
"""Classifies customer message sentiment as positive, neutral, or negative."""
# Use Gemini to analyze sentiment
from google.genai import types
from litellm import completion
prompt = f"Classify the sentiment of this message as positive, neutral, or negative: '{message}'"
response = completion(
model="gemini-2.0-flash",
messages=[{"role": "user", "content": prompt}],
max_tokens=10
)
return response.choices[0].message.content.strip().lower()
Update your agent instruction to route based on sentiment:
instruction="""Before responding to any customer message:
1. Analyze the sentiment using detect_sentiment
2. If sentiment is 'negative', immediately use escalate_to_human
3. If sentiment is 'positive' or 'neutral', proceed with normal support flow
..."""
Your agent now automatically prioritizes upset customers, routing them to human agents immediately while handling routine queries autonomously.
For production deployment, containerize your agent and deploy to Cloud Run or your preferred platform:
# Create a Dockerfile
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["adk", "run", "xyz_support_agent"]
Deploy to Google Cloud Run :
gcloud run deploy xyz-support-agent \
--source . \
--platform managed \
--region us-central1 \
--allow-unauthenticated
You containerize the agent and deploy it behind XYZ's existing chat widget, integrating it seamlessly with their e-commerce platform.
Set up monitoring to track agent performance :
By following these steps, you've built a production-ready AI customer support agent that;
The combination of Google's ADK framework, custom tools, and thoughtful instruction design creates an agent that enhances rather than replaces your support team.
Google’s ADK is a powerful platform for building AI agents, but businesses seeking a ready-to-use AI customer support solution may prefer Helply.
Helply is a self-learning AI support agent that integrates with your help desk to instantly resolve over 70% of Tier-1 inquiries 24/7.
It continuously learns from tickets, knowledge bases, and documentation to provide accurate responses and draft customer-ready replies.
Tailored for SaaS and e-commerce companies with growing or lean support teams, Helply reduces support costs, improves customer satisfaction, and streamlines operations without adding headcount.
It also offers a Knowledge Base Concierge that audits support tickets to identify content gaps and suggests improvements, ensuring your help center stays up-to-date and effective.
Key features of Helply include:
Ready to experience the benefits of an AI-powered support agent tailored to your business needs?
Create your AI agent with Helply today and transform your customer support!
LiveAgent vs Chatbase vs Helply: Compare features, pricing, and pros/cons. See which AI support tool fits your team. Click here to learn more!
Build AI agents with Kimi K2.5 using tools, coding with vision, and agent swarms. Learn best modes, guardrails, and recipes to ship reliable agents.
End-to-end support conversations resolved by an AI support agent that takes real actions, not just answers questions.