Voice Platform
Moss + LiveKit: Real-Time Search for Voice Agents
LiveKit provides real-time audio and video infrastructure for voice agents. Moss integrates using a context injection pattern: on every user turn, Moss is queried automatically and results are injected into the chat context before the LLM generates a response. No tool-calling overhead, no dead air.
Benefits
Why Use Moss with LiveKit
Context injection pattern: Moss is queried automatically on every user turn, no LLM tool-calling step needed
Sub-10ms retrieval eliminates dead air - results are injected before the LLM starts generating
Works with LiveKit Agents framework using the on_user_turn_completed hook
Combine with Deepgram STT, OpenAI LLM, and any TTS provider in the LiveKit ecosystem
Pre-load your index at agent startup with load_index() for fastest queries
Integration
Quick Start
from moss import MossClient, QueryOptions
from livekit.agents import Agent, AgentSession, ChatContext, ChatMessage
class MossVoiceAgent(Agent):
def __init__(self, moss_client: MossClient):
super().__init__(instructions="You are a helpful assistant.")
self.moss = moss_client
async def on_user_turn_completed(
self, turn_ctx: ChatContext, new_message: ChatMessage
) -> None:
# Automatic search on every user turn
results = await self.moss.query(
"knowledge-base", new_message.text_content,
QueryOptions(top_k=5, alpha=0.8)
)
# Inject context before LLM generates
if results.docs:
context = "\n".join([d.text for d in results.docs])
turn_ctx.add_message(role="system", content=context)
await super().on_user_turn_completed(turn_ctx, new_message)Setup
Get Started in 3 Steps
Install the SDKs
Run pip install moss livekit-agents livekit-plugins-openai livekit-plugins-deepgram to set up your environment.
Create and load your index
Use client.create_index() to index your knowledge base (FAQs, product docs, etc.), then call load_index() at agent startup for sub-10ms queries.
Extend Agent with context injection
Override on_user_turn_completed() to query Moss and inject results into the chat context. The LLM always has relevant context without needing to decide when to search.
FAQ
Frequently asked questions
Explore