Skip to content

feat(endpointing): expose dynamic endpointing alpha parameter#1325

Open
toubatbrian wants to merge 3 commits intomainfrom
claude/jolly-lovelace-rlvBc
Open

feat(endpointing): expose dynamic endpointing alpha parameter#1325
toubatbrian wants to merge 3 commits intomainfrom
claude/jolly-lovelace-rlvBc

Conversation

@toubatbrian
Copy link
Copy Markdown
Contributor

Summary

Port of livekit/agents#5491 (Python) — exposes the alpha EMA (exponential moving average) coefficient for dynamic endpointing on the public EndpointingOptions config surface.

This is an automated Claude Code routine port created by @toubatbrian. Currently in experimentation stage.

What changed in Python (upstream)

The upstream PR adds a new alpha field to EndpointingOptions:

  • Field added to the EndpointingOptions TypedDict and _ENDPOINTING_DEFAULTS (default 0.9).
  • DynamicEndpointing.__init__ accepts alpha and forwards it to both internal EMA filters (_utterance_pause, _turn_pause).
  • DynamicEndpointing.update_options(...) accepts alpha and updates the EMA filters in place without resetting their learned state.
  • create_endpointing(options) reads options["alpha"] when constructing a DynamicEndpointing.
  • AgentSession.update_options(...) and agent_activity.endpointing_opts plumb alpha through from session-level → agent-level overrides.

The alpha controls how much weight is given to historical end-of-utterance pauses versus the latest sample (higher → more inertia, more smoothing).

What this JS PR does

  • Adds an alpha: number field to the EndpointingOptions interface in agents/src/voice/turn_config/endpointing.ts.
  • Adds the matching default alpha: 0.9 to defaultEndpointingOptions.

Implementation nuances / parity gap

agents-js does not currently ship a DynamicEndpointing runtime — only the fixed-delay path is wired through AudioRecognition via minEndpointingDelay / maxEndpointingDelay. There is no JS counterpart yet for:

  • DynamicEndpointing class with EMA filters (_utterance_pause, _turn_pause)
  • create_endpointing(options) factory selecting between fixed and dynamic modes
  • AgentSession.update_options(...) / AgentActivity.endpointing_opts runtime plumbing for endpointing fields

Because of that, this port stops at the config-surface level: it makes alpha a first-class option on EndpointingOptions so:

  1. Users who set turnHandling.endpointing.alpha today will not get a TypeScript error and the value is plumbed through mergeWithDefaults like the other endpointing fields.
  2. When the dynamic endpointing runtime is eventually ported to agents-js, the public config field is already in place — no breaking change to the option shape will be needed at that point.

The Python update_options(alpha=...) runtime path and the DynamicEndpointing test coverage (test_endpointing.py additions) are intentionally not ported here — they would be dead code without the underlying class, and porting the full dynamic endpointing implementation is out of scope for this small config-parity PR.

Files touched

  • agents/src/voice/turn_config/endpointing.ts — added alpha to interface + default.

Test plan

  • pnpm -w build succeeds (type-only addition, optional field with default).
  • turnHandling: { endpointing: { alpha: 0.7 } } accepted by AgentSessionOptions without TS errors.
  • No behavior change for existing fixed-mode users (alpha is unused at runtime today).

Reviewers

cc @toubatbrian @livekit/agent-devs


Linked Python PR: livekit/agents#5491


Generated by Claude Code

Port of livekit/agents#5491. Adds the `alpha` EMA coefficient to the
EndpointingOptions config surface so that, when the dynamic endpointing
runtime lands in agents-js, it is already configurable through the
public API (matches Python config shape).
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 Changeset detected

Latest commit: 74bae29

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@lukasIO
Copy link
Copy Markdown
Contributor

lukasIO commented Apr 27, 2026

should this be based on top of #1316?

devin-ai-integration[bot]

This comment was marked as resolved.

Per CLAUDE.md "Porting from Python" rule, every JS change that
corresponds to a Python change must carry an inline reference comment
above the relevant lines. Adds refs above the `alpha` field declaration
and the `alpha: 0.9` default, pointing at turn.py lines 63-66 and 73
respectively (livekit/agents#5491).
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.

2 participants