This directory contains examples demonstrating various capabilities and integrations with the LiveKit Agents framework.
Most examples use LiveKit Inference by default, which provides a unified API for accessing STT, LLM, and TTS models:
from livekit.agents import inference
session = AgentSession(
stt=inference.STT("deepgram/nova-3"),
llm=inference.LLM("google/gemma-4-31b-it"), # low-latency gemma, hosted on LiveKit
tts=inference.TTS("cartesia/sonic-3"),
)Note: Real-time voice-to-voice models (Amazon Nova Sonic, xAI Grok, etc.) are not supported by LiveKit Inference and must use the provider plugin directly.
basic_agent.py- A fundamental voice agent with multilingual STT, turn detection, preemptive generation, and metrics collection
Note: Real-time models use provider plugins directly. These examples require provider-specific API keys.
grok/- xAI Grok Voice Agents API with built-in X.com and web search
mcp/- Model Context Protocol (MCP) integration examplesmcp-agent.py- Connecting an agent to an MCP serverserver.py- MCP server example
llamaindex-rag/- RAG implementation with LlamaIndexchat_engine.py- Chat engine integrationquery_engine.py- Query engine used as a function toolretrieval.py- Document retrieval
otel_trace.py- OpenTelemetry (OTLP) integration for conversation tracing