AI voice agent for hotel booking calls.
Stayline AI turns a phone call into a live, inventory-aware hotel booking conversation. It uses Twilio Media Streams and the OpenAI Realtime API to understand callers, search hotel options, confirm a reservation, and record the result.
Travel and hospitality teams spend significant time handling repetitive booking calls. Stayline AI demonstrates how a voice agent can automate the discovery and booking workflow while remaining connected to real customer and hotel data.
Caller -> Twilio -> FastAPI WebSocket -> OpenAI Realtime API
| |
+---- Google Sheets <----+
customer, inventory, bookings
- Twilio streams the caller's audio to the FastAPI service.
- The orchestrator converts telephony audio and manages the real-time AI session.
- The agent uses tools to retrieve customer details, search hotels, and book a selected option.
- Google Sheets stores hotel inventory, booking status, and the call summary.
- Natural spoken hotel-search and booking conversations.
- Customer lookup and personalised greeting.
- Search by dates, San Francisco area, budget, rating, amenities, and guest count.
- Explicit confirmation before a booking is saved.
- Real-time interruption handling and bidirectional audio conversion.
- Guardrails: focused on San Francisco hotel bookings; does not request card details or passwords.
| Area | Implementation |
|---|---|
| Voice AI | OpenAI Realtime API (gpt-realtime) |
| Telephony | Twilio Voice and Media Streams |
| Backend | Python, FastAPI, Uvicorn, WebSockets |
| Audio | Twilio 8 kHz mu-law <-> OpenAI 24 kHz PCM16 conversion |
| Agent tools | Customer lookup, hotel search, and booking functions |
| Data | Google Sheets API with service-account authentication |
| Local integration | ngrok for public webhooks and media streams |
main.py # Webhooks and WebSocket endpoints
ai_engine/orchestrator.py # Twilio/OpenAI call coordination
ai_engine/prompts.py # Agent instructions and guardrails
services/openai_service.py # Realtime API client
services/google_sheets.py # Customer, hotel, and booking data
services/audio_utils.py # Audio format conversion
scripts/ # Tunnel, diagnostics, and outbound-call helpers
Requirements: Python 3.10+, OpenAI Realtime API access, a Twilio Voice number, and ngrok. Google Sheets is optional for development because the app provides mock data when Sheets credentials are absent.
git clone https://github.com/Ankit052003/Stayline-AI.git
cd Stayline AI
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txtCopy .env.example to .env and provide your Twilio, OpenAI, and ngrok credentials. For persistent data, also configure a Google service-account JSON file and Sheet ID.
# Terminal 1
python main.py
# Terminal 2
python scripts/start_ngrok.py
# Terminal 3
python scripts/initiate_call.py <customer-id-or-phone-number>The local health endpoint is http://127.0.0.1:8000/health.
With OPENAI_API_KEY set in .env, run a text-based agent test that uses mock hotel data and never changes external records:
python scripts/test_agent.pyFor a one-turn smoke test:
python scripts/test_agent.py --prompt "I need a Downtown San Francisco hotel from 2026-09-15 to 2026-09-17 under 250 dollars."- Travel agencies and hotel groups handling routine booking requests.
- Concierge services qualifying callers before a human handoff.
- Voice-AI prototypes requiring real-time tool use and live data access.
This is a development prototype. A production deployment should use a stable HTTPS endpoint, secure secret management, and a transactional reservation system instead of spreadsheet-based inventory.
Ankit Kumar