Skip to content

amanaiproduct/ai-trip-planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Trip Planner

A production-ready multi-agent system built for learning and customization. This repo demonstrates three essential AI engineering patterns that students can study, modify, and adapt for their own use cases.

What You'll Learn

  • πŸ€– Multi-Agent Orchestration: 4 specialized agents running in parallel using LangGraph
  • πŸ” RAG (Retrieval-Augmented Generation): Vector search over curated data with fallback strategies
  • 🌐 API Integration: Real-time web search with graceful degradation (LLM fallback)
  • πŸ“Š Observability: Production tracing with Arize for debugging and evaluation
  • πŸ› οΈ Composable Architecture: Easily adapt from "trip planner" to your own agent system

Perfect for: Students learning to build, evaluate, and deploy agentic AI systems.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         User Request                             β”‚
β”‚                    (destination, duration, interests)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   FastAPI Endpoint      β”‚
                    β”‚   + Session Tracking    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   LangGraph Workflow    β”‚
                    β”‚   (Parallel Execution)  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                        β”‚                        β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
   β”‚ Research β”‚           β”‚   Budget   β”‚         β”‚   Local    β”‚
   β”‚  Agent   β”‚           β”‚   Agent    β”‚         β”‚   Agent    β”‚
   β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
        β”‚                        β”‚                        β”‚
        β”‚ Tools:                 β”‚ Tools:                 β”‚ Tools + RAG:
        β”‚ β€’ essential_info       β”‚ β€’ budget_basics        β”‚ β€’ local_flavor
        β”‚ β€’ weather_brief        β”‚ β€’ attraction_prices    β”‚ β€’ hidden_gems
        β”‚ β€’ visa_brief           β”‚                        β”‚ β€’ Vector search
        β”‚                        β”‚                        β”‚   (90+ guides)
        β”‚                        β”‚                        β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                            β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
                            β”‚Itinerary β”‚
                            β”‚  Agent   β”‚
                            β”‚(Synthesis)β”‚
                            β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                                 β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Final Itinerary       β”‚
                    β”‚   + Tool Call Metadata  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

All agents, tools, and LLM calls β†’ Arize Observability Platform

Learning Paths

πŸŽ“ Beginner Path

  1. Setup & Run (15 min)

    • Clone repo, configure .env with OpenAI key
    • Start server: ./start.sh
    • Test API: python "test scripts/test_api.py"
  2. Observe & Understand (30 min)

    • Make a few trip planning requests
    • View traces in Arize dashboard
    • Understand agent execution flow and tool calls
  3. Experiment with Prompts (30 min)

    • Modify agent prompts in backend/main.py
    • Change tool descriptions
    • See how it affects outputs

πŸš€ Intermediate Path

  1. Enable Advanced Features (20 min)

    • Set ENABLE_RAG=1 to use vector search
    • Add TAVILY_API_KEY for real-time web search
    • Compare results with/without these features
  2. Add Custom Data (45 min)

    • Add your own city to backend/data/local_guides.json
    • Test RAG retrieval with your data
    • Understand fallback strategies
  3. Create a New Tool (1 hour)

    • Add a new tool (e.g., restaurant_finder)
    • Integrate it into an agent
    • Test and trace the new tool calls

πŸ’ͺ Advanced Path

  1. Change the Domain (2-3 hours)

    • Use Cursor AI to help transform the system
    • Example: Change from "trip planner" to "PRD generator"
    • Modify state, agents, and tools for your use case
  2. Add a New Agent (2 hours)

    • Create a 5th agent (e.g., "activities planner")
    • Update the LangGraph workflow
    • Test parallel vs sequential execution
  3. Implement Evaluations (2 hours)

    • Use test scripts/synthetic_data_gen.py as a base
    • Create evaluation criteria for your domain
    • Set up automated evals in Arize

Common Use Cases (Built by Students)

Students have successfully adapted this codebase for:

  • πŸ“ PR Description Generator

    • Agents: Code Analyzer, Context Gatherer, Description Writer
    • Replaces travel tools with GitHub API calls
    • Used by tech leads to auto-generate PR descriptions
  • 🎯 Customer Support Analyst

    • Agents: Ticket Classifier, Knowledge Base Search, Response Generator
    • RAG over support docs instead of local guides
    • Routes tickets and drafts responses
  • πŸ”¬ Research Assistant

    • Agents: Web Searcher, Academic Search, Citation Manager, Synthesizer
    • Web search for papers + RAG over personal library
    • Generates research summaries with citations
  • πŸ“± Content Planning System

    • Agents: SEO Researcher, Social Media Planner, Blog Scheduler
    • Tools for keyword research, trend analysis
    • Creates cross-platform content calendars
  • πŸ—οΈ Architecture Review Agent

    • Agents: Code Scanner, Pattern Detector, Best Practices Checker
    • RAG over architecture docs
    • Reviews PRs for architectural concerns

πŸ’‘ Your Turn: Use Cursor AI to help you adapt this system for your domain!

Quickstart

  1. Requirements
  • Python 3.10+ (Docker optional)
  1. Configure environment
  • Copy backend/.env.example to backend/.env.
  • Set one LLM key: OPENAI_API_KEY=... or OPENROUTER_API_KEY=....
  • Optional: ARIZE_SPACE_ID and ARIZE_API_KEY for tracing.
  1. Install dependencies
cd backend
uv pip install -r requirements.txt   # faster, deterministic installs
# If uv is not installed: curl -LsSf https://astral.sh/uv/install.sh | sh
# Fallback: pip install -r requirements.txt
  1. Run
# make sure you are back in the root directory of ai-trip-planner
cd ..
./start.sh                      # starts backend on 8000; serves minimal UI at '/'
# or
cd backend && uvicorn main:app --host 0.0.0.0 --port 8000 --reload
  1. Open

Docker (optional)

docker-compose up --build

Project Structure

  • backend/: FastAPI app (main.py), LangGraph agents, tracing hooks.
  • frontend/index.html: Minimal static UI served by backend at /.
  • optional/airtable/: Airtable integration (optional, not on critical path).
  • test scripts/: test_api.py, synthetic_data_gen.py for quick checks/evals.
  • Root: start.sh, docker-compose.yml, README.md.

Development Commands

  • Backend (dev): uvicorn main:app --host 0.0.0.0 --port 8000 --reload
  • API smoke test: python "test scripts"/test_api.py
  • Synthetic evals: python "test scripts"/synthetic_data_gen.py --base-url http://localhost:8000 --count 12

API

  • POST /plan-trip β†’ returns a generated itinerary. Example body:
    {"destination":"Tokyo, Japan","duration":"7 days","budget":"$2000","interests":"food, culture"}
  • GET /health β†’ simple status.

Notes on Tracing (Optional)

  • If ARIZE_SPACE_ID and ARIZE_API_KEY are set, OpenInference exports spans for agents/tools/LLM calls. View at https://app.arize.com.

Optional Features

RAG: Vector Search for Local Guides

The local agent can use vector search to retrieve curated local experiences from a database of 90+ real-world recommendations:

  • Enable: Set ENABLE_RAG=1 in your .env file
  • Requirements: Requires OPENAI_API_KEY for embeddings
  • Data: Uses curated experiences from backend/data/local_guides.json
  • Benefits: Provides grounded, cited recommendations with sources
  • Learning: Great example of production RAG patterns with fallback strategies

When disabled (default), the local agent uses LLM-generated responses.

See RAG.md for detailed documentation.

Web Search: Real-Time Tool Data

Tools can call real web search APIs (Tavily or SerpAPI) for up-to-date travel information:

  • Enable: Add TAVILY_API_KEY or SERPAPI_API_KEY to your .env file
  • Benefits: Real-time data for weather, attractions, prices, customs, etc.
  • Fallback: Without API keys, tools automatically fall back to LLM-generated responses
  • Learning: Demonstrates graceful degradation and multi-tier fallback patterns

Recommended: Tavily (free tier: 1000 searches/month) - https://tavily.com

Next Steps

  1. 🎯 Start Simple: Get it running, make some requests, view traces
  2. πŸ” Explore Code: Read through backend/main.py to understand patterns
  3. πŸ› οΈ Modify Prompts: Change agent behaviors to see what happens
  4. πŸš€ Enable Features: Try RAG and web search
  5. πŸ’‘ Build Your Own: Use Cursor to transform it into your agent system

Troubleshooting

  • 401/empty results: Verify OPENAI_API_KEY or OPENROUTER_API_KEY in backend/.env
  • No traces: Ensure Arize credentials are set and reachable
  • Port conflicts: Stop existing services on 3000/8000 or change ports
  • RAG not working: Check ENABLE_RAG=1 and OPENAI_API_KEY are both set
  • Slow responses: Web search APIs may timeout; LLM fallback will handle it

Deploy on Render

  • This repo includes render.yaml. Connect your GitHub repo in Render and deploy as a Web Service.
  • Render will run: pip install -r backend/requirements.txt and uvicorn main:app --host 0.0.0.0 --port $PORT.
  • Set OPENAI_API_KEY (or OPENROUTER_API_KEY) and optional Arize vars in the Render dashboard.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors