feat(xai): add TTS websocket pooling#2025
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 432b074 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
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 |
Verify xAI TTS reuses fresh pooled connections and rotates them before the provider deadline. Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure flushed utterances complete independently while sharing the pooled websocket. Co-authored-by: Cursor <cursoragent@cursor.com>
Keep multi-segment coverage type-safe under the package declaration build. Co-authored-by: Cursor <cursoragent@cursor.com>
Lock down the public streaming and audio metadata exposed by the new provider. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add xAI TTS support to the JS plugin and configure its pooled websocket lifetime below xAI's undocumented server-side deadline.
The source change only adjusted the xAI TTS websocket pool deadline, but the target repo did not yet have an xAI TTS implementation. This PR ports the missing TTS infrastructure so the deadline behavior exists in agents-js rather than dropping it.
Source diff coverage
livekit-plugins/livekit-plugins-xai/livekit/plugins/xai/tts.py: adapted toplugins/xai/src/tts.tsandplugins/xai/src/index.ts. The target had no xAI TTS counterpart, so this ports the missing xAI websocket TTS implementation into the xAI plugin, exports it publicly, and applies the source change asmaxSessionDuration: 1_800_000ms, the JS equivalent of Python's1800seconds. The source comment about xAI's undocumented roughly 2100s websocket deadline is preserved next to the pool setting.Testing
pnpm test plugins/xai(8 passed, 1 skipped)pnpm --filter @livekit/agents-plugin-xai buildpnpm --filter @livekit/agents-plugin-xai lintpnpm buildThe package lint completes with two pre-existing
no-explicit-anywarnings inplugins/xai/src/_utils.ts.Runtime validation
Arareturned 24 kHz mono PCM successfully.sid_07063c0f2886exercised the changed provider through a complete LiveKit room turn. The greeting emitted xAI TTS usage for 43 characters / 3.13 seconds of audio, and a voice prompt traversed STT → LLM → xAI TTS before committingPooling works.withtts_node_ttfbabout 405 ms.Ported from livekit/agents#6393
Original PR description
closes #6390
Cue voice E2E
sid_10ecd2a5f336at head432b0746.connectionCount=1,streamCount=4.~/.cue-cli/sessions/sid_10ecd2a5f336/.