โ† Back to Projects

Museum Booking Chatbot

Discover Indian museums, explore detailed information, and book tickets โ€” all through natural conversation with an AI agent.

LangGraph LLM Agent Ollama Flask Streamlit MySQL Python

๐ŸŽฌ Streamlit App Screen Recording

๐Ÿ“ฑ Chatbot Landing Interface

Museum Chatbot Landing Screen

๐Ÿ’ก The Problem

Tourists and locals wanting to visit Indian museums face fragmented information โ€” scattered across multiple websites with no unified way to search, compare, and book tickets. Museums need 24/7 booking capability but can't afford dedicated staff for every inquiry.

๐ŸŽฏ The Solution

A conversational AI agent that understands natural language queries about museums. Users can search by city or theme, get detailed info (timings, prices, facilities), and complete ticket bookings โ€” all within a single chat interface. The agent remembers context across turns, enabling natural multi-step workflows like search โ†’ details โ†’ book.

โšก Key Features

๐Ÿ”

Fuzzy-Matched Search

Typo-tolerant museum search using Python's difflib. Users can type "Kalkutta" and still find museums in Kolkata.

๐Ÿง 

Stateful LangGraph Agent

ReAct agent with MemorySaver checkpointing โ€” remembers the entire conversation context for multi-turn workflows.

๐ŸŽŸ๏ธ

End-to-End Booking

Search museums โ†’ get details โ†’ book tickets with automatic price calculation for adults and children.

โœ‚๏ธ

Context History Trimming

Intelligent message trimming keeps conversations within the LLM's 8192 token context window without losing critical context.

๐Ÿ†•

New Chat / Thread Support

Users can start fresh conversations with a new thread ID, keeping previous booking history intact while starting a clean chat.

โ™ฟ

Wheelchair Accessibility Filter

Dedicated search parameter for wheelchair-accessible museums, making the tool inclusive for all users.

๐Ÿ—๏ธ Architecture

๐Ÿ‘ค User Message Streamlit Chat UI
โ†’
๐Ÿง  LangGraph ReAct Agent qwen2.5(base) via Ollama
โ†’
๐Ÿ”ง Tool Selection Search / Details / Book
โ†’
๐Ÿ—„๏ธ MySQL Database Connection Pool

Agent & Tools (core/)

  • llm.py โ€” LangGraph ReAct agent with history trimming & checkpointing
  • tools.py โ€” Three LangChain tools: search_museums, get_museum_details, book_ticket
  • db.py โ€” MySQL connection pool for handling concurrent requests

Frontend & Entry Points

  • app.py โ€” Streamlit web UI with chat interface & new conversation button
  • terminal.py โ€” CLI entry point for terminal-based interaction

๐Ÿ’ฌ Interactive Conversation Walkthroughs

Step-by-step walkthroughs of the chatbot performing museum discovery, ticket booking, and error handling.

๐Ÿงฉ Agent Tools

search_museums_tool

Search museums by city name, theme, or keyword. Supports wheelchair accessibility filtering. Uses fuzzy matching to handle typos and partial names.

query needs_wheelchair

get_museum_details_tool

Retrieve complete information for a specific museum โ€” address, timings, prices, facilities, overview, and closed days.

museum_name city

book_ticket_tool

Book tickets for a specific museum, date, and party size. Automatically calculates total price based on adult and child counts.

museum_name city booking_date adult_count child_count

๐Ÿ› ๏ธ Tech Stack

LLM

qwen2.5 local via Ollama)

Agent Framework

LangGraph (ReAct + checkpointing)

Tool Bindings

LangChain

Frontend

Streamlit

Database

MySQL + Connection Pool

Fuzzy Matching

Python difflib

๐Ÿงฉ Challenges & Learnings

Preventing LLM Tool-Call Hallucinations

The qwen2.5 model would sometimes fabricate museum data instead of calling the database tools. Solved by refining the system prompt with strict instructions to always use tools for museum queries, and building an evaluation dataset to test accuracy across different query types.

Context Window Overflow in Long Conversations

Booking workflows can span 10+ messages, easily overflowing the 8192 token limit. Implemented trim_messages with start_on="human" to intelligently prune older messages while keeping the conversation coherent. Made the max history configurable via MAX_HISTORY_MESSAGES.

Handling User Typos in Museum Names

Users type museum names in many ways โ€” "indian museum", "Indian Musuem", "indain museum". Implemented fuzzy matching with Python's difflib to find the closest match and return relevant results even with significant spelling errors.