### Run a LiveKit Agent Example Source: https://github.com/livekit/agents/blob/main/README.md Executes a specific agent example from the 'examples' directory in development mode, requiring an '.env' file with credentials. ```shell uv run examples/voice_agents/basic_agent.py dev ``` -------------------------------- ### Install livekit-plugins-keyframe Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-keyframe/README.md Install the Keyframe plugin using pip. ```bash pip install livekit-plugins-keyframe ``` -------------------------------- ### Install LiveKit Fish Audio Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-fishaudio/README.md Install the `livekit-plugins-fishaudio` package using pip. ```bash pip install livekit-plugins-fishaudio ``` -------------------------------- ### Run Respeecher TTS Example Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-respeecher/README.md Execute the provided example script to try out the Respeecher plugin. ```bash uv run python examples/other/text-to-speech/respeecher_tts.py start ``` -------------------------------- ### Install LiveKit Krisp Plugin and Krisp Audio SDK Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-krisp/README.md Install the LiveKit Krisp plugin via pip. Note that the proprietary `krisp-audio` SDK must be obtained and installed separately from Krisp. ```bash # Install the plugin pip install livekit-plugins-krisp # Install krisp-audio SDK separately (required for actual usage) ``` -------------------------------- ### Install LiveKit Resemble Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-resemble/README.md Install the LiveKit Resemble plugin using pip. ```bash pip install livekit-plugins-resemble ``` -------------------------------- ### Run Realtime Transcription Example Source: https://github.com/livekit/agents/blob/main/examples/other/transcription/README.md Set the necessary environment variables for LiveKit and OpenAI, then execute the Python script to start the realtime transcription agent. ```bash export LIVEKIT_URL=wss://yourhost.livekit.cloud export LIVEKIT_API_KEY=livekit-api-key export LIVEKIT_API_SECRET=your-api-secret export OPENAI_API_KEY=your-api-key python3 transcriber.py start ``` -------------------------------- ### Run LemonSlice Avatar Agent Locally Source: https://github.com/livekit/agents/blob/main/examples/avatar/README.md Install dependencies and start the agent locally. Ensure LiveKit and LemonSlice API keys are configured as environment variables before running. ```bash pip install -r requirements.txt python agent.py dev ``` -------------------------------- ### Install LiveKit AsyncAI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-asyncai/README.md Install the LiveKit AsyncAI plugin using pip. ```bash pip install livekit-plugins-asyncai ``` -------------------------------- ### Install LiveKit NVIDIA Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-nvidia/README.md Install the LiveKit NVIDIA plugin using pip. ```bash pip install livekit-plugins-nvidia ``` -------------------------------- ### Install ElevenLabs Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-elevenlabs/README.md Use pip to install the ElevenLabs plugin for LiveKit Agents. ```bash pip install livekit-plugins-elevenlabs ``` -------------------------------- ### Install LiveKit Camb.ai Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-cambai/README.md Install the LiveKit Camb.ai plugin using pip. ```bash pip install livekit-plugins-cambai ``` -------------------------------- ### Run the Phonic Realtime Agent Example Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-phonic/README.md Navigate to the examples directory and run the Phonic realtime agent in development mode using `uv`. ```bash cd examples uv run voice_agents/phonic_realtime_agent.py dev ``` -------------------------------- ### Install NLTK Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-nltk/README.md Install the LiveKit NLTK plugin using pip. ```bash pip install livekit-plugins-nltk ``` -------------------------------- ### Install LiveKit Simplismart Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-simplismart/README.md Use pip to install the Simplismart plugin for LiveKit Agents. ```bash pip install livekit-plugins-simplismart ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/livekit/agents/blob/main/AGENTS.md Installs all project dependencies, including development extras, using the uv package manager. ```bash make install # Install all dependencies with dev extras (uv sync --all-extras --dev) ``` -------------------------------- ### Install LiveKit Simli Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-simli/README.md Run this command to install the LiveKit Simli plugin using pip. ```bash pip install livekit-plugins-simli ``` -------------------------------- ### Run a LiveKit Agent Example from Console Source: https://github.com/livekit/agents/blob/main/examples/README.md Execute this command to run a specific LiveKit agent example, such as basic_agent.py, directly in the console. ```bash uv run examples/voice_agents/basic_agent.py console ``` -------------------------------- ### Install LiveKit Groq Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-groq/README.md Use this command to install the LiveKit Groq plugin and its dependencies via pip. ```bash pip install livekit-plugins-groq ``` -------------------------------- ### Install LiveKit Mistral AI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-mistralai/README.md Installs the core LiveKit plugin for Mistral AI services. ```bash pip install livekit-plugins-mistralai ``` -------------------------------- ### Install Anam Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-anam/README.md Install the Anam plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-anam ``` -------------------------------- ### Install LiveKit AWS Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-aws/README.md Install the core LiveKit AWS plugin or include the '[realtime]' extra for Nova Sonic models. ```bash pip install livekit-plugins-aws # For Nova Sonic realtime models pip install livekit-plugins-aws[realtime] ``` -------------------------------- ### Start LiveKit Avatar Dispatcher Server (Bash) Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/audio_wave/README.md Use this command to start the avatar dispatcher server. Optionally specify a port for the server to listen on. ```bash python examples/avatar/dispatcher.py [--port 8089] ``` -------------------------------- ### Install LiveKit Soniox Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-soniox/README.md Install the Soniox plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-soniox ``` -------------------------------- ### Install livekit-plugins-fal Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-fal/README.md Use pip to install the fal plugin for LiveKit Agents, enabling fal.ai integration. ```bash pip install livekit-plugins-fal ``` -------------------------------- ### Install LiveKit Baseten Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-baseten/README.md Install the LiveKit Baseten plugin using pip to enable Baseten model integrations. ```bash pip install livekit-plugins-baseten ``` -------------------------------- ### Install LiveKit Gladia Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-gladia/README.md Use pip to install the LiveKit Gladia plugin, which provides speech-to-text capabilities for LiveKit Agents. ```bash pip install livekit-plugins-gladia ``` -------------------------------- ### Install LiveKit Protoface Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-protoface/README.md Use pip to install the livekit-plugins-protoface package, enabling Protoface virtual avatar support for LiveKit Agents. ```bash pip install livekit-plugins-protoface ``` -------------------------------- ### Install LiveAvatar Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-liveavatar/README.md Use this command to install the LiveAvatar plugin for LiveKit Agents via pip. ```bash pip install livekit-plugins-liveavatar ``` -------------------------------- ### Download the realtime_joke_teller.py example script Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-aws/README.md Downloads the `realtime_joke_teller.py` example script from the LiveKit agents GitHub repository to your local machine. ```bash curl -O https://raw.githubusercontent.com/livekit/agents/main/examples/voice_agents/realtime_joke_teller.py ``` -------------------------------- ### Install LiveKit AssemblyAI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-assemblyai/README.md Use this command to install the LiveKit AssemblyAI plugin via pip. ```bash pip install livekit-plugins-assemblyai ``` -------------------------------- ### Install LiveKit Silero Plugin for Realtime STT Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-mistralai/README.md Installs the Silero plugin, a prerequisite for using Voxtral Realtime streaming STT. ```bash pip install livekit-plugins-silero ``` -------------------------------- ### Install LiveKit Smallest AI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-smallestai/README.md Use pip to install the LiveKit plugin for integrating Smallest AI functionalities into your project. ```bash pip install livekit-plugins-smallestai ``` -------------------------------- ### Install LiveKit MiniMax Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-minimax/README.md Use this command to install the MiniMax TTS plugin for LiveKit Agents via pip. ```bash pip install livekit-plugins-minimax-ai ``` -------------------------------- ### Install livekit-plugins-runway Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-runway/README.md Use pip to install the livekit-plugins-runway package, which provides the necessary components for Runway avatar integration. ```bash pip install livekit-plugins-runway ``` -------------------------------- ### Install LiveKit OpenAI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-openai/README.md Use this command to install the LiveKit OpenAI plugin and its dependencies via pip. ```bash pip install livekit-plugins-openai ``` -------------------------------- ### Start the Protoface Avatar Agent Worker Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/protoface/README.md Execute this command to start the LiveKit Protoface avatar agent worker in development mode. ```bash python examples/avatar_agents/protoface/agent_worker.py dev ``` -------------------------------- ### Install LiveKit Rime Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-rime/README.md Use pip to install the LiveKit Rime plugin, enabling voice synthesis capabilities for LiveKit Agents. ```bash pip install livekit-plugins-rime ``` -------------------------------- ### Start LiveKit Agent Worker (Bash) Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/audio_wave/README.md Execute this command to start the agent worker. Provide the URL for the avatar dispatcher's launch endpoint. ```bash python examples/avatar/agent_worker.py dev [--avatar-url http://localhost:8089/launch] ``` -------------------------------- ### Install LiveKit Azure Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-azure/README.md Use pip to install the `livekit-plugins-azure` package, which provides support for Azure AI services like Azure Speech. ```bash pip install livekit-plugins-azure ``` -------------------------------- ### Install Python dependencies for LiveKit AWS plugins Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-aws/README.md Installs required Python packages including LiveKit AWS plugins, jokeapi, duckduckgo-search, python-weather, and python-dotenv for the example. ```bash pip install livekit-plugins-aws[realtime] \ jokeapi \ duckduckgo-search \ python-weather \ python-dotenv ``` -------------------------------- ### Run Text-to-Speech Example with uv Source: https://github.com/livekit/agents/blob/main/examples/other/text-to-speech/README.md Execute a specific text-to-speech plugin example to connect to a LiveKit room and stream TTS audio. Replace `{your_plugin}` with the desired plugin name. ```bash uv run examples/other/text-to-speech/{your_plugin}_tts.py start ``` -------------------------------- ### Start Mock Bank IVR System Source: https://github.com/livekit/agents/blob/main/examples/telephony/bank-ivr/README.md Run this command in a terminal to start the simulated banking IVR system, which will wait for incoming calls. ```bash uv run python examples/bank-ivr/ivr_system_agent.py dev ``` -------------------------------- ### Install LiveKit server on macOS Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-aws/README.md Installs the LiveKit server using Homebrew on macOS, which is useful for local testing without LiveKit Cloud. ```bash brew install livekit # macOS ``` -------------------------------- ### Install LiveKit Hamming Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-hamming/README.md Install the LiveKit Hamming plugin from a local repository or extracted source archive using pip. ```bash python -m pip install ./livekit-plugins/livekit-plugins-hamming ``` -------------------------------- ### Install LiveKit Sarvam Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-sarvam/README.md Install the LiveKit Sarvam plugin using pip to enable Sarvam.ai integrations for LiveKit Agents. ```bash pip install livekit-plugins-sarvam ``` -------------------------------- ### Create a Simple Voice Assistant with LiveKit Ultravox Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-ultravox/README.md This example demonstrates how to initialize an AgentSession with RealtimeModel to create a basic voice assistant using Ultravox for speech-to-speech AI. ```python import asyncio from livekit.agents import Agent, AgentSession, JobContext, WorkerOptions, cli, inference from livekit.plugins.ultravox.realtime import RealtimeModel async def entrypoint(ctx: JobContext): await ctx.connect() session: AgentSession[None] = AgentSession( allow_interruptions=True, vad=inference.VAD(), llm=RealtimeModel( model_id="fixie-ai/ultravox", voice="Mark", ), ) await session.start( agent=Agent( instructions="You are a helpful voice assistant.", ), room=ctx.room, ) if __name__ == "__main__": cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint)) ``` -------------------------------- ### Complete LiveKit Voice Agent with Inworld STT and TTS Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-inworld/README.md A comprehensive example demonstrating a LiveKit voice agent that integrates Inworld for both speech-to-text and text-to-speech, including agent setup and session management. ```python import logging from dotenv import load_dotenv from livekit.agents import ( Agent, AgentServer, AgentSession, JobContext, cli, inference, metrics, room_io, ) from livekit.agents.inference import TurnDetector from livekit.plugins import inworld logger = logging.getLogger("inworld-agent") load_dotenv() class InworldAgent(Agent): def __init__(self) -> None: super().__init__( instructions=( "Your name is Nova. You interact with users via voice. " "Keep your responses concise and to the point. " "Do not use emojis, asterisks, markdown, or other special characters. " "You are helpful, curious, and friendly." ), ) async def on_enter(self): self.session.generate_reply() server = AgentServer() @server.rtc_session() async def entrypoint(ctx: JobContext): ctx.log_context_fields = {"room": ctx.room.name} session = AgentSession( stt=inworld.STT(model="inworld/inworld-stt-1"), llm="openai/gpt-4.1-mini", tts=inworld.TTS(voice="Clive"), turn_detection=TurnDetector(), vad=inference.VAD(), ) usage_collector = metrics.UsageCollector() @session.on("metrics_collected") def _on_metrics(ev): metrics.log_metrics(ev.metrics) usage_collector.collect(ev.metrics) async def log_usage(): logger.info(f"Usage: {usage_collector.get_summary()}") ctx.add_shutdown_callback(log_usage) await session.start( agent=InworldAgent(), room=ctx.room, room_options=room_io.RoomOptions(), ) if __name__ == "__main__": cli.run_app(server) ``` -------------------------------- ### Install SLNG Plugin for LiveKit Agents Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-slng/README.md Use pip to install the `livekit-plugins-slng` package, enabling SLNG integration with LiveKit Agents. ```bash pip install livekit-plugins-slng ``` -------------------------------- ### Install LiveKit Spitch Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-spitch/README.md Use pip to install the LiveKit Spitch plugin, which provides African-language voice AI services for LiveKit Agents. ```bash pip install livekit-plugins-spitch ``` -------------------------------- ### Initialize and Run a LiveKit Agent Session in Python Source: https://github.com/livekit/agents/blob/main/livekit-agents/README.md This snippet demonstrates how to set up and run a LiveKit Agent, connecting to a room, configuring an OpenAI real-time model, and initiating a conversation with initial instructions. ```python from dotenv import load_dotenv from livekit import agents from livekit.agents import AgentSession, Agent, RoomInputOptions from livekit.plugins import openai load_dotenv() async def entrypoint(ctx: agents.JobContext): await ctx.connect() session = AgentSession( llm=openai.realtime.RealtimeModel( voice="coral" ) ) await session.start( room=ctx.room, agent=Agent(instructions="You are a helpful voice AI assistant.") ) await session.generate_reply( instructions="Greet the user and offer your assistance." ) if __name__ == "__main__": agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint)) ``` -------------------------------- ### Install LiveKit LemonSlice Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-lemonslice/README.md Use pip to install the LiveKit LemonSlice plugin, enabling support for the LemonSlice virtual avatar. ```bash pip install livekit-plugins-lemonslice ``` -------------------------------- ### Initialize Fish Audio TTS with LiveKit Agent Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-fishaudio/README.md Demonstrates basic initialization of the Fish Audio TTS plugin within a LiveKit Agent session, using credentials from environment variables. ```python from livekit.agents import AgentSession from livekit.plugins import fishaudio # Basic usage with env-based credentials tts = fishaudio.TTS() session = AgentSession( tts=tts, # ... stt, llm, etc. ) ``` -------------------------------- ### Install LiveKit Ultravox Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-ultravox/README.md Use pip to install the LiveKit Ultravox plugin, enabling its features within your LiveKit Agents project. ```bash pip install livekit-plugins-ultravox ``` -------------------------------- ### Install LiveKit Uplift AI Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-upliftai/README.md Use pip to install the `livekit-plugins-upliftai` package, adding Uplift AI voice synthesis capabilities to LiveKit Agents. ```bash pip install livekit-plugins-upliftai ``` -------------------------------- ### Install LiveKit xAI Plugin with pip Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-xai/README.md Use pip to install the LiveKit xAI plugin, enabling integration with xAI's Grok services. ```bash pip install livekit-plugins-xai ``` -------------------------------- ### Using instructions for System-Level Commands Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-aws/README.md This example demonstrates using the `instructions` parameter with `generate_reply()` to send system-level commands to the model, triggering immediate generation without appearing in conversation history. ```python await session.generate_reply( instructions="Greet the user warmly and ask how you can help" ) ``` -------------------------------- ### Install LiveKit Browser Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-browser/README.md Use this command to install the LiveKit Browser plugin via pip. CEF binaries are downloaded automatically on first use. ```bash pip install livekit-plugins-browser ``` -------------------------------- ### Recommended Resemble TTS Usage with Async Context Manager Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-resemble/README.md This example demonstrates the recommended way to use the Resemble TTS plugin with an async context manager for automatic resource cleanup, including one-off and real-time streaming synthesis. ```python import asyncio from livekit.plugins.resemble import TTS async def run_tts_example(): # Use TTS with async context manager for automatic resource cleanup async with TTS( api_key="your_api_key", # or set RESEMBLE_API_KEY environment variable voice_uuid="your_voice_uuid", # Optional parameters sample_rate=44100, # Sample rate in Hz (default: 44100) precision="PCM_16", # Audio precision (PCM_32, PCM_24, PCM_16, MULAW) output_format="wav" # Output format (wav or mp3) ) as tts: # One-off synthesis (uses REST API) audio_stream = tts.synthesize("Hello, world!") # Process chunks as they arrive async for chunk in audio_stream: # Audio data is in the 'frame.data' attribute of SynthesizedAudio objects audio_data = chunk.frame.data print(f"Received chunk: {len(audio_data)} bytes") # Alternative: collect all audio at once into a single AudioFrame audio_stream = tts.synthesize("Another example sentence.") audio_frame = await audio_stream.collect() print(f"Collected complete audio: {len(audio_frame.data)} bytes") # Real-time streaming synthesis (uses WebSocket API) # Only available for Business plan users in Resemble AI stream = tts.stream() await stream.synthesize_text("Hello, world!") # Run the example asyncio.run(run_tts_example()) ``` -------------------------------- ### Initialize Gladia STT with Basic Options Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-gladia/README.md Initialize the Gladia STT client with an API key and enable interim results. The API key can also be provided via the GLADIA_API_KEY environment variable. ```python from livekit.stt import STT from livekit.plugins.gladia.stt import STT as GladiaSTT # Basic initialization stt = GladiaSTT( api_key="your-api-key-here", # or use GLADIA_API_KEY env var interim_results=True ) ``` -------------------------------- ### Install LiveKit Respeecher Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-respeecher/README.md Use pip to install the Respeecher plugin for LiveKit Agents. ```bash pip install livekit-plugins-respeecher ``` -------------------------------- ### Install LiveKit Neuphonic Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-neuphonic/README.md Use pip to install the Neuphonic plugin for LiveKit Agents. ```bash pip install livekit-plugins-neuphonic ``` -------------------------------- ### Install D-ID LiveKit Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-did/README.md Install the D-ID plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-did ``` -------------------------------- ### Install LiveKit Deepgram Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-deepgram/README.md Use pip to install the Deepgram plugin for LiveKit Agents. ```bash pip install livekit-plugins-deepgram ``` -------------------------------- ### Install LiveKit Speechmatics Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-speechmatics/README.md Install the Speechmatics STT plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-speechmatics ``` -------------------------------- ### Configure Environment Variables for Beyond Presence and LiveKit Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/bey/README.md Set up necessary API keys and LiveKit URL for Beyond Presence, OpenAI, and LiveKit services. ```bash # Beyond Presence Config export BEY_API_KEY="..." # OpenAI config (or other models, tts, stt) export OPENAI_API_KEY="..." # LiveKit config export LIVEKIT_API_KEY="..." export LIVEKIT_API_SECRET="..." export LIVEKIT_URL="..." ``` -------------------------------- ### Install LiveKit Speechify Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-speechify/README.md Install the Speechify TTS plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-speechify ``` -------------------------------- ### LiveKit Agent Full Voice Pipeline with Baseten Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-baseten/README.md This example demonstrates a complete voice AI assistant pipeline, integrating Baseten for STT and TTS, and OpenAI for LLM within a LiveKit Agent session. ```python import os from livekit import agents from livekit.agents import AgentSession, Agent, RoomInputOptions, inference from livekit.plugins import baseten, openai, noise_cancellation from livekit.agents.inference import TurnDetector BASETEN_API_KEY = os.getenv("BASETEN_API_KEY") whisper_model_id = "your-whisper-model-id" # or use chain_id for chain deployments orpheus_model_id = "your-orpheus-model-id" class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions="You are a helpful voice AI assistant.") async def entrypoint(ctx: agents.JobContext): session = AgentSession( stt=baseten.STT( api_key=BASETEN_API_KEY, model_id=whisper_model_id, # or chain_id="your-chain-id" language="en", enable_partial_transcripts=True, ), llm=openai.LLM( api_key=BASETEN_API_KEY, base_url="https://inference.baseten.co/v1", model="openai/gpt-oss-120b", ), tts=baseten.TTS( api_key=BASETEN_API_KEY, model_endpoint=( f"https://model-{orpheus_model_id}" ".api.baseten.co/environments/production/predict" ), ), vad=inference.VAD(), turn_detection=TurnDetector(), ) await session.start( room=ctx.room, agent=Assistant(), room_input_options=RoomInputOptions( noise_cancellation=noise_cancellation.BVC(), ), ) await session.generate_reply( instructions="Greet the user and offer your assistance." ) if __name__ == "__main__": agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint)) ``` -------------------------------- ### Configure Environment and Start Agent for Third-Party Meetings Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/lemonslice/README.md Set environment variables for the meeting URL and chat listening preference, then start the agent worker specifically designed for third-party meeting integration. ```bash export MEETING_URL="https://zoom.us/j/123456789?pwd=abcdef" export LISTEN_TO_MEETING_CHAT="false" python examples/avatar_agents/lemonslice/agent_worker_meeting.py dev ``` -------------------------------- ### Install LiveKit BitHuman Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-bithuman/README.md Use this command to install the LiveKit BitHuman plugin into your Python environment. ```bash pip install livekit-plugins-bithuman ``` -------------------------------- ### Install LiveKit AvatarTalk Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-avatartalk/README.md Use this command to install the LiveKit AvatarTalk plugin via pip. ```bash pip install livekit-plugins-avatartalk ``` -------------------------------- ### Install Avatario Plugin with pip Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-avatario/README.md Use this command to install the LiveKit Avatario plugin via pip. ```bash pip install livekit-plugins-avatario ``` -------------------------------- ### Generate Local Documentation with pdoc Source: https://github.com/livekit/agents/blob/main/README.md Use these shell commands to synchronize dependencies and build the LiveKit Agents SDK documentation locally into the 'docs' directory. ```shell uv sync --all-extras --group docs uv run --active pdoc --skip-errors --html --output-dir=docs livekit ``` -------------------------------- ### Set up LiveKit API Keys in .env Source: https://github.com/livekit/agents/blob/main/examples/README.md This snippet shows the basic environment variables required in a .env file for connecting to a LiveKit server, including the URL, API key, and API secret. ```bash LIVEKIT_URL="wss://your-project.livekit.cloud" LIVEKIT_API_KEY="your_api_key" LIVEKIT_API_SECRET="your_api_secret" ``` -------------------------------- ### Start the AvatarTalk Agent Worker Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/avatartalk/README.md Execute this command to start the AvatarTalk agent worker in development mode. ```bash python examples/avatar_agents/avatartalk/agent_worker.py dev ``` -------------------------------- ### Install LiveKit Inworld Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-inworld/README.md Use this command to install the Inworld plugin for LiveKit Agents via pip. ```bash pip install livekit-plugins-inworld ``` -------------------------------- ### Install LiveKit Agent Dependencies with uv Source: https://github.com/livekit/agents/blob/main/examples/README.md Run this command from the repository root to install all necessary project dependencies, including development extras, using the uv package manager. ```bash uv sync --all-extras --dev ``` -------------------------------- ### Install LiveKit TruGen Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-trugen/README.md Use this command to install the LiveKit TruGen AI plugin using pip. ```bash pip install livekit-plugins-trugen ``` -------------------------------- ### Install LiveKit Tavus Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-tavus/README.md Use this command to install the Tavus plugin for LiveKit Agents via pip. ```bash pip install livekit-plugins-tavus ``` -------------------------------- ### Initialize Gladia STT with Advanced Configuration Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-gladia/README.md Configure the Gladia STT client with various advanced options including multi-language support, audio parameters, translation settings, custom vocabulary, and custom spelling. ```python stt = GladiaSTT( languages=["en", "fr"], # Specify languages or let Gladia auto-detect code_switching=True, # Allow switching between languages during recognition sample_rate=16000, # Audio sample rate in Hz bit_depth=16, # Audio bit depth channels=1, # Number of audio channels region="eu-west", # Specify Region to use for the Gladia API encoding="wav/pcm", # Audio encoding format energy_filter=True, # Enable voice activity detection translation_enabled=True, translation_target_languages=["en"], translation_model="base", translation_match_original_utterances=True, translation_context_adaptation= False, # Enable context-aware translation translation_context= None, # Context input to guide translation translation_informal=False, # Use informal tone in translation pre_processing_audio_enhancer=False, # Apply pre-processing to the audio stream to enhance the quality pre_processing_speech_threshold=0.6, # Sensitivity for speech detection; closer to 1 = stricter, less background noise # Custom_vocabulary exemple custom_vocabulary=[ "Westeros", {"value": "Stark"}, { "value": "Night's Watch", "pronunciations": ["Nightz Watch"], "intensity": 0.4, "language": "en" } ], # Custom_spelling exemple custom_spelling={ "Gorish": ["ghorish", "gaurish", "gaureish"], "Data Science": ["data-science", "data science"], ".": ["period", "full stop"], "SQL": ["sequel"] } ) ``` -------------------------------- ### Install LiveKit Agents with Model Provider Plugins Source: https://github.com/livekit/agents/blob/main/README.md Use this command to install the core LiveKit Agents library along with specified plugins for popular model providers like OpenAI, Deepgram, and Cartesia. ```bash pip install "livekit-agents[openai,deepgram,cartesia]" ``` -------------------------------- ### Configure and Attach Hamming Session in Python Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-hamming/README.md This example demonstrates how to configure the Hamming plugin with API keys and an external agent ID, then attach it to an AgentSession with customer metadata, external links, and a session mode. ```python import os from livekit.agents import AgentSession, JobContext from livekit.plugins import hamming async def entrypoint(ctx: JobContext) -> None: await ctx.connect() hamming.configure_hamming( api_key=os.environ["HAMMING_API_KEY"], external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"], recording={"mode": "session_audio"}, ) session = AgentSession() hamming.attach_session( session, job_ctx=ctx, customer_metadata={ "deployment": { "environment": "prod", "prompt_version": "v17", }, "experiment": { "variant": "B", }, }, external_links=[ { "label": "CRM Contact", "url": "https://crm.example.com/contact/123", "source": "salesforce", } ], session_mode="testing", ) ``` -------------------------------- ### Configure Environment Variables for Protoface, Google, and LiveKit Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/protoface/README.md Set the necessary environment variables for Protoface API key and avatar ID, Google API key, and LiveKit API credentials and URL before running the agent. ```bash # Protoface config. PROTOFACE_AVATAR_ID is optional and defaults to av_stock_001. export PROTOFACE_API_KEY="..." export PROTOFACE_AVATAR_ID="av_stock_001" # Google config export GOOGLE_API_KEY="..." # LiveKit config export LIVEKIT_API_KEY="..." export LIVEKIT_API_SECRET="..." export LIVEKIT_URL="..." ``` -------------------------------- ### Install livekit-plugins-gnani Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-gnani/README.md Install the LiveKit Gnani plugin using pip, which also includes `websockets` and `livekit-agents` as dependencies. ```bash pip install livekit-plugins-gnani ``` -------------------------------- ### Install Clova Plugin for LiveKit Agents Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-clova/README.md Use pip to install the Clova STT plugin for LiveKit Agents. ```bash pip install livekit-plugins-clova ``` -------------------------------- ### Install LiveKit Cerebras Plugin Source: https://github.com/livekit/agents/blob/main/livekit-plugins/livekit-plugins-cerebras/README.md Run this command to install the Cerebras plugin for LiveKit Agents using pip. ```bash pip install livekit-plugins-cerebras ``` -------------------------------- ### Start the LiveAvatar Agent Worker Source: https://github.com/livekit/agents/blob/main/examples/avatar_agents/liveavatar/README.md Execute this command to start the LiveKit LiveAvatar agent worker in development mode. ```bash python examples/avatar_agents/liveavatar/agent_worker.py dev ```