TravelBuddy is an intelligent, agent-based travel assistant powered by the LangGraph ReAct architecture. In addition to answering travel-related queries, this project features a real-time, transparent playback UI that allows developers to visualize the agent's internal reasoning, step-by-step state transitions, and tool-invocation sequences.
- LangGraph ReAct Core: A robust cyclic graph representing the agent's autonomous planning loop (
Start→Agent→Tools↺ →End). - Live Graph Visualization: An interactive, dynamic node network built with
vis.js. Nodes and edges glow and animate synchronously with the backend LLM execution stream. - Reasoning Timeline Player: A time-traveling developer log on the UI. The execution buffers via WebSockets, allowing the user to precisely Pause, Play, Step Next, or Step Back through the LLM's thought process.
- Context Streaming: A modern
FastAPIinstance managing WebSocket connections, streaming LangGraph states rapidly to the frontend without blocking.
- Agent (
agent.py) & Tools (tools.py): Defines a conditional graph workflow. Depending on the query, theAgentnode analyzes intent and routes either to theToolsnode (for functions likesearch_flights,search_hotels,calculate_budget) or theEndnode. - Backend Engine (
server.py): A lightweightFastAPIserver. It captures LangGraph execution viagraph.stream(), broadcastsnode_executedupdates, and extracts detailed LLM reasoning (tool mapping, raw inferences) asynchronously. - Frontend Dashboard (
index.html): A stunning, dependency-free (via CDNs) single-page HTML interface combining Tailwind CSS, custom playback logic, andvis-network.
Make sure you have Python 3.9+ installed. Follow these steps to set up the environment:
# Install the required server and agent libraries
pip install fastapi uvicorn websockets langgraph langchain-openai python-dotenvYou will need your LLM provider API credentials. Ensure your .env file is properly configured. If you are using GitHub models context as written in agent.py:
GITHUB_TOKEN=your_github_personal_access_token_here- Start the FastAPI Server:
Navigate to the project directory and run:
python3 server.py
- Open the Dashboard: Visit http://localhost:8000 in your web browser.
- Query the Chatbot: Type a request requiring tools in the left panel (e.g., "Find flights from Da Nang to Ha Noi").
- Watch the Execution: Observe the center graph. The system will automatically execute and animate the workflow path on the graph.
- Engine Logs & Playback:
- Hit Pause to halt the visual rendering.
- Use the Next/Prev buttons (or your keyboard's Left/Right Arrow keys) to manually step through the timeline.
- Inspect the right-hand Engine Logs pane to read carefully formatted summaries of the exact tool definitions dispatched and processed.
.
├── agent.py # Core LangGraph execution definitions
├── tools.py # Functional external tool integrations
├── server.py # FastAPI websocket streaming orchestrator
├── index.html # Advanced 3-pane interactive frontend dashboard
├── .env # Environment variable injection
└── README.md # Project documentation
All required files and deliverables for this assignment have been organized into the /solution directory
Created for Lab 4 – LangGraph Agent Assignment