๐Ÿš€ Smart Trip Planner Using Agentic Workflows with LangGraph and LangChain

A hands-on AI project to explore real-time travel planning using LLMs and agentic workflow orchestration.

1. ๐Ÿง  Problem Statement

Planning a trip involves juggling multiple information sources โ€” places to visit, local events, weather, accommodation, and more. The process is time-consuming, fragmented, and overwhelming for many users.

What if AI could understand your trip needs and do all this planning for you โ€” instantly and smartly?

2. ๐ŸŽฏ Project Purpose & My Vision

While this is an AI-powered smart travel planner, my real motivation is to learn by building. I wanted to explore the agentic AI workflow concept using modern frameworks like LangGraph, and stitch together real-time data sources to see how practical, personalized trip plans can be generated. The core of this project is built around the React Agent pattern, enabling the AI to reason and act iteratively by deciding which tools to call and when.

3. ๐Ÿงฐ Tech Stack Used

  • Framework: LangGraph for agent orchestration (ReAct

  • LLM: OpenAI (GPT-4 via LangChain)

  • Chaining/Tooling: LangChain for tool integration and structured chaining

  • Validation: Pydantic for Schema-enforced parsing of model outputs

  • Real-time APIs: Tavily SearchTool, Weather API via LangChain tool

  • UI: Streamlit (forms, response viewer)

4. ๐Ÿ— Architecture Diagram

The core of this project is built around the React Agent pattern, enabling the AI to reason and act iteratively by deciding which tools to call and when.

โœจ This LangGraph-based workflow lets LLM-driven steps dynamically choose tools, loop if needed, and merge information into a final plan.

5. ๐Ÿ” Step-by-step Flow

  • User Input via Streamlit: Source, destination, date range, lodging preference, commute mode

  • Trip Attractions Node: Uses LLM + tools like Tavily to gather attractions, activities and events

  • AttractionTools: Tools related to Trip Attraction node

  • Analyze_Weather Node: Gets real-time weather info for travel dates using PyOWM, a client Python wrapper library for OpenWeatherMap (OWM) web API

  • Weather_tools: Tool related to Analyze_Weather Node

  • Finalize Plan: Combines everything using a Pydantic schema to produce a structured itinerary

  • Output: Displayed in Streamlit as a well-organized trip suggestion

6. ๐ŸŽฌ Demo: Smart Trip Planner in Action

Demo Video

7. ๐Ÿ”‘ Key Code Snippets

๐Ÿค– Route LLM Tool Decisions

def route_from_attraction_llm(state: MessagesState) -> str:
    last = state["messages"][-1]
    print(f'route from attaraction llm: {last}, {last.additional_kwargs}')

    if isinstance(last, AIMessage) and "tool_calls" in last.additional_kwargs:
        return "attraction_tools"
    else:
        return "Analyze_Weather"

๐Ÿ“ฆ Final Planner Pydantic Model

class FinalPlanner(BaseModel):
    attactions_activities: Optional[str]=Field(description="Important attractions & key activities in the requested destination")
    lodging_choices: Optional[str]=Field(description="Available lodging options to stay if requested by the customer")
    local_transport: Optional[str]=Field(description="Possible local transportation options available to commute within the city")
    weather_details: Optional[str]=Field(description="Suggestions based on the weather during the stay. 2 lines about points to pay attention")
    itenary  s      : Optional[str]=Field(description="Day to day itenary plan with bulleted points based on attactions & activies")

๐Ÿ› ๏ธ Each module is cleanly separated โ€” llm.py, nodes.py, tools.py, and graph.py

8. ๐Ÿ˜… Challenges & Fixes

  • Issues like AIMessage serialization errors

  • Pydantic validation failures when LLM output structure mismatched

  • Debugging LangGraph routing

  • Handling tool loopbacks

9. ๐Ÿ”ฎ Scope of Improvement

  • โœ… Parallel Execution: Allow simultaneous weather and attraction analysis

  • โœ… More Tools: Add cost estimator, forex conversion etc.

  • โ˜๏ธ Cloud Deployment

10. ๐Ÿ“ฃ Call to Action

Thanks for reading! ๐Ÿ™Œ If you found this project insightful:

0
Subscribe to my newsletter

Read articles from Sundar Nallalagappan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sundar Nallalagappan
Sundar Nallalagappan