GitHunt
AA

Aayushi-Shah/my-travel-agent

๐ŸŒ AI Travel Orchestrator
A "Self-Correcting" Agentic Workflow built with LangGraph & Gemini

๐Ÿ“– Project Overview
The AI Travel Orchestrator is not just a chatbot; it is an intelligent agent designed to plan travel itineraries based on real-world conditions. Unlike standard LLMs that hallucinate weather or suggest closed attractions, this system acts as a Controller, dynamically using tools to fetch live data before making decisions.

The Core Problem
Standard LLMs (like ChatGPT) have two major flaws when planning travel:

Static Knowledge: They don't know if it's raining right now in Tokyo.

Lack of Reasoning: They often suggest outdoor hikes during thunderstorms or museums that are permanently closed.

The Solution
We are building an Agentic Workflow that follows a "Reasoning Loop":

Observe: Check the user's request.

Investigate: Use tools to fetch context (Weather, Open Events).

Reason: Decide on activities based on context (e.g., IF rain THEN museum).

Critique (Coming Soon): Self-correct the plan before showing it to the user.

๐Ÿ— Architecture
The system uses a Router/Controller pattern powered by LangGraph.

The Stack
Brain (LLM): Google Gemini 1.5 Flash (via langchain-google-genai).

Orchestration: LangGraph (State management and cyclic flows).

Tools (The "Hands"):

๐ŸŒค Open-Meteo API: For real-time weather data (No API key required).

๐Ÿ”Ž Tavily Search API: For finding real-time events and places (optimized for AI).

Language: Python 3.10+.

Data Flow
Code snippet

graph TD
A[User Input] --> B{Router / Brain}
B -- "Need Context?" --> C[Tool Node]
C --> D[Weather API]
C --> E[Search API]
D & E --> F[Tool Output]
F --> B
B -- "Have Enough Info?" --> G[Evaluator / Critic]
G -- "Plan is Flawed" --> B
G -- "Plan is Good" --> H[Final Output]
๐Ÿš€ Features & Roadmap
โœ… Phase 1: The Core Logic (Completed)
[x] State Graph Setup: Implemented the basic Oracle -> Tool -> Oracle loop.

[x] Tool Integration: Successfully connected Gemini to external APIs.

[x] Conditional Routing: The agent can decide which tool to call based on the user's prompt.

[x] Real-World Data: Replaced mock data with real Open-Meteo and Tavily calls.

๐Ÿšง Phase 2: Reliability (Current Focus)
[ ] Self-Correction (The Evaluator): Add a node that reviews the itinerary. Example: Did I accidentally suggest a park when it's raining? If yes, rewrite.

[ ] Structured Output: Force the final answer into a clean JSON format (e.g., {"morning": "...", "afternoon": "..."}) instead of a text wall.

๐Ÿ”ฎ Phase 3: The User Experience (Next Up)
[ ] API Layer: Wrap the agent in a FastAPI backend.

[ ] Frontend: Build a minimalist UI (using Streamlit or Next.js) to render the JSON itinerary as a beautiful timeline card.

[ ] Map Integration: Visualize the locations on a map component.

๐Ÿ›  Setup & Usage
Prerequisites
Python 3.10+

Google AI Studio Key (Free)

Tavily API Key (Free)

Installation
Bash

Clone the repo

git clone https://github.com/yourusername/travel-agent.git
cd travel-agent

Create virtual environment

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

Install dependencies

pip install langchain-google-genai langgraph tavily-python requests
Running the Agent
Set your keys in terminal or .env:

Bash

export GOOGLE_API_KEY="your_key"
export TAVILY_API_KEY="your_key"
Run the script:

Bash

python agent_real.py
๐Ÿง  Technical Key Concepts Learned
Tool Calling: Mapping Python functions to LLM JSON schemas.

State Management: Using TypedDict and Annotated[list, add_messages] to maintain conversation history.

Cyclic Graphs: Understanding how Graph nodes can loop back on themselves until a condition is met.

What is next?
Now that the vision is locked in, our immediate next technical step is Phase 2: Structured Output & Self-Correction.

This will solve your problem of the output being "hard to read JSON" by forcing the agent to produce a clean, predictable format that our future Frontend can easily display.

Shall we implement the "Structured Output" logic so the agent returns clean JSON instead of text paragraphs?

Languages

Python100.0%

Contributors

Created February 12, 2026
Updated February 12, 2026
Aayushi-Shah/my-travel-agent | GitHunt