An agentic AI travel planning application using Gemini LLM and CrewAI framework. This project demonstrates how AI agents collaborate to streamline the travel planning process - retrieving real-time flight and hotel data, analyzing options, and generating personalized itineraries.
This project demonstrates how to build a multi-agent system where specialized AI agents work together to create comprehensive travel plans. Instead of manually searching across multiple platforms, this application automates the process through intelligent AI collaboration.
The system leverages:
- Gemini 2.0 LLM: Powers the intelligence behind each agent
- CrewAI: Coordinates the multi-agent workflow
- SerpAPI: Retrieves real-time flight and hotel data
- FastAPI: Handles backend API endpoints
- Streamlit: Provides a user-friendly interface
- Retrieves real-time flight data from Google Flights via SerpAPI
- Filters flights based on price, layovers, and travel time
- AI recommends the best flight based on cost-effectiveness and convenience
- Searches real-time hotel availability from Google Hotels
- Filters based on location, budget, amenities, and user ratings
- AI suggests the best hotel by analyzing factors like proximity to key locations
- Gemini LLM-powered AI agent evaluates travel options
- Uses CrewAI to coordinate multiple AI agents for better decision-making
- AI explains its recommendation logic for flights and hotels
- AI builds a structured travel plan based on flight and hotel bookings
- Generates a day-by-day itinerary with must-visit attractions, restaurant recommendations, and local transportation options
- Streamlit provides an intuitive UI for inputting travel preferences
- Interactive tabs for viewing flights, hotels, and AI recommendations
- Downloadable formatted itinerary
This project is based on the article: Agentic AI: Building a Multi-Agent AI Travel Planner using Gemini LLM & Crew AI
- Python 3.8+
- SerpAPI key for fetching real-time flight and hotel data
- Google Gemini API key for AI recommendations
- Clone the repository
git clone https://github.com/arjunprabhulal/gemini-crewai-travelplanner.git
cd gemini-crewai-travelplanner
- Create and activate a virtual environment
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
- Install dependencies
pip install -r requirements.txt
- Configure API keys Set your API keys in the gemini2_travel_v2.py file:
# Load API Keys
GEMINI_API_KEY = os.getenv("GOOGLE_API_KEY", "your_gemini_api_key_here")
SERP_API_KEY = os.getenv("SERP_API_KEY", "your_serpapi_key_here")
- Get a Gemini API key from Google AI Studio
- Get a SerpAPI key from SerpAPI
- Start the FastAPI backend
python gemini2_travel_v2.py
- In a new terminal window, start the Streamlit frontend
python gemini2_travel_v2_frontend.py
-
Open your browser and navigate to http://localhost:8501
-
Enter your travel preferences:
- Input departure and destination airports
- Set travel dates
- Select search mode (complete, flights only, or hotels only)
- Click "Search" and wait for the AI to process your request
-
Review the personalized results:
- Flight options with AI recommendations
- Hotel options with AI recommendations
- Day-by-day itinerary with activities and restaurant suggestions
The application uses a collaborative AI system with specialized agents:
-
Flight Analyst Agent:
- Analyzes flight options based on price, duration, stops, and convenience
- Provides structured recommendations with reasoning
-
Hotel Analyst Agent:
- Evaluates hotel options based on price, rating, location, and amenities
- Offers detailed hotel recommendations with pros and cons
-
Travel Planner Agent:
- Creates comprehensive itineraries using flight and hotel information
- Schedules activities, meals, and transportation for each day of the trip
gemini2_travel_v2.py
: FastAPI backend application with API endpoints, data fetching, and AI agent coordinationgemini2_travel_v2_frontend.py
: Streamlit frontend interface for user interactionrequirements.txt
: Project dependenciesimages/
: Directory containing demonstration images and GIFstravelplanner.webp
: Static screenshot of the application interfacetravelplanner-demo.gif
: Animated demonstration of the application in use
The application follows a modular architecture:
-
API Initialization:
- FastAPI setup with endpoints for flight search, hotel search, and itinerary generation
-
Data Retrieval:
- Asynchronous functions connect to SerpAPI to fetch real-time flight and hotel data
- Response formatting and data validation using Pydantic models
-
AI Analysis:
- CrewAI orchestrates specialized AI agents
- Each agent analyzes specific aspects of the travel plan
- Gemini LLM powers the intelligence of each agent
-
Frontend Interface:
- Streamlit UI with interactive forms and tabs
- Real-time data display with filtering options
- Downloadable itinerary generation
This code is available on GitHub at arjunprabhulal/gemini-crewai-travelplanner.
For more articles on AI/ML and Generative AI, follow me on Medium: https://medium.com/@arjun-prabhulal