Skip to content

Conversation

@madhavkapila
Copy link

Problem Statement

Voice agents currently interrupt their speech whenever VAD detects user audio, even for passive acknowledgments like "yeah", "ok", or "hmm". This creates an unnatural conversation flow where the agent stops mid-sentence unnecessarily.

Solution

Implemented intelligent backchanneling detection that distinguishes between:

  • Passive acknowledgments (backchanneling) - "yeah", "ok", "hmm", "right", "sure"
  • Real interruptions - "wait", "stop", "hold on", "no"

How It Works

  1. Agent continues speaking when user says backchanneling words
  2. Agent responds to backchanneling words when silent (treats as normal input)
  3. Agent stops immediately for interrupt words like "stop" or "wait"
  4. Mixed inputs like "yeah but wait" trigger interruption (semantic detection)

Implementation Details

New Files

File Purpose
livekit-agents/livekit/agents/voice/backchanneling_config.py Configurable word lists for backchanneling and interrupt words
livekit-agents/livekit/agents/voice/README.md Documentation with usage examples
examples/voice_agents/test_backchanneling.py Example agent for testing
tests/test_backchanneling.py Unit tests

Modified Files

File Change
livekit-agents/livekit/agents/voice/agent_activity.py Added _is_backchanneling_only() method and filtering logic
livekit-agents/livekit/agents/voice/agent_session.py Added backchanneling_config parameter
livekit-agents/livekit/agents/voice/__init__.py Export BackchannelingConfig

Key Design Decisions

  • No VAD modification - Logic layer only, VAD detects all speech as before
  • State-aware filtering - Backchanneling filtered only when agent is actively speaking
  • Configurable - Word lists can be customized per use case
  • Hinglish support - Includes words like "haan", "theek", "achha"

Testing Instructions

# Run the test agent
python examples/voice_agents/test_backchanneling.py dev

# Connect via LiveKit Playground
# https://agents-playground.livekit.io/

- Add BackchannelingConfig for configurable word lists
- Implement _is_backchanneling_only() method in agent_activity.py
- Filter backchanneling only when agent is speaking (state-aware)
- Support semantic interruption (mixed inputs like 'yeah but wait')
- No VAD modification - logic layer only
- Add README.md with usage documentation
- Add unit tests and example agent
Copilot AI review requested due to automatic review settings January 20, 2026 11:13
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 pull request adds intelligent backchanneling detection to the LiveKit Agents framework, enabling voice agents to distinguish between passive acknowledgments (like "yeah", "ok") and actual interruptions (like "wait", "stop"). The implementation introduces a new configuration system with customizable word lists and integrates backchanneling filtering into the agent's speech interruption logic.

Changes:

  • Added BackchannelingConfig dataclass with configurable backchanneling and interrupt word lists supporting multiple languages
  • Integrated backchanneling detection into agent_activity.py to filter out passive acknowledgments during agent speech
  • Updated AgentSession to accept backchanneling_config parameter with sensible defaults

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
livekit-agents/livekit/agents/voice/backchanneling_config.py New configuration module defining word lists and factory functions for backchanneling detection
livekit-agents/livekit/agents/voice/agent_activity.py Added _is_backchanneling_only() method and integrated backchanneling checks into interruption handlers
livekit-agents/livekit/agents/voice/agent_session.py Added backchanneling_config parameter and passed it through to options
livekit-agents/livekit/agents/voice/init.py Exported BackchannelingConfig for public API
livekit-agents/livekit/agents/voice/README.md Comprehensive documentation with usage examples and configuration details
examples/voice_agents/test_backchanneling.py Example agent implementation demonstrating backchanneling feature
tests/test_backchanneling.py Unit tests for configuration and detection logic

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

- Updated _is_backchanneling_only() in both test classes to match agent_activity.py
- Changed from word-level matching to SUBSTRING matching for interrupt words
- Added sentence splitting logic using re.split() for multi-sentence handling
- Added FrozenInstanceError import for proper frozen dataclass testing
- Fixed test_config_is_frozen to use proper dataclass frozen attribute assignment
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