Configure when users can interrupt the bot to prevent unwanted interruptions from brief affirmations
Interruption strategies allow you to control when users can interrupt the bot during speech. By default, any user speech immediately interrupts the bot, but this can be problematic when users engage in backchanneling—brief vocal responses like “yeah”, “okay”, or “mm-hmm” that indicate they’re listening without intending to interrupt.
With interruption strategies, you can require users to meet specific criteria (such as speaking a minimum number of words or reaching a certain audio volume) before their speech will interrupt the bot, creating a more natural conversation flow.
Want to try it out? Check out the interruption strategies foundational demo
Interruption strategies are configured via the interruption_strategies
parameter in PipelineParams
. When specified, the normal immediate interruption behavior is replaced with conditional interruption based on your criteria.
List of interruption strategies to apply. When multiple strategies are provided, the first one that evaluates to true will trigger the interruption. If empty, normal interruption behavior applies.
All interruption strategies inherit from BaseInterruptionStrategy
, which provides a common interface for evaluating interruption conditions.
Appends audio data to the strategy for analysis. Not all strategies handle audio.
Appends text to the strategy for analysis. Not all strategies handle text.
Called when the user stops speaking to determine if interruption should occur based on accumulated audio and/or text.
Resets accumulated text and/or audio data.
Requires users to speak a minimum number of words before interrupting the bot.
Minimum number of words the user must speak to interrupt the bot. Must be greater than 0.
When interruption strategies are configured:
True
triggers interruptionThe system automatically handles both audio and text input:
InputAudioRawFrame
) are fed to append_audio()
append_text()
Require users to speak at least 3 words to interrupt the bot:
Strategies are evaluated in order, with the first match triggering interruption:
Scenario | Without Strategy | With MinWordsInterruptionStrategy(min_words=3) |
---|---|---|
User says “okay” while bot speaks | ✅ Interrupts immediately | ❌ Ignored (only 1 word) |
User says “yes that’s right” while bot speaks | ✅ Interrupts immediately | ✅ Interrupts (3 words) |
User speaks while bot is silent | ✅ Processed immediately | ✅ Processed immediately |
allow_interruptions
parameter must be True
for interruption strategies to work