
In the current era of Generative AI, large language models (LLMs) are celebrated for their creativity and reasoning capabilities. However, when tasked with strict constraints—such as planning a trip within a specific budget—they often fail. Users frequently encounter "hallucinations" in which the AI suggests hotels that don't exist, miscalculates total costs, or ignores distance constraints entirely. This limitation inspired the creation of TravelGraph, a neuro-symbolic multi-agent system powered by LangGraph and Groq.
The primary purpose of this work is to demonstrate how to build reliable autonomous agents by combining the reasoning power of LLMs with the deterministic precision of code. Unlike standard chatbots that try to do everything via text generation, TravelGraph orchestrates a team of specialised agents: a "Scout" for creative search, and strict "Budget" and "Planner" officers powered by pure Python logic. This hybrid approach ensures that, while the search process remains flexible and creative, cost and logistics validation remain mathematically accurate.
Through this project, readers will gain a practical understanding of "Neuro-Symbolic" architecture, cyclic state graphs, and Human-in-the-Loop (HITL) patterns. The work demonstrates how to transform fragile AI demos into robust engineering systems that can negotiate, self-correct, and handle real-world data without hallucinating.
Planning a travel itinerary involves a complex interplay of conflicting constraints: location, quality, and cost. Relying solely on pure LLMs (such as ChatGPT) to handle this poses several engineering challenges. First, LLMs are probabilistic, meaning they cannot guarantee mathematical accuracy; they often state that "
This project introduces TravelGraph, a system that treats travel planning as a negotiation rather than a generation task. The process begins with the Scout Agent (powered by Llama 3 on Groq), which interprets the user's destination and uses the Tavily API to fetch real-time hotel data. Crucially, the Scout uses a robust Regex-based extraction method to parse messy web text into clean JSON.
Once a proposal is made, it is passed to the Budget Officer and Planner Agent. Unlike the Scout, these agents do not use LLMs. Instead, they utilise deterministic Python functions to calculate total trip costs (including food and taxes) and verify geolocation constraints. If a proposal violates a rule (e.g., "Too expensive"), the system does not crash; it loops back to the Scout with specific feedback. The Scout then uses this feedback to pivot its strategy—for example, switching from searching "Luxury" hotels to "Budget" options—mimicking human problem-solving.
A common approach to building agents is to let a single powerful LLM (like GPT-4) handle all reasoning, math, and tool calling. However, in this project, a "Pure LLM" approach exhibited significant latency and reliability issues. LLMs are comparatively slow and costly when performing simple arithmetic, and they are prone to subtle calculation errors. To overcome these limitations, a Neuro-Symbolic architecture was adopted. This method assigns "Neuro" tasks (unstructured search, strategy) to the LLM and "Symbolic" tasks (math, distance checks) to Python code. This switch drastically reduced latency (as code executes in microseconds) and guaranteed 0% hallucination rates on budget calculations. It provides a stable foundation where the AI can be creative, while code ensures it remains correct.
The system is designed around a State Graph using the LangGraph framework. A shared state object (AgentState) circulates between nodes, carrying the conversation history, the current proposal, and the negotiation status.
APPROVED. If it failed, the state is marked REJECTED with a specific reason appended.retry_count. If retries exceed a threshold, the graph pauses execution. It triggers a "Human Intervention" event in the Streamlit UI, allowing the user to force-approve a plan or stop the process.To evaluate the efficiency and reliability of the TravelGraph system, several stress tests were conducted to focus on error handling and negotiation logic.
Follow these steps to run the project locally.
1. Clone the Repository
git clone https://github.com/your-username/travel-negotiator.git cd travel-negotiator
2. Install Dependencies
pip install -r requirements.txt
3. Set Environment Variables
Create a .env file in the project root and add your API keys:
GROQ_API_KEY=gsk_... TAVILY_API_KEY=tvly-...
4. Run the Interface
Launch the Streamlit web app:
streamlit run frontend.py
5. Start a Negotiation
Enter your destination and budget. You will see the agents debate in real-time:
.png?Expires=1765590275&Key-Pair-Id=K2V2TN6YBJQHTG&Signature=y-qt-Yi4B1wzpcomIoVl9kFdeUyFSnyyEE2ZfdI9~9mENaehmaRkunBQ09N9i39UCqMOOe-CccdZWrI23mnb1uRW4FPJJx~V~~CERku87qb92jVsSvIVI8ytDLtqxH4oUz64lrDwQBUDnE9cwG-LR7yFNIqEaPmjCDGo23c0f8USzfDO0Zwci-mvb4PoWL-50LbD5qaSFd29-WEO5qRQpCrGeY7D5xGL1SDqVBYJbIcJE6HGPtz8mSk9NT5bC6yGsvhsD8rAwXJ6uubl6K~F6ZH6ioNpdsnjI32PPdldf6M43jAKmabOL4IG~HI9WhyQXiPKrkb6F2BLXWNkc5kHbQ__)
The main advantage of this project is the reliability gained by decoupling reasoning from calculation. By using a neuro-symbolic approach, TravelGraph ensures that financial and logistical constraints are enforced by rigid code, eliminating the risk of costly hallucinations. The integration of Tavily ensures that all data is real-time, preventing LLMs from recommending closed businesses or outdated prices. Furthermore, the Human-in-the-Loop architecture provides a safety net, ensuring the system never gets stuck in an infinite loop without user oversight. The Streamlit UI wraps this complexity in a user-friendly, universal-theme interface that makes the internal negotiation transparent and engaging.
While the current implementation offers a robust framework for travel negotiation, there are several directions for improvement. Integrating the Google Maps API would provide precise travel time calculations rather than the current proxy logic. Expanding the toolset to include flight search APIs (like Amadeus or Skyscanner) would turn this into a full-stack travel booking agent. Additionally, deploying the application to Streamlit Cloud with a persistent database would allow users to save and share their negotiated itineraries. Finally, fine-tuning a smaller Llama 3 model specifically for JSON extraction could further reduce latency and API costs.
This project showcases the potential of LangGraph and Neuro-Symbolic AI to transform how we build autonomous agents. By acknowledging LLMs' limitations and supporting them with deterministic code and human oversight, TravelGraph delivers a planning experience that is both creative and trustworthy. The adoption of a cyclic graph architecture enabled sophisticated self-correction behaviours that linear chains cannot match. Ultimately, this work provides a practical blueprint for engineers looking to build agents that must operate within the strict constraints of the real world.