wooden-librarian-60399
09/17/2025, 4:12 AMtall-airline-16756
09/17/2025, 4:12 AMtall-airline-16756
09/17/2025, 4:13 AMinterrupt() method whenever you need to.
Whenever an interruption takes place, the agent moves through the right states to keep everything running smoothly and responsively. If you have any more questions about this, feel free to ask—I’m here to help!
Sources: tests/test_agent_session.py | Agent speech and audio | LiveKit Docs | Agent speech and audio | LiveKit Docs | Bringing AI avatars to voice agentswooden-librarian-60399
09/17/2025, 4:13 AMtall-airline-16756
09/17/2025, 4:14 AMallow_interruptions parameter to False. Let’s walk through the steps together:
• In Python: You simply set allow_interruptions=False when creating the agent. Here’s a quick example:
class UninterruptableAgent(Agent):
def __init__(self):
super().__init__(
instructions="You are not interruptable.",
stt=deepgram.STT(),
llm=openai.LLM(model="gpt-4o"),
tts=openai.TTS(),
allow_interruptions=False # This disables interruptions
)
• In Node.js: You do something similar by setting allowInterruptions: false in the agent options, like this:
const agent = new pipeline.VoicePipelineAgent(
vad,
stt,
llm,
tts,
{
chatCtx: initialContext,
allowInterruptions: false // This disables interruptions
}
);
Additionally, if you want to control interruptions dynamically for specific speech outputs, you can use SpeechHandle. For instance, in Python:
async def on_function_call(self, ctx, function_call):
ctx.disallow_interruptions() # This disables interruptions for this specific call
If you’d like to explore further, I recommend checking out the Uninterruptable Agent example in the LiveKit examples repository. It’s a great resource to deepen your understanding.
Sources: packages/basics/package.json | livekit-agents/livekit/agents/voice/agent.py | agents/src/voice/speech_handle.ts | LiveKit Docs | basics/interrupts_user.py