Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✈️ Travel-Agent — AI-Powered Multi-Agent Trip Planner

Travel-Agent is a multi-agent travel planning system built with LangGraph, FastAPI, and Groq. It takes a single natural-language request (e.g. "Plan a 7 day Japan trip from Bangladesh under 2 lakhs") and orchestrates a pipeline of specialized agents to fetch live flight data, search for hotels, build a day-by-day itinerary, and generate a polished final travel plan — complete with conversation memory and PDF export.

Live demo: https://travel-agent-vytt.onrender.com


✨ Features

  • Multi-agent pipeline (LangGraph StateGraph) — flight agent → hotel agent → itinerary agent → final response agent
  • Live flight data via AviationStack, with natural-language route parsing (city/country/IATA → route)
  • Hotel & destination search via Tavily
  • LLM-generated itinerary and final plan via Groq (Llama 3.3 70B)
  • Persistent conversation memory — each trip planning session is checkpointed in PostgreSQL via langgraph-checkpoint-postgres, so follow-up messages retain context
  • Clean, responsive UI — glassmorphism design, markdown rendering, and one-click PDF export of the generated plan
  • Dockerized for easy deployment (currently deployed on Render)

🏗️ Architecture

User query
   │
   ▼
┌─────────────┐     ┌────────────┐     ┌──────────────────┐     ┌───────────────┐
│ Flight Agent│ ──▶ │ Hotel Agent│ ──▶ │ Itinerary Agent   │ ──▶ │ Final Agent   │
│ (AviationStack) │  (Tavily)    │     │ (Groq LLM)         │     │ (Groq LLM)     │
└─────────────┘     └────────────┘     └──────────────────┘     └───────────────┘
                                                                        │
                                                                        ▼
                                                              Final formatted plan
                                                          (Trip Summary, Flights, Hotels,
                                                           Itinerary, Budget, Recommendations)

State is shared across all four nodes via a typed TravelState, and the entire run is checkpointed to Postgres so a thread_id can be reused for multi-turn conversations.


🧰 Tech Stack

| Layer | Technology | |

|

| | Orchestration | LangGraph | | LLM | Groq (Llama 3.3 70B via langchain-groq ) | | Web search | Tavily | | Flight data | AviationStack | | Backend | FastAPI + Uvicorn | | Persistence | PostgreSQL (LangGraph checkpointer) | | Frontend | HTML / CSS / vanilla JS, Marked.js, html2pdf.js | | Deployment | Docker, Render |


📂 Project Structure

.
├── app.py                  # FastAPI app & routes
├── backend.py               # LangGraph graph, agents, and Postgres checkpointer
├── tools/
│   ├── flight_tool.py        # AviationStack integration + NL route parsing
│   └── tavily_tool.py        # Tavily search wrapper
├── templates/
│   └── index.html
├── static/
│   ├── script.js
│   └── style.css
├── requirements.txt
├── Dockerfile
└── .dockerignore

⚙️ Setup & Installation

1. Clone the repo

git clone https://github.com/<your-username>/travel-agent.git
cd travel-agent

2. Create a virtual environment

python -m venv myenv
source myenv/bin/activate   # Windows: myenv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment variables

Create a .env file in the project root:

GROQ_API_KEY=your_groq_api_key
TAVILY_API_KEY=your_tavily_api_key
AVIATION_API_KEY=your_aviationstack_api_key
DATABASE_URL=postgresql://user:password@host:port/dbname
DEFAULT_ORIGIN_IATA=DAC

| Variable | Required | Description | |

|

|

| | GROQ_API_KEY | ✅ | Groq API key for LLM calls | | TAVILY_API_KEY | ✅ | Tavily API key for hotel/web search | | AVIATION_API_KEY | ✅ | AviationStack API key for live flight data | | DATABASE_URL | ✅ | PostgreSQL connection string (Render, Supabase, Neon, etc.) | | DEFAULT_ORIGIN_IATA | ❌ | Fallback departure airport code if none is detected (default: DAC ) |

5. Run locally

uvicorn app:app --reload

Visit http://127.0.0.1:8000

6. Run with Docker

docker build -t travel-agent .
docker run -p 8000:8000 --env-file .env travel-agent

🔌 API Reference

POST /api/travel

Runs the full agent pipeline for a user query.

Request body:

{
  "message": "Plan a 5 day Dubai trip from Dhaka with flights and hotels.",
  "thread_id": null
}

Response:

{
  "success": true,
  "thread_id": "user_a1b2c3d4",
  "answer": "## Trip Summary\n...",
  "flight_results": "...",
  "hotel_results": "...",
  "itinerary": "...",
  "llm_calls": 3
}

Pass the returned thread_id on subsequent requests to continue the same conversation with memory.

GET /health

Basic health check endpoint ({"status": "ok"}).


⚠️ Known Limitations

  • AviationStack provides live/status flight data only, not ticket prices — budget figures in the itinerary are LLM-estimated, not real fares. For real pricing, integrate a fare API (e.g. Amadeus, Skyscanner).
  • Route/location parsing in flight_tool.py is regex/alias-based and may misparse unusual phrasing.
  • No authentication/rate limiting — intended as a demo/portfolio project, not production-hardened.

Future Improvements

  • Real-time fare pricing integration
  • Streaming agent progress to the frontend (SSE/WebSocket)
  • LLM-based location/intent extraction to replace regex parsing
  • Rate limiting & caching layer (Redis)
  • Automated tests + CI pipeline
  • User authentication & saved trip history

🧑‍💻 Author

Built with FastAPI, LangGraph, Groq, PostgreSQL, Tavily, and AviationStack.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages