cool-lizard-26153
11/12/2025, 11:15 AMtall-airline-16756
11/12/2025, 11:15 AMtall-airline-16756
11/12/2025, 11:16 AMsession.say without blocking the LLM call in on_user_turn_completed. Here’s a friendly approach that should help you manage this smoothly:
• Make sure allow_interruptions=True (which is the default) in your session.say. This setting lets the system automatically detect and handle any interruptions.
• Right after the session.say call, you can check the interrupted property of the SpeechHandle to see if the speech was interrupted.
• To keep your LLM call from being blocked, it’s best to structure your code so that you handle the interruption check after you’ve started the LLM call.
Here’s a simple example to illustrate this:
async def on_user_turn_completed(session):
handle = await session.say("Your message here", allow_interruptions=True)
# Proceed with the LLM call
llm_response = await session.generate_reply("User input")
# Check if the speech was interrupted
if handle.interrupted:
print("Speech was interrupted")
This way, your LLM call won’t be delayed, and you’ll still be able to respond to interruptions effectively. If you have any more questions or want to explore this further, feel free to ask—I’m here to help!
Sources: agents/src/voice/speech_handle.ts | livekit-agents/livekit/agents/voice/agent_activity.py | Turn detection and interruptions | LiveKit Docs | Agent speech and audio | LiveKit docs | basics/uninterruptable.pycool-lizard-26153
11/12/2025, 11:19 AMtall-airline-16756
11/12/2025, 11:20 AM