2.0 KiB
2.0 KiB
Voice Agents Examples
This directory contains examples demonstrating various capabilities and integrations with the LiveKit Agents framework.
Model Configuration
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("openai/gpt-4.1-mini"),
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.
Table of Contents
Getting Started
basic_agent.py- A fundamental voice agent with multilingual STT, turn detection, preemptive generation, and metrics collection
Real-time Models
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 & External Integrations
mcp/- Model Context Protocol (MCP) integration examplesmcp-agent.py- Connecting an agent to an MCP serverserver.py- MCP server example
RAG & Knowledge Management
llamaindex-rag/- RAG implementation with LlamaIndexchat_engine.py- Chat engine integrationquery_engine.py- Query engine used as a function toolretrieval.py- Document retrieval
Tracing & Error Handling
otel_trace.py- OpenTelemetry (OTLP) integration for conversation tracing