Skip to content

AI-powered, multi-agent travel planning system built in Python using a LangGraph-style architecture. It coordinates autonomous agents to generate personalized travel itineraries by combining user inputs with real-time data such as weather and points of interest, powered by LLMs like Google Gemini to automate multi-step travel planning decisions.

License

Notifications You must be signed in to change notification settings

92kareeem/Agentic-travel-planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌍 Agentic Travel Planner

A sophisticated multi-agent travel planning system built with LangGraph that orchestrates specialized AI agents to create personalized travel itineraries using real-time data.

🎯 Overview

This system uses a LangGraph-based multi-agent architecture where each agent specializes in a specific domain:

  • Planner Agent: Orchestrates the workflow using Gemini AI
  • Weather Agent: Fetches real-time weather data
  • POI Agent: Discovers points of interest
  • Itinerary Agent: Creates intelligent day-by-day plans
  • Formatter Agent: Presents results in a user-friendly format

πŸ—οΈ LangGraph Architecture

graph TD
    A[User Query] --> B[Input Handler]
    B --> C[Planner Agent]
    C --> D[Weather Agent]
    C --> E[POI Agent]
    D --> F[Itinerary Agent]
    E --> F
    F --> G[Formatter Agent]
    G --> H[Streamlit UI]
    
    style C fill:#e1f5fe
    style D fill:#f3e5f5
    style E fill:#e8f5e8
    style F fill:#fff3e0
    style G fill:#fce4ec
Loading

Agent Workflow

  1. Sequential Planning: Planner decides which tools to use
  2. Parallel Execution: Weather and POI agents run simultaneously
  3. State Management: Shared memory through LangGraph TypedDict
  4. Intelligent Synthesis: Itinerary agent combines all data sources
  5. User-Friendly Output: Formatted for optimal readability

πŸš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/92kareeem/agentic-travel-planner-syed-abdul-kareem.git
cd agentic-travel-planner-syed-abdul-kareem

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env with your API keys (see API Keys Setup section)

# Run the application
streamlit run app.py

Usage

  1. Open http://localhost:8502 in your browser
  2. Enter a travel request like: "Plan a 3-day trip to Tokyo starting 2025-11-01, focus on temples"
  3. Watch the LangGraph agents work in parallel!

πŸ”‘ API Keys Setup

Required APIs

  1. Google Gemini AI (Free tier available)

  2. OpenWeatherMap (Free: 1000 calls/day)

Recommended APIs

  1. OpenTripMap (Free: 1000+ requests/day)

  2. Serper (Free: 2500 searches)

Configuration

Copy .env.example to .env and add your keys:

GEMINI_API_KEY=your_gemini_key_here
OPENWEATHERMAP_API_KEY=your_weather_key_here
OPENTRIPMAP_API_KEY=your_opentripmap_key_here
SERPER_API_KEY=your_serper_key_here

πŸ“Š Example Runs

Input: "Plan a 3-day trip to Paris starting 2025-10-05, focus on museums"

LangGraph Execution Flow:

  1. Planner β†’ Decides: "Get weather + Find museum POIs"
  2. Weather Agent β†’ Fetches: "Clear sky, 16Β°C, no precipitation"
  3. POI Agent β†’ Finds: "Louvre, MusΓ©e d'Orsay, Centre Pompidou..."
  4. Itinerary Agent β†’ Plans: Smart daily schedules considering weather
  5. Formatter β†’ Outputs: Markdown table with timeline

Output:

**Weather**
- 2025-10-05: few clouds, 16.29Β°C, pop=0
- 2025-10-06: overcast clouds, 12.99Β°C, pop=0
- 2025-10-07: clear sky, 14.45Β°C, pop=0

**Points of Interest**
- Louvre Museum
- MusΓ©e d'Orsay
- Centre Pompidou
- MusΓ©e Rodin
- PanthΓ©on

**Itinerary**
| Day | Date | Morning | Afternoon | Evening |
|-----|------|---------|-----------|---------|
| 1 | 2025-10-05 | Louvre Museum | MusΓ©e d'Orsay | Seine River Walk |
| 2 | 2025-10-06 | Centre Pompidou | MusΓ©e Rodin | Montmartre District |
| 3 | 2025-10-07 | PanthΓ©on | Luxembourg Gardens | Farewell Dinner |

πŸ› οΈ Error Handling & Fallbacks

Graceful Degradation

  • API Failures: Automatic fallback to mock data
  • Invalid Cities: Intelligent geocoding with multiple attempts
  • Rate Limits: Exponential backoff retry logic
  • Missing Keys: Wikipedia fallback for POI data

Example Error Scenario

Input: "Plan trip to InvalidCityName123" System Response: Uses mock weather data + Wikipedia search, still generates useful itinerary

πŸ“ Project Structure

agentic-travel-planner/
β”œβ”€β”€ agents/                 # LangGraph agent nodes
β”‚   β”œβ”€β”€ planner.py         # Orchestration logic
β”‚   β”œβ”€β”€ weather_agent.py   # Weather data fetching
β”‚   β”œβ”€β”€ poi_agent.py       # Points of interest discovery
β”‚   β”œβ”€β”€ itinerary_agent.py # Itinerary generation
β”‚   └── formatter.py       # Output formatting
β”œβ”€β”€ utils/                 # Shared utilities
β”‚   β”œβ”€β”€ api_clients.py     # API integration layer
β”‚   β”œβ”€β”€ state.py          # LangGraph state schema
β”‚   └── logger.py         # Logging configuration
β”œβ”€β”€ docs/                 # Documentation
β”‚   └── design.md         # Detailed design document
β”œβ”€β”€ examples/             # Example outputs
β”œβ”€β”€ main.py              # LangGraph workflow orchestrator
β”œβ”€β”€ app.py               # Streamlit web interface
└── requirements.txt     # Dependencies

🎯 Key Features

  • πŸ”„ Parallel Processing: Weather and POI agents execute simultaneously
  • 🧠 Intelligent Planning: Gemini AI decides optimal agent workflows
  • πŸ“ Real-time Data: Live weather forecasts and POI information
  • πŸ›‘οΈ Robust Fallbacks: Graceful handling of API failures
  • 🎨 User-friendly UI: Clean Streamlit interface
  • ⚑ High Performance: LangGraph optimized execution

πŸ“ˆ Assumptions & Limitations

Assumptions

  • Users provide valid city names in English
  • Trip duration is reasonable (1-14 days)
  • Internet connectivity is available
  • API rate limits are respected

Current Limitations

  • English language only
  • Limited to city-based travel (no multi-city routes)
  • Weather forecasts limited to 5-day horizon
  • POI data quality depends on OpenTripMap coverage

Future Improvements

  • Multi-language support: Internationalization
  • Multi-city routes: Complex itinerary planning
  • Hotel integration: Accommodation recommendations
  • Transportation: Flight and train bookings
  • Budget optimization: Cost-aware planning
  • User preferences: Learning from past trips

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™‹β€β™‚οΈ Support

For questions or issues:


Built using LangGraph, Streamlit, and modern AI APIs

Overview

This project implements a LangGraph-style multi-agent travel planner. It uses Gemini (via google-generativeai) as the primary LLM to plan tool calls and create itineraries. Weather and POI agents fetch real-time data. The Streamlit UI provides a simple chat interface for interaction.

Features

  • Input parsing (city, dates, preferences)
  • Gemini-powered Planner and Itinerary nodes
  • Weather agent (OpenWeatherMap)
  • POI agent (Serper / Wikipedia fallback)
  • Simple LangGraph-like orchestrator (main.py)
  • Streamlit chat UI (app.py)
  • Robust error handling and mock fallbacks

Setup (VS Code)

  1. Clone or download this repository.
  2. Create a .env file from .env.example and fill your API keys.
  3. (Optional) create a virtualenv and install dependencies:
    python -m venv .venv
    source .venv/bin/activate  # or .venv\Scripts\activate on Windows
    pip install -r requirements.txt
  4. Run the Streamlit UI:
    streamlit run app.py

Notes & Error Handling

  • If Gemini is not configured or the client isn't installed, the planner will fall back to a deterministic mock planner.
  • If OpenWeatherMap or Serper calls fail, deterministic mock data is used and the UI will show messages indicating mock results.
  • The code is modular and intended to be replaced with langgraph nodes if you want to plug in the LangGraph library later.

Files

  • app.py: Streamlit UI and chat logic
  • main.py: Orchestrator that runs the LangGraph-like pipeline
  • agents/: agent implementations
  • utils/: API clients, schema validation & helpers
  • .env.example: example env vars

About

AI-powered, multi-agent travel planning system built in Python using a LangGraph-style architecture. It coordinates autonomous agents to generate personalized travel itineraries by combining user inputs with real-time data such as weather and points of interest, powered by LLMs like Google Gemini to automate multi-step travel planning decisions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages