Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stayline AI

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.

The Problem

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.

How It Works

Caller -> Twilio -> FastAPI WebSocket -> OpenAI Realtime API
                                  |                |
                                  +---- Google Sheets <----+
                                       customer, inventory, bookings
  1. Twilio streams the caller's audio to the FastAPI service.
  2. The orchestrator converts telephony audio and manages the real-time AI session.
  3. The agent uses tools to retrieve customer details, search hotels, and book a selected option.
  4. Google Sheets stores hotel inventory, booking status, and the call summary.

Key Capabilities

  • 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.

Engineering Highlights

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

Project Structure

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

Run Locally

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.txt

Copy .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.

Test the Agent Without a Phone Call

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.py

For 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."

Use Cases

  • 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.

Production Considerations

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.

Author

Ankit Kumar

About

AI voice agent for hotel booking calls.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages