About LiveKit
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.
Why Use Moss with LiveKit
01
Context injection pattern: no LLM tool-calling step needed
Moss is queried automatically on every user turn.
02
Sub-10ms retrieval eliminates dead air
Results are injected before the LLM starts generating.
03
Works with LiveKit Agents framework
Using the `on_user_turn_completed` hook.
04
Combine with Deepgram STT, OpenAI LLM, and any TTS
Works with the full LiveKit ecosystem.
05
Pre-load your index at agent startup
load_index() for fastest queries.
Quick Start
from moss import MossClient, QueryOptions
from livekit.agents import Agent, RunContext, function_tool
KNOWLEDGE_INDEX = "product-knowledge"
class MossSemanticRetrievalAgent(Agent):
def __init__(self, moss_client: MossClient):
super().__init__(
instructions="""
You are a helpful customer support voice assistant.
When you need facts about products or policies, call
search_knowledge_base.
"""
)
self.moss = moss_client
@function_tool
async def search_knowledge_base(self, context: RunContext, query: str) -> str:
"""Search the product and support knowledge base."""
results = await self.moss.query(
KNOWLEDGE_INDEX, query, QueryOptions(top_k=5, alpha=0.8)
)
if not results.docs:
return "No relevant entries found."
return "\n".join(f"- {d.text}" for d in results.docs)Get Started in 3 Steps
01
Install the SDKs
Run pip install moss python-dotenv to add the Moss SDK. Pair it with LiveKit Agents in your voice worker.
02
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.
03
Add Moss as a function tool
Expose search_knowledge_base with @function_tool so the agent can query Moss during a turn. Load the index at worker startup for sub-10ms lookups.
Frequently asked questions
Ready to ship faster AI products?
Moss gives you production-ready semantic retrieval without infrastructure complexity.