agents icon indicating copy to clipboard operation
agents copied to clipboard

Dynamic endpointing forgets what it learned at every agent handoff

Open Rehansanjay opened this issue 2 weeks ago • 0 comments

With endpointing={"mode": "dynamic"}, DynamicEndpointing learns the caller's pause length in an EMA (endpointing.py#L76). But every AgentActivity builds a new one when it starts (agent_activity.py#L1383), so each session.update_agent() resets min_delay to the configured floor. In a multi-agent flow, a caller whose longer pauses the endpointing had already learned (say, around 1.2 s) gets cut off again right after the handoff, at the point where they're most likely to pause: reading out details for the new agent.

The same happens on session.update_options(endpointing=...) (agent_activity.py#L888): it creates a fresh endpointing object even when only max_delay changes, although DynamicEndpointing.update_options() exists and would keep the learned value.

This came up on the forum (https://community.livekit.io/t/2483), where it was noted that nothing on GitHub covers it yet.

Possible fix: handoffs already carry state across via _ReusableResources (agent_activity.py#L186): the STT pipeline, the turn detector stream and the realtime session. The learned pause could go the same way: when both activities use dynamic endpointing, seed the new DynamicEndpointing's filter with the old learned value, clamped to the new min_delay/max_delay. If the new agent uses fixed endpointing, nothing carries over.

Happy to open a PR with tests (a handoff after the delay has been learned, and an update_options call that only changes max_delay) if this direction is wanted.

Rehansanjay avatar Nov 17 '26 03:11 Rehansanjay