Build an AI Travel Assistant With Google Agent Development Kit (ADK)
What is the Google agent development kit (Google ADK)?
Google’s Agent Development Kit (ADK) is a framework for developing, deploying, and testing AI agents, which makes it suitable for developing generative AI based applications.
Using ADK, we can build generative AI applications by creating different tools and agents that perform a specified task. To understand how, let’s develop an AI travel assistant using Google ADK that recommends places to visit and activities to perform at a given destination. For that, let’s first install the Google ADK module and set up the project directory.
Learn How to Use AI for Coding
Ready to learn how to use AI for coding? Learn how to use generative AI tools like ChatGPT to generate code and expedite your development.Try it for freeInstallation and setup for building an AI app using Google ADK
In Python, you can install the Google ADK module using PIP by executing the following command on the command line terminal.
pip install google-adk
After installing the module, we can create AI applications using different agents and tools. However, every agentic AI application developed using Google ADK must follow a specific directory structure with multiple files such as .env
, __init__.py
, and agent.py
.
For example, we are going to build an AI travel assistant. So, we will create a directory named ai_travel_planner
for the project. Inside the ai_travel_planner
directory, we will create the .env
file using the following content:
GOOGLE_GENAI_USE_VERTEXAI=FALSEGOOGLE_API_KEY="Your_Google_AI_API_Key"
You can get your API key from Google AI Studio and put it in the file.
We will also create a __init__.py
file with the following content:
from . import agent
To create the above file, you can execute the following statement while you are in the ai_travel_planner
directory:
echo "from . import agent" > multi_tool_agent/__init__.py
The agent.py
file will contain definitions for all the tools and agents in our AI travel assistant app. Before defining the agents and tools in the file, let’s first discuss how to create an agent using the Google agent development kit.
How to create AI agents using Google ADK?
Agents are programs designed to perform specific tasks autonomously using LLMs and other tools. They have reasoning capabilities and can think and plan about what steps to take and what tools to use to complete a given task.
Google ADK provides different functions in the google.agents.adk
module for creating AI agents. We will use the Agent()
and LlmAgent()
functions to develop agents for the AI travel assistant. These functions take the following inputs:
- Name: We define the AI agent’s name using the
name
parameter. - Model: It is the model name for Gemini models or an LLM from OpenAI, Claude, or other providers created using LiteLlm. We pass the model name or the model object to the
model
parameter as input. - Description: The
description
parameter takes a string containing the agent description as input. The description should clearly mention the agent’s functionalities. - Instructions: Instructions are used to give direct commands to the LLM about its inputs, output, and functionalities. We pass the instructions to the agent using the
instruction
parameter. You can use prompt engineering to write efficient instructions for the agents. - Tools: An agent can use any number of tools to perform its tasks. If required, we pass the tools to the agent in a list using the
tools
parameter. - Sub agents: An agent can also use another agent to complete tasks. We pass other agents as input to the agent using the
sub_agents
parameter.
We can define a simple agent using the Agent()
function as follows:
sample_agent = Agent(name="agent_name",model="llm_model_name",description="Agent for showing how to define an agent using Agent.",instruction = "You are a dummy used to describe how to create agents using Google ADK",tools=[tool1, tool2],sub_agents=[agent_1, agent_2])
Instead of the Agent()
function, you can use the LlmAgent()
function as follows:
sample_agent = LlmAgent(name="agent_name",model="llm_model_name",description="Agent for showing how to define an agent using LlmAgent.",instruction = "You are a dummy used to describe how to create agents using Google ADK",tools=[tool1, tool2],sub_agents=[agent_1, agent_2])
After execution, the Agent()
and LlmAgent()
functions return AI agents that can complete tasks based on the given instruction using the LLM, tools, and sub-agents. Now that we know how to create agents, let’s implement the AI travel assistant app using different agents and tools.
Step-by-step guide to create an AI travel assistant using ADK
To create the AI travel assistant, we will first define the tools. Using the tools, we will define the agents that work as different components of the travel assistant. Finally, we will create an agent that uses all the sub-agents and works as an AI travel assistant. We will write all the code in the following steps to the agent.py
file.
Let’s first import all the required modules into the file:
import datetimefrom google.adk.agents import Agent, LlmAgentfrom google.adk.tools.agent_tool import AgentToolimport requestsfrom math import radians, sin, cos, sqrt, atan2from typing import List, Dict, Optional, Tuple
Next, let’s create tools for the AI travel assistant app.
Step 1: Create and set up tools for AI agents
ADK tools are modular components that an agent uses to complete predefined tasks. A tool enables the agent to make API calls, execute code snippets, query databases, etc. For example, we can write a function that takes a place’s name as its input and gives its geolocation. Agents can use this function as a tool to get a place’s geolocation.
As we have to build an AI travel assistant, we will create three tools:
- Tool to get geolocation of a place.
- Tool to get hotels and accommodation around a given location.
- Tool to get places of activities like parks, museums, restaurants, etc, around a given location.
We will use Google Maps APIs to create these tools. For this project, we will use the Geocoding API and Places API. You can get the API key from Google Cloud.
Step 1.1: Create a tool to get the geolocation of a place
We will define a get_lat_lng()
function that takes a place’s name as input and returns the latitude and longitude. The function will work as follows:
- It will take the name of the location as a string input.
- Then, it will send a request to
https://maps.googleapis.com/maps/api/geocode/json
with the API key and location string as input. - After receiving the response, we will convert it to JSON using the
json()
method. - We will fetch the latitude and longitude from the JSON string and return them as a tuple of floating-point numbers.
You can implement the get_lat_lng()
function as shown below:
def get_lat_lng(location: str) -> Tuple[Optional[float], Optional[float]]:"""Gets the latitude and longitude for a given location string using Google Geocoding API.Args:location (str): Human-readable locationReturns:(lat, lng) as a tuple of floats, or (None, None) on failure"""api_key= "your_Google_Maps_API_Key"url = "https://maps.googleapis.com/maps/api/geocode/json"params = {"address": location, "key": api_key}response = requests.get(url, params=params)data = response.json()if data["status"] == "OK":loc = data["results"][0]["geometry"]["location"]return loc["lat"], loc["lng"]else:print("Geocoding Error:", data.get("error_message", data["status"]))return None, None
While defining a function that will be used as a tool by LLM agents, you should make sure that you define the functionality along with the inputs and outputs using a docstring. This helps the AI agents understand what a function or tool does.
After creating the tool to get a place’s geolocation, we will create a tool to fetch places of accommodation around a given location.
Step 1.2: Create a tool to fetch hotels around a location
We will define a get_top_rated_hotels()
function that gives a list of hotels around a place with their description, rating, address, etc. To build this tool, we will use the following steps:
- First, we will get the latitude and longitude of the location. We will also take the maximum allowed distance of the hotel from the given location.
- Next, we will fetch the details of hotels around the selected radius of the given location. We will make an API call to
https://maps.googleapis.com/maps/api/place/nearbysearch/json
and filter places with the “lodging” type. - Post this, we will use the haversine formula to calculate the distance of the fetched locations from our input location.
- After getting the name, address, ratings, and distance of the hotels, we will sort them by ratings and return the list as output.
We can implement the get_top_rated_hotels()
function as follows:
def haversine_distance(lat1: float, lng1: float, lat2: float, lng2: float) -> float:"""Calculates distance in kilometers between two lat/lng points using Haversine formula."""R = 6371.0dlat = radians(lat2 - lat1)dlng = radians(lng2 - lng1)a = sin(dlat / 2)**2 + cos(radians(lat1)) * cos(radians(lat2)) * sin(dlng / 2)**2c = 2 * atan2(sqrt(a), sqrt(1 - a))return R * cdef get_top_rated_hotels(lat: float,lng: float,radius: int = 2000) -> List[Dict[str, Optional[float]]]:"""Returns a list of the top 10 highest-rated hotels near the given latitude and longitude.Each hotel includes:- name- rating- user_ratings_total- address- price_level- distance_kmArgs:lat (float): Latitude of the search centerlng (float): Longitude of the search centerradius (int): Radius in meters for hotel searchReturns:List of dictionaries with hotel information"""url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"api_key= "your_Google_Maps_API_Key"params = {"location": f"{lat},{lng}","radius": radius,"type": "lodging","key": api_key}response = requests.get(url, params=params)data = response.json()if data["status"] != "OK":print("Places API Error:", data.get("error_message", data["status"]))return []rated_hotels = []for place in data["results"]:if "rating" in place and "geometry" in place:hotel_lat = place["geometry"]["location"]["lat"]hotel_lng = place["geometry"]["location"]["lng"]distance_km = round(haversine_distance(lat, lng, hotel_lat, hotel_lng), 2)rated_hotels.append({"name": place.get("name"),"rating": place.get("rating"),"user_ratings_total": place.get("user_ratings_total"),"address": place.get("vicinity"),"price_level": place.get("price_level"),"distance_km": distance_km})return sorted(rated_hotels,key=lambda x: (x["rating"], x["user_ratings_total"]),reverse=True)
Next, let’s create a tool to fetch places for different activities, such as parks, museums, restaurants, etc.
Step 1.3: Create a tool to fetch places for an activity around a location
To plan activities in a given city or location, we must fetch locations to do those activities. To do this, we will create a tool that fetches locations given a list of activity tags. For this, we will implement a get_tagged_activity_places()
function with the following functionalities:
- We will take location, activity tags, and maximum distance from the given location as input.
- Next, we will get the location’s latitude and longitude and use the nearby search API to fetch details of places with the given activity tags.
- We will return the fetched places in a list with details like activity tag, name, address, and rating.
We can implement the get_tagged_activity_places()
function as follows:
def get_tagged_activity_places(location: str,keywords: List[str],radius: int = 5000) -> List[Dict[str, Optional[str]]]:"""Find places where one can perform various activities based on keywords,and tag each place with the matching keyword.Args:location (str): Name of the place or city to search around.keywords (List[str]): List of activity-related search keywords (e.g., ['hiking', 'museums']).radius (int, optional): Search radius in meters. Default is 5000.Returns:List[Dict[str, Optional[str]]]: A list of places, where each place is represented as a dictionary with:- 'tag' (str): the keyword that matched the place- 'name' (str): name of the place- 'address' (str): vicinity or formatted address- 'rating' (float): average Google rating (optional)- 'user_ratings_total' (int): number of user reviews (optional)"""api_key= "your_Google_Maps_API_Key"lat, lng = get_lat_lng(location)if lat is None or lng is None:return []all_results = []for keyword in keywords:url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"params = {"location": f"{lat},{lng}","radius": radius,"keyword": keyword,"key": api_key}response = requests.get(url, params=params)data = response.json()if data["status"] != "OK":print(f"Keyword '{keyword}' - Places API Error:", data.get("error_message", data["status"]))continuefor place in data["results"]:all_results.append({"tag": keyword,"name": place.get("name"),"address": place.get("vicinity"),"rating": place.get("rating"),"user_ratings_total": place.get("user_ratings_total")})return all_results
Now that we have created three tools, let’s define agents that can use them to perform tasks.
Step 2: Create AI agents for the AI travel assistant using Google ADK and tools
We will create four agents to build the AI travel assistant:
- A hotel’s expert agent who suggests hotels in a specified city or location.
- A places-to-visit expert agent that suggests the best places to visit in a given city or location.
- An activity expert agent that suggests activities and experiences that a user can do in a given city or location.
- A travel assistant agent who will use all three agents and work as a travel assistant.
We will use the LlmAgent()
function defined in the google.adk.agents
module to build the expert agents. Let’s discuss how to implement each agent one by one.
Step 2.1 Create the hotel’s expert agent
To create an accommodation and hotel expert, we will use the following code:
# Define instructions for the agentHOTELS_AGENT_INSTRUCTION = """You are a hotel recommendation assistant. Your job is to suggest hotels in a specified city or location, based on user preferences such as rating, location, or budget.You must return:1. **Hotel Name**2. **Hotel Rating** (e.g., 4.5 stars)3. **Full Address** (including locality and city)Guidelines:- Prioritize hotels with **high ratings** unless otherwise requested.- Include **location context** in the address (e.g., near a landmark or city center if available).- Limit the list to **5–7 hotels** unless asked for more.- Mention any unique features briefly if relevant.Be precise and to the point. If location is missing, ask for it politely. Do not provide fake or fictional hotels."""# Create the hotels expert agenthotels_expert = LlmAgent(name="hotels_expert",model="gemini-2.0-flash",description="Agent to suggest hotels in a specified city or location, based on user preferences such as rating, location, or budget",instruction = HOTELS_AGENT_INSTRUCTION,tools=[get_lat_lng, get_top_rated_hotels, get_tagged_activity_places],)
Step 2.2: Create the activities expert agent
We can implement the activities expert agent as follows:
# Define instructionsACTIVITY_AGENT_INSTRUCTION = """You are a travel activities expert. Your task is to suggest engaging, popular, and unique **activities and experiences** that a user can do in a given city or location.You must respond with activity recommendations that are:1. **Location-specific** – Tailored to the city, neighborhood, or landmark mentioned.2. **Category-aware** – Consider if the user is looking for specific types of activities (e.g., adventure, family-friendly, cultural, nightlife, food-related).3. **Well-described** – Briefly explain what the activity involves, why it’s worth trying, and any practical tips (e.g., timing, tickets, age suitability).4. **Grouped (if needed)** – Organize by theme if the list is long (e.g., Outdoor, Indoor, Local Experiences, Seasonal).Guidelines:- Prioritize **local and authentic experiences**, not just touristy ones.- Include **hidden gems** or unique suggestions where relevant.- If the user is vague (e.g., just a city name), suggest a diverse set of top-rated activities.- If the user includes interests or preferences (e.g., food, kids, thrill, budget), tailor the list accordingly.- Avoid booking or pricing details unless specifically asked.Respond in a friendly, informative tone. Use bullet points or short paragraphs for clarity. Always mention the location in the answer to stay contextual."""# Create agentactivities_expert = LlmAgent(name="activities_expert",model="gemini-2.0-flash",description="Agent suggests engaging, popular, and unique activities and experiences that a user can do in a given city or location.",instruction = ACTIVITY_AGENT_INSTRUCTION,tools=[get_lat_lng, get_tagged_activity_places,get_top_rated_hotels],)
Step 2.3: Create the places to visit expert agent
We can implement the agent for deciding places to visit in a city as follows:
# Define instructionsPLACES_TO_VISIT_AGENT_INSTRUCTION = """You are a travel guide assistant. Your job is to suggest the best places to visit in a given city or location. Recommend a mix of popular landmarks, cultural sites, natural attractions, and hidden gems.You must include:1. **Place Name**2. **Short Description** – What the place is and why it's worth visiting.3. **Location Context** – Optional, but include area or neighborhood if known.Guidelines:- Suggest **5 to 10 top places**, depending on the city size or request.- Prioritize **iconic attractions**, but include a few **unique or offbeat** recommendations where relevant.- Consider the user's interest, if mentioned (e.g., history, nature, shopping, photography).- Keep descriptions concise and engaging (1–2 lines).- Do not repeat categories (e.g., avoid listing multiple malls or temples unless asked).- Avoid fictional places."""# Create agentplaces_to_visit_expert = LlmAgent(name="places_to_visit_expert",model="gemini-2.0-flash",description="Agent to suggest the best places to visit in a given city or location. Recommends a mix of popular landmarks, cultural sites, natural attractions, and hidden gems.",instruction = PLACES_TO_VISIT_AGENT_INSTRUCTION,tools=[get_lat_lng, get_top_rated_hotels, get_tagged_activity_places],)
Step 2.4: Create the travel assistant agent
To create a fully functional travel app, we will create an agent with places_to_visit_expert
, activities_expert
, and hotels_expert
as sub-agents. Sometimes, the travel assistant agent might need to use the other agents as tools to fetch information. For such cases, we will also pass the agents as tools to the travel assistant agent by converting the agents to tools using the AgentTool()
function. We will assign the travel assistant agent to the root_agent
variable in the code because it is the root agent that performs all the tasks.
# Define instructionsMAIN_AGENT_INSTRUCTION = """You are a helpful and knowledgeable travel assistant. Your job is to answer user queries related to travel planning in a specific city or location. Respond with clear, concise, and informative answers.You must help the user with:1. **Hotel Availability** – Suggest hotels in or near the requested location. Include name, area, and any unique features if available.2. **Places to Visit** – Recommend popular tourist attractions, historical sites, cultural landmarks, and must-see destinations.3. **Activities to Perform** – Suggest activities based on location and traveler interest (e.g., adventure, shopping, food tours, relaxation, cultural experiences).Guidelines:- Always consider the **location** mentioned in the query.- If the user specifies dates, include availability context (if applicable).- Use bullet points or short paragraphs for readability.- Be proactive in offering relevant, adjacent suggestions if they add value (e.g., nearby places, combo experiences).- Keep responses grounded and practical — no fictional or imaginary places.- If multiple intents are present (e.g., hotels + places to visit), address them all clearly.- Don't ask questions to the user to generate outputs. Decide based on what information is already given.- If the user asks to help them plan a journey, provide all the information such as hotels, places to visit, and activities to perform.Example inputs you might receive:- "Show me hotels in New York and things to do nearby."- "Suggest activities for kids in Singapore and how to get around."You are not expected to perform bookings, but always aim to provide information that can help the user make travel decisions confidently."""# Create the travel planner agentroot_agent = Agent(name="ai_travel_planner",model="gemini-2.0-flash",description=("Agent to answer questions about the hotels availability, places to visit, mode of transport, and activities to perform in a given city or location."),instruction=MAIN_AGENT_INSTRUCTION,tools=[AgentTool(activities_expert),AgentTool(hotels_expert),AgentTool(places_to_visit_expert)],sub_agents=[activities_expert,hotels_expert,places_to_visit_expert])
You can get the final agent.py
, __init__.py
, and .env
in this GitHub gist.
Also, the final directory structure of your project should look as follows:
├── ai_travel_planner│ ├── agent.py│ ├── .env│ └── __init__.py
Now that the files are ready, let’s run the AI travel assistant from a GUI or a command-line terminal.
Step 3: Run the AI travel assistant
We can use the web UI or the command line interface to run the AI travel planner app. To run the AI travel planner, go to the parent directory of the ai_travel_planner
directory and run the following command:
adk web
After this, ADK activates the web UI at localhost port number 8000. You can go to http://127.0.0.1:8000
, access the AI travel assistant, and chat with it to plan your next trip, as shown in the following image:
Instead of a web UI, you can also chat with the AI travel assistant using the command line interface. To run the app through the command line interface, execute the following command:
adk run ai_travel_planner
The output in the command line terminal looks as follows:
Create Google ADK agents using LLMs other than Gemini
Google ADK gives primary support for Gemini AI models. However, we can also use LLMs from providers like OpenAI and Anthropic through the LiteLlm wrapper.
You can create an agent in ADK by using GPT models as follows:
from google.adk.models.lite_llm import LiteLlm# Using GPT models requires OPENAI_API_KEYsample_agent =Agent(name="agent_name",model= LiteLlm(model="openai/ gpt-3.5-turbo"),description="Agent for showing how to use OpenAI models in ADK.",instruction = "You are a dummy agent used to describe how to create agents using Google ADK and OpenAI",tools=[tool1, tool2],sub_agents=[agent_1, agent_2])
Thus, Google ADK allows you to use external LLMs and tools to build AI applications. Now, let’s discuss some of the features of Google ADK.
Features of Google agent development kit
Google ADK has the following features:
- Model independence: Although Google developed ADK, you can use any large language model (LLM) with it, including ChatGPT, Claude, Meta AI, and self-hosted LLMs.
- Integrated developer tools: ADK provides a command-line interface and a web interface to run and test agentic AI applications. Using the ADK web UI, we can inspect agent execution steps, visualize agent definitions, and debug the application by analyzing agent interactions.
- Programming languages: ADK is currently available in Python and Java.
- Artifact management: ADK provides mechanisms for saving, loading, and managing images and documents that agents generate during execution. It also provides version control for artifacts, just like Claude artifacts.
- Extensibility: While ADK provides different tools for building agentic AI applications, it also allows us to use tools from other frameworks. For example, you can use a LangChain agent with an agent built using ADK, and both will work just fine. This helps integrate existing agentic AI applications into ADK in an easy manner.
Conclusion
Google ADK is among the finest additions to the ever-evolving generative AI ecosystem. It helps us quickly build, deploy, and test agentic AI applications. As ADK is compatible with other AI frameworks like LlamaIndex, LangGraph, LangChain, etc, and supports LLMs from other providers, you can also integrate ADK with your existing agentic AI apps. In this article, we built an AI travel assistant by creating different tools and agents for fetching hotel names, places to visit, and activities to do in a city. You can extend this work by adding tools and agents for route planning, flight search, etc. This will help you better understand the different components of ADK.
To learn more about generative AI, you can take this course on creating AI applications using Retrieval-Augmented Generation (RAG). You might also like this prompt engineering to build a Django app course that teaches you how to develop real-world applications using Django with generative AI tools.
Frequently asked questions
1. What is the difference between Google ADK and LangGraph?
LangGraph is a low-level orchestration framework for building controllable agents, but Google ADK offers a more comprehensive solution that covers the full agent development lifecycle. The main difference between LangGraph and ADK is that LangGraph gives us a lot of control over our AI agents using state graphs, nodes, and edges. However, Google ADK uses the Agent-to-Agent protocol to decide the execution flow between agents.
2. What is the difference between Google ADK and LlamaIndex?
LlamaIndex is a data framework for LLM applications specializing in data connectors, structuring, and retrieval. Google ADK offers a more comprehensive framework for building, orchestrating, and deploying agent systems.
3. What is the Google agent-to-agent protocol?
The Google Agent-to-Agent (A2A) protocol is a communication standard that enables AI agents to discover, interact with, and collaborate with each other regardless of the framework or vendor on which they are built.
4. What is the difference between the agent development kit and LangChain?
LangChain focuses on building a single, powerful AI agent by chaining together tools, prompts, memory, and logic. ADK is designed to create systems composed of multiple independent AI agents that can communicate, collaborate, and delegate tasks among themselves.
5. What is the difference between ADK and SDK?
SDK (Software Development Kit) is a set of tools and libraries for building applications for a specific platform or framework. ADK (Agent Development Kit) is a framework specifically designed for building AI-powered agents focusing on multi-agent systems.
'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'
Meet the full teamRelated articles
- Article
How to Build Agentic AI with LangChain and LangGraph
Learn to build AI agents with LangChain and LangGraph. Create autonomous workflows using memory, tools, and LLM orchestration. - Article
Building Multi-Agent Application with CrewAI
Learn how to create powerful multi-agent applications using CrewAI, a framework that enables AI agents to collaborate and solve complex problems together. - Article
Building LangChain Agents for LLM Applications in Python
Learn how to build LangChain agents in Python. Understand how LangChain agents enhance LLM applications by dynamically integrating external tools, APIs, and real-time data access.
Learn more on Codecademy
- Free course
Learn How to Use AI for Coding
Ready to learn how to use AI for coding? Learn how to use generative AI tools like ChatGPT to generate code and expedite your development.Beginner Friendly1 hour - Free course
Learn How to Use AI for SQL
Learn to generate SQL with AI, transform natural language to SQL, and utilize LLMs for SQL operations in our innovative course.Beginner Friendly1 hour - Free course
Enterprise Security: Leveraging Generative AI with Common Security Tools
Discover how generative AI enhances cybersecurity tools. Learn about AI models, integration challenges, and boosting predictive capabilities for proactive security.Intermediate2 hours
- What is the Google agent development kit (Google ADK)?
- Installation and setup for building an AI app using Google ADK
- How to create AI agents using Google ADK?
- Step-by-step guide to create an AI travel assistant using ADK
- Step 1: Create and set up tools for AI agents
- Step 2: Create AI agents for the AI travel assistant using Google ADK and tools
- Step 3: Run the AI travel assistant
- Features of Google agent development kit
- Conclusion
- Frequently asked questions