Files

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 examples

RAG & Knowledge Management

Tracing & Error Handling

  • otel_trace.py - OpenTelemetry (OTLP) integration for conversation tracing

Additional Resources