Skip to content

feat: Intelligent Interruption Handling for Voice Agents#486

Open
anishh15 wants to merge 11 commits intoDark-Sys-Jenkins:mainfrom
anishh15:feature/interrupt-handler-anish-laddha
Open

feat: Intelligent Interruption Handling for Voice Agents#486
anishh15 wants to merge 11 commits intoDark-Sys-Jenkins:mainfrom
anishh15:feature/interrupt-handler-anish-laddha

Conversation

@anishh15
Copy link

@anishh15 anishh15 commented Feb 2, 2026

Summary

Implements context-aware interruption handling that distinguishes between passive acknowledgements (yeah, mhmm, okay) and actual interruptions (stop, wait, no) based on agent speaking state.

Key Features

  • Configurable word lists - Custom backchannel and interrupt words
  • State-based filtering - Only filters when agent is speaking
  • Mixed input handling - "yeah but wait" correctly triggers interruption
  • No VAD modification - Implemented as logic layer above existing pipeline
  • Seamless audio - Agent continues without pause or stutter

Files Added

File Description
interruption_filter.py Core filter logic with regex-based word matching
interrupt_demo.py Demo agent for testing the feature
test_interruption_filter.py Unit tests (21 passing)
proof/ Screen recording and transcript

Files Modified

File Changes
agent_activity.py State tracking and filter integration
audio_recognition.py Skip EOU detection for filtered utterances
agent_session.py Configuration options
__init__.py Public API exports

Usage

session = AgentSession(
    interruption_filter_enabled=True,
    backchannel_words={"yeah", "ok", "mhm"},  # optional
    interrupt_words={"stop", "wait", "no"},   # optional
)

Documentation

See CHANGES.md for detailed architecture and configuration guide.

…tion

- Implement InterruptionFilter class with configurable word lists
- Add DEFAULT_BACKCHANNEL_WORDS (yeah, ok, mhmm, uh-huh, etc.)
- Add DEFAULT_INTERRUPT_WORDS (stop, wait, no, actually, etc.)
- Support flexible matching for hyphenated words (uh-huh matches uh huh)
- Add should_interrupt() method with state-aware filtering logic
- Add interruption_filter_enabled option (default: True)
- Add backchannel_words option for custom word sets
- Add interrupt_words option for custom interrupt triggers
- Update AgentSessionOptions dataclass with new fields
- Add state tracking flags for utterance filtering
- Capture agent state at start of user speech (before VAD/STT race)
- Apply filter in _interrupt_by_audio_activity() method
- Skip interruption for backchannel words when agent is speaking
- Reset filter state on end of speech
- Add should_skip_turn_detection() hook to RecognitionHooks
- Skip End-of-Utterance detection when backchannel is filtered
- Prevents agent from generating response to ignored input
- Export InterruptionFilter, InterruptionFilterConfig
- Export DEFAULT_BACKCHANNEL_WORDS, DEFAULT_INTERRUPT_WORDS
- Fix initialization issue causing agent startup failure
- Test default configuration and custom word sets
- Test backchannel blocking when agent is speaking
- Test interrupt word detection
- Test mixed input handling (yeah but wait)
- Test case insensitivity and punctuation handling
- Test dynamic configuration updates
- Create DemoAgent storyteller for testing backchanneling
- Configure AgentSession with interruption filter enabled
- Include setup instructions and usage examples
- Document backchannel filtering while agent speaking
- Document interrupt word detection
- Document response when agent is silent
- Include test results summary
- Document architecture and design decisions
- Explain state capture timing for VAD/STT race condition
- List all modified and new files
- Include setup and testing instructions
Copilot AI review requested due to automatic review settings February 2, 2026 15:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements intelligent interruption handling for voice agents that distinguishes between passive acknowledgements (backchanneling) and actual interruptions. The feature filters backchannel words like "yeah", "mhmm", and "okay" when the agent is speaking, allowing conversations to flow naturally without unnecessary interruptions.

Changes:

  • Added InterruptionFilter class with configurable word lists and state-aware filtering logic
  • Integrated filter into AgentActivity with state capture timing to handle VAD/STT race conditions
  • Modified AudioRecognition to skip EOU (End-of-Utterance) detection for filtered backchannel utterances
  • Added configuration options to AgentSession for enabling/customizing the filter
  • Included comprehensive test suite (21 tests), demo agent, and documentation

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
livekit-agents/livekit/agents/voice/interruption_filter.py New core filter implementation with regex-based word matching and state-aware logic
livekit-agents/tests/test_interruption_filter.py Comprehensive unit tests covering filter behavior in various scenarios
examples/voice_agents/interrupt_demo.py Demo agent showcasing the interruption handling feature
proof/transcript.txt Annotated transcript demonstrating filter behavior
CHANGES.md Documentation explaining architecture, configuration, and design decisions
livekit-agents/livekit/agents/voice/agent_activity.py Integration point: state capture, filter application, and flag management
livekit-agents/livekit/agents/voice/audio_recognition.py Modified to skip EOU detection for filtered utterances using new hook
livekit-agents/livekit/agents/voice/agent_session.py Added configuration options for filter enable/disable and custom word lists
livekit-agents/livekit/agents/voice/__init__.py Exported filter classes and constants to public API
livekit-agents/livekit/agents/telemetry/traces.py Added compatibility for newer opentelemetry-sdk versions (unrelated to main feature)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Remove unused Literal import from interruption_filter.py
- Remove duplicate Any import from traces.py
- Remove unused was_filtered variable from agent_activity.py
- Re-enable resume_false_interruption in demo agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant