The livekit-plugins-silero library provides a Voice Activity Detection (VAD) plugin for the LiveKit Agent Framework. It leverages the Silero VAD model to accurately detect speech versus silence, which is crucial for natural turn-taking in voice AI applications and for optimizing Speech-to-Text (STT) resource usage. The current version is 1.5.2, released as part of the LiveKit Agents framework, which follows a rapid release cadence.
pip install livekit-plugins-sileroVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to integrate `livekit-plugins-silero` into a LiveKit Agent. It sets up an `AgentServer` with a `prewarm` function to load the Silero VAD model efficiently once per process. The `my_agent` entrypoint then retrieves the prewarmed VAD instance and initializes an `AgentSession` with it, enabling voice activity detection for the agent. Remember to download model weights before running.
Update `AgentSession` initialization to use the `turn_handling` parameter with a `TurnHandlingOptions` dictionary. For example, to opt out of adaptive interruption and use VAD-only interruption, set `turn_handling={'interruption': {'mode': 'vad'}}`.Run `python -m livekit.agents.cli download-files` from your terminal or include this command in your deployment script.
It is highly recommended to prewarm the VAD model by loading it once in an `AgentServer`'s `setup_fnc` (or similar pre-job hook) and then passing the preloaded instance to each `AgentSession`.
If GPU inference is desired, set `force_cpu=False` when calling `silero.VAD.load()` and verify your `onnxruntime-gpu` installation and environment are correctly configured to utilize the GPU.
Ensure your audio input or the `sample_rate` parameter in `silero.VAD.load()` is set to either 8000 or 16000 Hz. For example: `vad = silero.VAD.load(sample_rate=16000)`.
This is often a warning during warmup and may resolve itself once the agent is fully running. To potentially mitigate, ensure `onnxruntime` is optimally configured for your system, consider using `force_cpu=True` if you suspect GPU issues, or try prewarming the VAD model in a `prewarm` function within the LiveKit Agent framework.
Examine the full traceback for more specific details. Common causes include issues with the audio frames being pushed, unexpected audio data formats, or internal ONNX Runtime errors. Ensure your audio data is clean and consistently formatted. Check LiveKit Agent and `livekit-plugins-silero` versions for compatibility.
After installing `livekit-plugins-silero`, you must explicitly download the model weights. If using `livekit-agents` CLI, run `uv run agent.py download-files` or similar command as instructed by LiveKit. If manually managing, ensure the `silero_vad.onnx` file is present in the `livekit/plugins/silero/resources` directory or specify its path using the `onnx_file_path` parameter in `silero.VAD.load()`.