how to keep user mic off/ dont lsiten until bot sp...
# ask-ai
p
how to keep user mic off/ dont lsiten until bot speaks first message
t
Thanks for reaching out, Minas. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m glad you reached out! To help you keep a user’s microphone off or prevent the system from listening until the bot speaks its first message in LiveKit, you can use manual turn detection along with audio input control via the LiveKit Agents SDK. Let me walk you through it: 1. Start by initializing the agent session with manual turn detection, which disables automatic listening based on voice activity:
session = AgentSession(turn_detection="manual")
2. Next, disable audio input right at the beginning to make sure the agent doesn’t listen to the user’s microphone:
session.input.set_audio_enabled(False)
3. Then, once the bot has delivered its first message, you can enable listening by running:
session.input.set_audio_enabled(True)
This way, you have full control over when the agent starts listening, ensuring it only does so after the bot has spoken its initial message. If you have any questions or need further help, feel free to ask—I’m here for you! Sources: livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/...