Capstone· 45 min
BookingAgent — Hotel Reservation Chatbot
What you'll learn
- ▸Run a LangChain agent with real tool calling and SQLite persistence
- ▸Test four different tool functions through natural language
- ▸See how the agent loop decides which tool to invoke
The BookingAgent is a real-world LangChain agent that manages hotel reservations through natural language. It uses SQLite for persistence and exposes four tools the model can call: check_availability, booking, cancel_booking, and enquiry_booking.
Architecture
- LangChain agent loop — decides which tool to call based on user input
- SQLite database (data/bookings.db) — stores rooms and reservations
- Four tool functions — each wraps a SQL query
- CLI chat interface — interactive back-and-forth with the agent
- Bonus: Streamlit web UI for a visual interface
Setup
From inside the BookingAgent/ folder:
$ cd BookingAgent
$ python3 -m venv .venv && source .venv/bin/activate
$ pip install -e ".[openai]"
Choose your provider
Install openai, anthropic, or google extras: pip install -e ".[anthropic]" or pip install -e ".[google]"
Create a .env file:
.env
OPENAI_API_KEY=sk-...
BOOKING_AGENT_MODEL_PROVIDER=openai
BOOKING_AGENT_MODEL_NAME=gpt-4o-mini
BOOKING_AGENT_TEMPERATURE=0.1
BOOKING_AGENT_SHOW_TOOL_CALLS=trueRun the CLI agent
$ booking-agent
Example prompts to try
- "Check availability for a deluxe room from 2026-04-10 to 2026-04-12 for 2 rooms"
- "Book 1 standard room for John Doe from 2026-05-01 to 2026-05-04, email john@example.com"
- "Cancel booking BK-ABC12345"
- "Check the status of booking BK-ABC12345"
Available tools
- check_availability — queries room availability by date range and type
- booking — reserves rooms with guest details and returns a booking ID
- cancel_booking — revokes a reservation by booking ID
- enquiry_booking — looks up booking status by ID
Bonus: Streamlit UI
$ streamlit run src/booking_agent/streamlit_app.py
Opens a web chat interface where you can type the same prompts and see tool calls visualised in real time.
What this project teaches
Agent loop, tool routing, database persistence, and multi-provider support — all patterns from Sessions 5 and 6 applied in a production-shaped project.