My Livekit Agent picks up background voices. How t...
# ask-ai
l
My Livekit Agent picks up background voices. How to avoid that
t
Thanks for reaching out, Deepak. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I understand you want to stop your LiveKit Agent from picking up background voices. The best way to do that is to enable Background Voice Cancellation (BVC) in your agent (server-side) so the agent receives cleaner audio for STT/turn detection. What to do (choose your agent SDK): • Python a. Install the plugin:
Copy code
uv add "livekit-plugins-noise-cancellation~=0.2"
1. Enable BVC in your AgentSession:
Copy code
from livekit.plugins import noise_cancellation
     from livekit.agents.voice import room_io

     await session.start(
         room=ctx.room,
         agent=Assistant(),
         room_options=room_io.RoomOptions(
             audio_input=room_io.AudioInputOptions(
                 noise_cancellation=noise_cancellation.BVC(),
             ),
         ),
     )
• Node.js a. Install the package:
Copy code
pnpm add @livekit/noise-cancellation-node
1. Enable BVC:
Copy code
import { BackgroundVoiceCancellation } from '@livekit/noise-cancellation-node';

     await session.start({
       room: ctx.room,
       agent: myAgent,
       inputOptions: {
         noiseCancellation: BackgroundVoiceCancellation(),
       },
     });
Important notes: • BVC runs only in agent code (Python/Node). It is not available in frontend SDKs (Web/Swift/Android). • Do NOT enable frontend noise cancellation (e.g., Krisp) if you use BVC — applying two noise filters can degrade audio. • For telephony use cases, use the telephony-optimized model (
BVCTelephony()
/ equivalent). Would you like help applying this to your current agent code? If so, tell me which SDK you’re using and share the relevant snippet (room start/session start) and I’ll give exact edits. Sources: Enhanced noise cancellation | LiveKit docs
l
what should be my vad config
t
Thanks — I’ll help with VAD config. Are you using the Python Agent SDK or Node.js (or something else)? I can give an exact snippet for your SDK; below is the recommended VAD configuration you can apply right away. Recommended VAD settings (balanced responsiveness and accuracy) • `min_speech_duration`: 0.05 s • `min_silence_duration`: 0.5–0.55 s (reduce to 0.4–0.5 s for faster turn-taking) • `activation_threshold`: 0.5 (raise to 0.6–0.7 in noisy environments) • `prefix_padding_duration`: 0.5 s • `sample_rate`: 16000 • `force_cpu`: true (optional; useful if you want deterministic CPU behavior) Python example
Copy code
from livekit.plugins import silero

vad = silero.VAD.load(
    min_speech_duration=0.05,
    min_silence_duration=0.5,
    activation_threshold=0.5,
    prefix_padding_duration=0.5,
    sample_rate=16000,
    force_cpu=True
)
Tips • Prewarm the VAD at server startup to reduce first-connection latency. • If you need more robust turn handling (long pauses, mid-utterance pauses), combine VAD with the LiveKit Turn Detector (MultilingualModel). • If your environment is very noisy or has multiple background voices, raise
activation_threshold
and consider pairing VAD with Background Voice Cancellation (BVC) in the agent. Tell me which SDK and code snippet you’re using and I’ll provide the exact edits to apply. Sources: Silero VAD plugin | LiveKit docs | LiveKit turn detector plugin | LiveKit docs | Turns overview | LiveKit docs