How uniabhi/ai-travel-planner works
Project Type and Purpose
• This is a full-stack travel planning application that leverages multiple AI agents to help users find flights, hotels, and generate detailed itineraries.
• The project uses FastAPI for the backend API and Streamlit for the user interface. Its AI functionality is powered by Google Gemini LLM and orchestrated via CrewAI, while external travel data is fetched using SerpAPI.
Analyzing the File Structure
• Top-level files indicate a simple structure with two main Python files:
• run_server.py – serves as the FastAPI backend.
• travel_app.py – handles the Streamlit-based frontend.
• Supporting files like requirements.txt, LICENSE, and README.md are present for dependency management and project documentation.
• The images directory contains UI screenshots that relate to what the user sees on the frontend.
Key Components in the Architecture
a. Frontend:
• Component: Streamlit UI (travel_app.py)
• Responsibilities: Provides an interactive interface where users can input travel details (flight search criteria, hotel preferences, itinerary requirements).
b. Backend:
• Component: FastAPI server (run_server.py)
• Responsibilities: Exposes API endpoints to process user requests. Key endpoints include:
• POST /search_flights/: To search flights and provide AI-based recommendations.
• POST /search_hotels/: To search hotels with intelligent filtering.
• POST /generate_itinerary/: To produce detailed travel itineraries.
c. AI Multi-Agent System:
• Components: AI agents orchestrated by CrewAI comprising:
• Flight Analyst Agent – analyzes flight options based on various parameters.
• Hotel Analyst Agent – evaluates hotel options.
• Travel Planner Agent – creates detailed daily itineraries.
• Responsibilities: Each agent uses Google Gemini LLM to process and provide recommendations, with CrewAI coordinating among them.
d. External Integrations and Data Sources:
• Google Gemini LLM: Powers the natural language capabilities of each AI agent.
• SerpAPI: Provides real-time data for travel options (flights, hotels).
Relationships and Data Flow
• The End User interacts with the Streamlit frontend.
• The frontend makes API calls to the FastAPI backend for processing requests.
• Upon receiving a request, the backend routes it to the appropriate AI agent via the CrewAI orchestration layer.
• AI agents call on external services:
• Google Gemini LLM for generating intelligent travel recommendations.
• SerpAPI to fetch up-to-date travel data.
• Processed results are then returned from the backend to be displayed on the frontend.
Architectural Patterns
• Separation of Concerns: Clear division between the UI (Streamlit) and backend (FastAPI) API layers.
• Microservices/Modular Design: Although all components are contained in a single repository, the backend logically orchestrates different AI agents as independently functioning modules.
• External Service Integration: The design emphasizes API-driven integration with third-party data providers and AI services.