All Articles
AI
//8 min read

How to Create an AI Agent Using Google Agent Development Kit

BO
Bildad Oyugi
Head of Content
How to Create an AI Agent Using Google Agent Development Kit

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;

  • Understand user interaction
  • Manage sessions
  • Execute complex workflows using multiple tools

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!

Step 1: Set Up Your Development Environment

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.

Step 2: Configure API Access and Environment Variables

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.​

Step 3: Create Your Knowledge Base

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.

Step 4: Define Custom Tools for Your Agent

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.​

Step 5: Build Your Customer Support Agent

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.​

Step 6: Test Your Agent Locally

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.

Step 7: Launch the Web Interface for Team Review

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.

Step 8: Implement Sentiment Detection and Smart Routing

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.

Step 9: Deploy to Production

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.

Step 10: Monitor Performance and Iterate

Set up monitoring to track agent performance :​

  • Resolution rate: Track percentage of queries handled without human escalation
  • Response time: Monitor average time to first response
  • Customer satisfaction: Survey customers after AI interactions
  • Escalation patterns: Identify common reasons for human handoffs

By following these steps, you've built a production-ready AI customer support agent that;

  • Integrates with your existing systems
  • Maintains your brand voice
  • Intelligently routes complex issues to humans when needed

The combination of Google's ADK framework, custom tools, and thoughtful instruction design creates an agent that enhances rather than replaces your support team.

Create Your AI Agent for Small Business With Helply Today!

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:

  1. Comprehensive Training on Your Content: Helply trains on multiple content sources such as knowledge base articles (from platforms like Zendesk or Google Docs), web links, pasted text, uploaded files, and custom Q&A pairs to keep the AI agent accurate and up-to-date.
  2. Customizable Agent Configuration: You can tailor Helply’s appearance, persona (friendly, professional, playful, etc.), styling rules, and response style. You can also set fallback actions when the bot can’t answer, like triggering a contact form or suggesting live support.
  3. Interactive Actions Beyond Q&A: The agent can perform tasks such as sending emails, calling APIs (e.g., Stripe), and executing workflows, making it interactive and transactional.
  4. User Personalization: Helply can access user-specific data like subscription plans to provide personalized responses.
  5. Conversations Dashboard for Insights: Helply provides a dashboard where you can review past user conversations. This helps with training the AI, quality checks, and gaining insights into customer needs and common issues.
  6. Knowledge Gap Detection (Gap Finder): Helply analyzes support tickets to detect common questions the bot cannot yet answer, highlighting knowledge gaps. This feature allows you to train the agent on new topics, continuously improving its coverage and effectiveness.
  7. Easy Deployment: Helply offers an embed code to add the AI agent seamlessly to your website or help center, enabling users to chat with the bot anywhere you deploy it.

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!

SHARE THIS ARTICLE

We guarantee a 65% AI resolution rate in 90 days, or you pay nothing.

End-to-end support conversations resolved by an AI support agent that takes real actions, not just answers questions.

Build your AI support agent today