Skip to content

Add Phonic Realtime Plugin#1059

Merged
toubatbrian merged 20 commits intolivekit:mainfrom
Phonic-Co:main
Feb 20, 2026
Merged

Add Phonic Realtime Plugin#1059
toubatbrian merged 20 commits intolivekit:mainfrom
Phonic-Co:main

Conversation

@qionghuang6
Copy link
Copy Markdown
Contributor

@qionghuang6 qionghuang6 commented Feb 18, 2026

Description

  • This PR adds Basic Support for Phonic (https://docs.phonic.co/) as a Realtime Plugin.
  • At this time, tool use and generateReply are not supported, but we plan on supporting these features in the future. Phonic does not support updateInstructions, updateChatCtx, and truncate
  • Users can still use Webhook tools that they have defined on the Phonic platform (also executed on Phonic's platform) when passed in via phonicTools, or if included as a property of an agent defined on the Phonic platform (phonicAgent option)

Changes Made

  • Add a new Phonic plugin, implementing RealtimeSession, mostly following the structure of the Gemini realtime plugin, with some simplifications.
  • RealtimeSession uses the phonic SDK to connect to Phonic via WebSockets
  • Although Phonic sends audio via the WebSocket at all times, we only use audio during assistant turns, aligning with the generations paradigm in the OpenAI and Gemini Realtime implementations.
  • I have also not included anything to emit a usage event. The reason is because the RealtimeModelMetrics shape doesn't fit Phonic's billing structure, which is by number of seconds. I used the stt_metrics structure, but have removed it from this PR.

Demo

https://drive.google.com/file/u/3/d/1e3WdrlTozqGc7DG8eufa4qUVGSWkJZqF/view?usp=sharing

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

  • Tested talking to the Phonic agent using the Livekit Agent Playground.
  • Ensured that conversation items in the Livekit Agent Insights, on the Playground, and in ChatCtx are consistent with the recording on Phonic's end
  • Ensured that config options are propagated properly.

Testing was done using the agent-starter-node repo, pointing to the plugin and agents-js locally:

    "@livekit/agents": "file:../livekit-agents-js/agents",
    "@livekit/agents-plugin-phonic": "file:../livekit-agents-js/plugins/phonic",

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

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 18, 2026

⚠️ No Changeset found

Latest commit: ff8a6b4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 18, 2026

CLA assistant check
All committers have signed the CLA.

@qionghuang6 qionghuang6 marked this pull request as ready for review February 18, 2026 21:53
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment on lines +270 to +271
async commitAudio(): Promise<void> {}
async clearAudio(): Promise<void> {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are these left empty on purpose or that they are not supported yet? Sould we add some kind of warning messages or throw if it is not supported?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@toubatbrian commitAudio or clearAudio are not supported yet.
I left them empty because I saw that in your implementation of the Google realtime plugin at google/src/beta/realtime/realtime_api.ts:1583, these were left empty without logging a warning.
Would you prefer a logger warning here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding a warning log.

@@ -0,0 +1,3 @@
# @livekit/agents-plugin-phonic
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add some setup code sample in README? Also, it'd be good to showcase a example file under ./src/examples/ folder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I'll add an example!

Copy link
Copy Markdown
Contributor

@toubatbrian toubatbrian left a comment

Choose a reason for hiding this comment

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

Left some comments. Please also fix the LISCENCE issue in the CI, thanks

devin-ai-integration[bot]

This comment was marked as resolved.

@qionghuang6
Copy link
Copy Markdown
Contributor Author

I added an example and updated how instructions are used to better align with the other examples. Let me know if there's anything else I might want to look out for!

@toubatbrian toubatbrian merged commit 5bce865 into livekit:main Feb 20, 2026
4 checks passed
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