agents icon indicating copy to clipboard operation
agents copied to clipboard

Turn detection / interruption handling makes agent too sensitive and causes Agent interrupting the user

Open Bnowako opened this issue 1 year ago β€’ 5 comments

Turn detection / interruption handling makes agent too sensitive and causes user interruptions

tldr; It seems that interruption logic is shared across the agent’s thinking and speaking states and can’t be tuned independently.

That's why it's not possible to make the agent that is hard to interrupt but still friendly to slow speakers. Would love to solve it with available settings, but not sure if possible now.

What we've tried

1. Defaults

too interruptable

2. Less sensitive to interruptions

{
  "turn_detection": "vad",
  "min_interruption_words": 3,
  "min_interruption_duration": 1.0,
  "min_endpointing_delay": 1.0
}

3. Also tested

  • Multiple min_interruption_words ∈ [1..3]
  • min_interruption_duration ∈ [0.3..1.5]
  • min_endpointing_delay ∈ [0..1.5]
  • With and without a turn detection model

We couldn't find a configuration that:

  1. Ignores brief interruptions while the agent is speaking, and
  2. Avoids agent interrupting the user while the user speaks slowly and deliberately.

Proposed enhancements (either/or or combined)

1. Per-state interruption profiles

  • Separate parameters for speaking vs thinking states:
    • speaking_min_interruption_words
    • speaking_min_interruption_duration
    • speaking_min_endpointing_delay
    • thinking_* counterparts

2. Agent-level dynamic overrides

  • Allow all interruption and turn detection settings to be set/updated at agent level (not only global/session), and changeable at runtime on agent_state_changed.

3. Uninterruptible words

  • List of words that are never interrupting the agent

Environment

  • LiveKit agent SDK: 1.2.2
  • LLM: gpt-4o
  • TTS: cartesia
  • VAD - silero
  • Turn Detection Model - Livekit Multilingual
  • Languages: English/German

Would be great to get @longcw and @theomonnom opinion on that. We are fairly new to livekit, and this seems like a core logic of the sdk, but we would be happy to contribute if you think one of above makes sense lmk and will figure it out.

Bnowako avatar Sep 15 '25 16:09 Bnowako

+1

sebhs avatar Sep 15 '25 18:09 sebhs

fyi, you can modify the min_endpointing_delay in the event handler (#3227), and to update min_interruption_words and min_interruption_duration, simply change the session.options via session.options.min_interruption_duration = 0.5.

so maybe you can already implement the per-state interruption options in the agent_state_changed event handler, I am curious to see if that could fix the issue, we can add it to the framework if it's better.

longcw avatar Sep 16 '25 03:09 longcw

Good idea, I missed this option. We came up with this config and shipped it, while testing it seemed much better, I hope

        @self.session.on("agent_state_changed")
        def on_agent_state_changed(event: AgentStateChangedEvent):
            logger.info("Agent state changed: %s", event)
            if event.new_state == "speaking":
                self._update_silero_vad_options(min_speech_duration=0.05)
                self.session.options.min_interruption_words = 2
                self.session.options.min_interruption_duration = 1.0
                self.session.options.min_endpointing_delay = 0.5
            elif event.new_state == "thinking":
                self._update_silero_vad_options(min_speech_duration=0.01)
                self.session.options.min_interruption_words = 0
                self.session.options.min_interruption_duration = 0.01
                self.session.options.min_endpointing_delay = 0.01
            else:
                self._update_silero_vad_options(min_speech_duration=0.05)
                self.session.options.min_interruption_words = 0
                self.session.options.min_interruption_duration = 0.5
                self.session.options.min_endpointing_delay = 0.5

Thanks for help πŸ™‡πŸΌβ€β™‚οΈ

Bnowako avatar Sep 16 '25 11:09 Bnowako

Thanks for help, closing the issue for now, if we will see the need for the improvements we will come up with pr and let's continue from there

Bnowako avatar Sep 17 '25 14:09 Bnowako

@Bnowako just confirming: are you still experiencing the original problem, or did the update address it?

hamza-ghufran avatar Nov 12 '25 15:11 hamza-ghufran