A Google ADK travel planning agent with multi-agent orchestration, following official ADK patterns and best practices.
TravelPlanningOrchestrator (Root Agent)
βββ ItineraryPlanningAgent (Child Agent)
β βββ Tools: ActivitySearch, DestinationInfo, TravelTips
βββ DataAggregationAgent (Child Agent)
β βββ Tools: FlightSearch, HotelSearch, ActivitySearch
βββ Coordination Logic & Workflow Management
exchange/
βββ agent.py # Root agent entry point
βββ adk.yaml # ADK configuration
βββ agents/
β βββ __init__.py # Base agent classes
β βββ orchestrator.py # Root orchestrator agent
β βββ itinerary_agent.py # Itinerary planning child agent
β βββ data_aggregator.py # Data aggregation child agent
βββ tools/
β βββ __init__.py # SerpApi tool implementations
βββ config/
β βββ __init__.py
β βββ settings.py # Configuration management
βββ requirements.txt # Minimal ADK dependencies
βββ test_adk_agent.py # ADK agent testing
βββ README.md # This file
- Python 3.8+
- Google ADK installed:
pip install google-adk - SerpApi account (free tier)
- Google AI Studio API key (free)
cd <dir>/exchange
# Install dependencies
pip install -r requirements.txt
# Set required API keys
export SERPAPI_KEY="your_serpapi_key_here"
export GOOGLE_AI_API_KEY="your_google_ai_key_here"# Test ADK agent structure and functionality
python test_adk_agent.py# Start web interface (recommended)
adk web
# Or run in terminal mode
adk run
# Or run specific queries
adk run "Plan a 5-day trip to Tokyo for 2 people"The TravelPlanningOrchestrator is the root agent that:
- Parses user intent and requirements
- Plans optimal workflows using child agents
- Coordinates multi-agent execution
- Synthesizes results into coherent responses
- Maintains conversation state and context
- ItineraryPlanningAgent: Creates detailed day-by-day travel plans
- DataAggregationAgent: Aggregates data from multiple sources in parallel
- Tool Integration: Each agent uses specialized tools for specific tasks
β
LlmAgent inheritance with proper initialization
β
Tool classes extending ADK Tool base class
β
Agent coordination through the orchestrator pattern
β
Async workflow execution with proper error handling
β
Configuration management following ADK conventions
β
Project structure matching ADK standards
# User: "Plan a week in Paris for art lovers"
intent = await orchestrator._parse_travel_intent(message)
# β {type: "plan_trip", destination: "Paris", duration: "1 week", interests: ["culture", "art"]}workflow = await orchestrator._plan_agent_workflow(intent)
# β Determines which child agents to use and in what order# Orchestrator coordinates child agents:
data_result = await data_aggregator.aggregate_travel_data(travel_request)
itinerary_result = await itinerary_agent.create_itinerary(params)response = await orchestrator._synthesize_response(results, intent)
# β Creates comprehensive, personalized travel planUser: "Plan a 5-day trip to Tokyo for 2 people interested in culture and food"
Agent Response:
π I've created a comprehensive travel plan for Tokyo!
π
Duration: 5 days for 2 travelers
π Your Itinerary:
Day 1 - Culture:
β’ Morning: Explore Tokyo - Traditional temples and shrines
β’ Afternoon: Main cultural attraction visit
β’ Evening: Local dining and culture
Day 2 - Food:
β’ Morning: Tokyo food markets and street food
β’ Afternoon: Cooking class or food tour
β’ Evening: Traditional restaurant experience
[...continues with full itinerary...]
π‘ Recommendations:
β’ βοΈ Flight options are available - book early for better prices
β’ π¨ Multiple accommodation options found - compare amenities
β’ π― Great activities available - plan 2-3 per day for best experience
User: "Find flights from NYC to Tokyo"
Agent Response:
π Here's what I found for flights in Tokyo:
βοΈ JetBlue Airways - New York to Tokyo
Compare prices across 500+ travel sites to find...
π https://www.jetblue.com/...
βοΈ American Airlines - JFK to NRT
Find the best deals on flights from New York to Tokyo...
π https://www.aa.com/...
User: "Add more museums to my Tokyo itinerary"
Agent Response:
β
I've updated your travel plan based on your request!
π Modification: museums
[Updated itinerary with more cultural attractions...]
# Complete system test
python test_adk_agent.py
# Expected output:
π ADK Travel Agent - System Tests
=====================================
β
Environment: PASS
β
Project Structure: PASS
β
Imports: PASS
β
Agent Functionality: PASS
β
Child Agent Coordination: PASS
π― Overall: 5/5 tests passed
π All tests passed! Your ADK Travel Agent is ready.# Test with various queries
adk run "What are the best activities in Barcelona?"
adk run "Find budget hotels in Rome for next week"
adk run "Create a cultural itinerary for Prague"name: ai-travel-agent
version: 1.0.0
description: Intelligent travel planning assistant using Google ADK
agent:
module: agent
class: agent
environment:
python_version: ">=3.8"
env_vars:
- SERPAPI_KEY
- GOOGLE_AI_API_KEY
web:
port: 8000
host: "0.0.0.0"# 1. Create new agent class
class NewTravelAgent(TravelLlmAgent):
def __init__(self):
super().__init__(
name="new_agent",
description="Specialized agent for X"
)
# 2. Add to orchestrator
self.new_agent = NewTravelAgent()
# 3. Include in workflow coordination# 1. Extend SerpApiSearchTool
class NewSearchTool(SerpApiSearchTool):
def __init__(self):
super().__init__()
self.name = "new_search"
async def execute(self, query: str) -> str:
# Tool implementation
pass
# 2. Add to relevant agent's tools list"Configuration Error" on startup:
# Ensure API keys are set
export SERPAPI_KEY='your_key_here'
export GOOGLE_AI_API_KEY='your_key_here'"Module not found" errors:
# Ensure ADK is installed
pip install google-adk
# Check project structure
python test_adk_agent.pyAgent not responding:
# Verify agent structure
adk validate # If available
# Check logs
adk run --debug "test message"# Run with verbose logging
adk web --debug --log-level=debug
# Test individual components
python -c "from agent import agent; print(agent.name)"β
Proper agent inheritance using LlmAgent base class
β
Tool pattern with ADK Tool base class
β
Root agent orchestrator coordinates child agents
β
Async patterns for proper workflow execution
β
Configuration structure matching ADK conventions
β
Project layout following ADK standards
β
Clear separation of concerns between agents
β
Workflow orchestration through the root agent
β
Parallel execution of independent tasks
β
State management and conversation context
β
Error handling and graceful degradation
β
Proper testing and validation framework
β
Configuration management with environment variables
β
Comprehensive documentation and examples
β
ADK command support (adk web, adk run)
β
Extensible architecture for adding new capabilities