Skip to main content
Integrate Moss Semantic Search SDK directly into a LiveKit Voice Agent. This setup allows your voice AI to perform ultra-low latency searches over your custom data to answer user questions in real-time. It pairs a persistent knowledge base with a per-call session that indexes the conversation as it happens.

Why Use Moss with LiveKit?

Moss delivers sub-10ms semantic retrieval, ensuring your voice agents respond naturally without noticeable delays. A session gives each call its own local index, so the agent can recall what was said earlier in the conversation with no cloud round trip.

Required Tools

Integration Guide

1

Installation

Install the Moss SDK.
2

Environment Setup

Create a .env file in your project root directory with your API keys.File: .env
3

Creating the Knowledge Base with Moss

Before the agent can answer questions, build the long-term knowledge base. Run this script once to upload your documents to Moss as a cloud index.File: build_index.py
Run the builder:
4

Building the Agent

This agent exposes Moss search as function tools. The LLM decides when to call them during a turn, reads the results, and uses them to answer, so it can search, refine, or skip retrieval on turns that don’t need it.Two tools are registered:
  • search_knowledge_base queries the persistent knowledge base you built above (long-term context).
  • search_conversation queries this call’s session (short-term context) to recall something said earlier.
Each user turn is also recorded into the session, and the session is pushed to the cloud when the call ends, so the conversation can be resumed or handed to another agent later.File: agent.py
The session indexes each turn locally during the call and pushes to the cloud at the end, so a later session opened with the same name resumes the conversation, which is the basis for cross-agent handoff. See Sessions for the full API.
5

Running the Agent

First, start the LiveKit server in development mode:
Then, in a separate terminal, start your worker. The necessary VAD models will handle themselves or be downloaded automatically if needed by the plugin.