Skip to content

Conversation

@karlsonlee-livekit
Copy link

@karlsonlee-livekit karlsonlee-livekit commented Dec 21, 2025

Description

This PR introduces the @livekit/agents-plugin-xai package, enabling support for xAI's Realtime API (Grok) within the agents-js framework. It reuses the OpenAI plugin's infrastructure while handling xAI-specific configurations and protocol nuances.

Changes Made

  • Created @livekit/agents-plugin-xai: Initialized plugin with RealtimeModel implementation.
  • Configured Defaults: Set xAI base URL, default model (grok-4-1-fast-non-reasoning), and used server_vad for turn detection.
  • Improved Compatibility: Updated [@livekit/agents-plugin-openai] to safely handle optional part fields in response.content_part.done events (required for xAI compatibility).
  • Added Example: Included a usage example in examples/src/xai-realtime.ts.

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

@changeset-bot
Copy link

changeset-bot bot commented Dec 21, 2025

🦋 Changeset detected

Latest commit: e363f5e

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

This PR includes changesets to release 17 packages
Name Type
@livekit/agents-plugin-openai Major
@livekit/agents-plugin-xai Major
@livekit/agents-plugin-anam Major
@livekit/agents-plugin-cartesia Major
@livekit/agents-plugin-elevenlabs Major
@livekit/agents-plugin-google Major
@livekit/agents-plugin-neuphonic Major
@livekit/agents-plugin-resemble Major
@livekit/agents-plugin-rime Major
@livekit/agents Major
@livekit/agents-plugin-baseten Major
@livekit/agents-plugin-bey Major
@livekit/agents-plugin-deepgram Major
@livekit/agents-plugin-inworld Major
@livekit/agents-plugin-livekit Major
@livekit/agents-plugin-silero Major
@livekit/agents-plugins-test Major

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

@CLAassistant
Copy link

CLAassistant commented Dec 21, 2025

CLA assistant check
All committers have signed the CLA.

@karlsonlee-livekit
Copy link
Author

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.

3 participants