Skip to main content

Problem

Voice agents need real-time retrieval to answer with fresh, contextual knowledge.

Architecture

  • LiveKit voice pipeline
  • Moss index for fast retrieval (sub-10 ms)
  • Fetch top-k -> rerank -> respond via LiveKit
LiveKit provides the real-time audio pipeline (STT/LLM/TTS); Moss supplies fast retrieval. See LiveKit voice AI quickstart.

Prerequisites

  • Python 3.8+
  • LiveKit credentials (LIVEKIT_API_KEY, LIVEKIT_API_SECRET, LIVEKIT_URL)
  • Moss credentials (MOSS_PROJECT_ID, MOSS_PROJECT_KEY) and an existing index (MOSS_INDEX_NAME, e.g., FAQs)
  • OpenAI API key (OPENAI_API_KEY)
  • Deepgram API key (DEEPGRAM_API_KEY)
  • Cartesia API key (CARTESIA_API_KEY)

Run the sample (Python)

Using the LiveKit voice agent sample in moss-samples:
  1. Install deps:
git clone https://github.com/usemoss/moss-samples.git
cd moss-samples/livekit-moss-vercel/livekit-voice-agent/livekit-moss-agent
pip install -r requirements.txt
  1. Create .env.local with your keys:
MOSS_PROJECT_ID=your_project_id
MOSS_PROJECT_KEY=your_project_key
MOSS_INDEX_NAME=faqs
LIVEKIT_API_KEY=...
LIVEKIT_API_SECRET=...
LIVEKIT_URL=...
OPENAI_API_KEY=...
DEEPGRAM_API_KEY=...
CARTESIA_API_KEY=...
  1. Ensure the Moss index exists (e.g., create faqs using the Quickstart sample data).
  2. Run the agent:
python agent.py
The agent:
  • Connects to LiveKit Agents
  • Loads the Moss index on start
  • Uses search_support_faqs to ground answers from Moss
  • Streams responses via LiveKit TTS

Outcome

Voice agents answer with sub-10 ms retrieval and live audio response.