in what case DEBUG livekit.agents - input stream a...
# ask-ai
b
in what case DEBUG livekit.agents - input stream attached can be raised and then the assistant.say runs but the agent does not go into speaking state?
t
Thanks for reaching out, Mohammed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like when
assistant.say
runs but the agent doesn’t switch to the "speaking" state, there’s usually a hiccup somewhere in the audio pipeline between generating the speech and playing it out. Let’s walk through some common reasons and ways to troubleshoot: • Speech Handle Authorization: Double-check that the speech handle is authorized before playback starts. Make sure
await speech_handle._wait_for_authorization()
finishes without issues. • Text-to-Speech (TTS) Generation: Confirm the TTS system is creating audio frames properly. The input text should be valid, and there shouldn’t be any TTS errors. • Audio Output Configuration: Ensure your audio output is turned on and set up correctly. • Interruptions: See if the speech is getting interrupted before the first audio frame is ready. Check if
speech_handle.interrupted
is
True
. • Playout System: Make sure the playout system is sending the right events to move the agent into the "speaking" state. For instance, in JavaScript, the
AgentPlayout
should emit a
PLAYOUT_STARTED
event. Here are some friendly tips to dig a little deeper: 1. Add logging around the
_on_first_frame
callback to see if it’s getting triggered. 2. Look out for any exceptions in the TTS or audio forwarding tasks. 3. Check that the audio source is properly connected and configured. 4. Keep an eye on the speech queue to confirm speeches are being processed as expected. 5. Review agent state updates to spot any conflicting state changes. Chances are the issue is somewhere in the audio pipeline, so focusing on TTS generation, audio forwarding, and playout setup should get things back on track. If you need a hand with any of these steps, just let me know—I’m here to help! Sources: livekit-agents/livekit/agents/voice/agent_session.py | agents/src/pipeline/human_input.ts