Feature · Interrupt handling
Interrupt handling for AI voice agents.
When a user talks over the agent, PyAI cancels the reply, keeps context, and signals your app to stop audio.
What PyAI gives you for interrupt handling
- Interrupt handling on Omni streams the agent reply one sentence at a time, so a barge-in cancels only the sentences the user never heard while the conversation context is kept.
- In a browser or app, a flush event tells your client to stop playback, while on PyAI phone numbers at 8 kHz the telephony edge clears playback with no client code.
- An echo and noise gate screens user audio before speech detection, which helps keep the agent's own voice from counting as an interruption.
- Omni scores 94.3 out of 100 on the VAQI voice-agent quality index, where interruptions carry 40% of the weight and 70 or above counts as good.
What happens after a user barges in?
Pick an interruption and play it. The lines are an example script built from the PyAI conversation flow, not a recording.
Pick a moment, then press play
How does PyAI interruption handling work, step by step?
Interruption handling runs inside the same Omni session that speaks the reply, so cancelling the reply does not wait on a separate speech service.
The agent is speaking
Omni synthesizes the reply one sentence at a time and streams the audio to your app, browser or a phone line.
The user starts talking
User audio keeps flowing during playback. The engine runs an echo and noise gate, then checks for speech.
Omni cancels the reply
Speech during playback cancels the sentences not yet spoken. The conversation context, including what the user said before, is kept.
Playback stops
Omni sends flush. In a browser or app, your client stops its own audio. On a PyAI phone line the phone edge clears playback.
The agent answers the new turn
The turn detector waits for the user to finish, then the agent replies to the interruption.
Your client stops on flush
The user hears silence within your client's own stop time, then the new answer. No old sentence leaks into the session.
Your client ignores flush
Audio already buffered on the device keeps playing over the user. Omni has cancelled the reply, but the speaker has not stopped.
Which conversations put interrupt handling to the test?
Interrupt handling gets tested most when users already know what they want and the agent's reply is long.
Users who know the answer they need
A user in a mobile app hears the first step of a reset guide and cuts in with the step they are stuck on. The agent drops the guide and answers that step.
Price questions mid-pitch
A visitor talking to a site widget asks for the price halfway through a feature list. Omni cancels the list and the agent gives the number.
Corrections to dates and times
A patient at a check-in tablet hears the wrong time read back and says so at once. The agent stops and confirms the new time, keeping the rest of the booking.
Disputes
A caller on the billing line interrupts the balance readout to dispute a charge, and the agent switches to the dispute without repeating the balance.
Quick changes
A diner at an ordering kiosk adds a side while the agent repeats the order back, and the agent updates the order instead of finishing the list.
Interruption handling questions people ask
Is interrupt handling here about CPU interrupts?
No. In operating systems, interrupt handling means a processor pausing work to serve a hardware signal. In voice AI, interrupt handling means what an agent does when a user talks over it, also called barge-in. This PyAI page covers only the voice meaning: how Omni stops, cancels and listens.
What does the flush event mean in PyAI?
The flush event tells your client that the user interrupted and the agent's reply was cancelled. Your client should stop the audio playing now and delete any agent audio still queued. On PyAI phone numbers the phone edge clears playback itself, so flush handling matters for browser and app clients.
Does the agent remember what it said before the interruption?
Yes. When a user interrupts, the PyAI Omni engine cancels the rest of the reply but keeps the conversation context. The next answer still knows everything said earlier in the session, so the user does not have to repeat details. The agent then answers what the user said during the interruption.
How is interruption handling measured?
PyAI measures interruption handling inside its voice-agent quality index, VAQI, where interruptions carry 40% of the score, missed responses 40% and latency 20%. Omni scores 94.3 out of 100, and 70 or above counts as good. PyAI has not published a separate figure for playback stop time.
Related features
PyAI is voice infrastructure. It hands you the audio and transcript, and does not replace your own models or review tools.