few-afternoon-34452
11/18/2025, 8:58 PMproc.userdata["vad"] = silero.VAD.load()
turn_detection=MultilingualModel(),
vad=ctx.proc.userdata["vad"],
preemptive_generation=True,
Above is my agent configuration.
@session.on("user_state_changed")
def _on_user_state_changed(ev):
"""Track user state changes (speaking vs listening)"""
logger.info(f"user_state_changed + {ev.old_state} -> {ev.new_state}")
callbacks are not coming when use is having the conversation. what could be the possible reason?tall-airline-16756
11/18/2025, 8:58 PMtall-airline-16756
11/18/2025, 8:59 PMuser_state_changed event might not be triggering for a few reasons, and I’m here to help you figure it out together:
• Event Registration: First, let’s double-check that the event listener is properly registered using the exact user_state_changed event name. Sometimes, a small typo or using an outdated event name can stop the callbacks from working.
• No State Change: Remember, this event only fires when the user’s state actually changes (like going from "speaking" to "listening"). If there’s no change, the event won’t trigger.
• VAD Configuration: It’s important to make sure the Voice Activity Detection (VAD) module is set up correctly and linked to the agent session. Without VAD, detecting state changes gets tricky.
• Audio Input: Check that the participant’s audio stream is active and being received properly. If there’s no audio, VAD won’t be able to detect anything.
• Agent Session: Lastly, confirm that the agent session is fully started and connected to the room. If the session isn’t active, events won’t be emitted.
To help you better, could you please let me know:
1. Are you using VAD or another method for turn detection?
2. Are other events, like user_input_transcribed, firing as expected?
3. Is the agent successfully entering the "listening" state?
With this info, we can narrow down whether the issue is with VAD, event registration, or the audio flow. I’m here to support you every step of the way! Sources: Agents v0.x migration guide - Node.js | LiveKit Docs | Agents v0.x migration guide - Python | LiveKit docs | agents/src/voice/room_io/room_io.ts | Events and error handling | LiveKit docs | livekit-agents/livekit/agents/voice/agent_session.pyfew-afternoon-34452
11/18/2025, 9:04 PMtall-airline-16756
11/18/2025, 9:05 PMuser_state_changed event might not trigger with MultilingualModel for turn detection due to a few common reasons. Let’s walk through them together:
• STT Configuration: It’s important to make sure your Speech-to-Text (STT) model is set up for automatic language detection or explicitly assigned to a single language. Also, double-check that the user_input_transcribed event includes a language field.
• Model Initialization: Please confirm that the necessary model files for MultilingualModel have been downloaded using the download-files command. You can also look in the cache directory to see if the files are there.
• Realtime LLM Conflicts: If you’re using a realtime LLM, try disabling its automatic activity detection and instead provide a standalone STT instance to feed transcriptions to the turn detector.
• VAD Configuration: While not absolutely required, adding a VAD model (like silero.VAD.load()) can really help improve detection accuracy.
• Remote Inference: If remote inference is part of your setup, please ensure the endpoint is reachable and responding properly. Checking the logs for any inference errors can be very helpful.
• Event Listener: Lastly, make sure the user_state_changed event listener is correctly attached and that you’re not using any outdated event names.
To move forward, here are a few steps you might want to try:
1. Double-check your STT configuration and confirm if language detection is enabled.
2. Verify that the download-files command was run and that the model files are present.
3. Check if a VAD model is included in your configuration.
If you have any questions or need a hand with any of these steps, please don’t hesitate to reach out. I’m here to help! Sources: agents/src/voice/events.ts | Agents v0.x migration guide - Node.js | LiveKit Docs | LiveKit turn detector plugin | LiveKit docs | complex-agents/turn-taking/README.md | livekit-agents/livekit/agents/voice/events.py