Skip to content

Add generate_reply and update_chat_ctx support to Phonic Plugin - #5058

Merged
tinalenguyen merged 9 commits into
livekit:mainfrom
Phonic-Co:qiong/add-generate-reply-and-update-chat-ctx
Mar 10, 2026
Merged

Add generate_reply and update_chat_ctx support to Phonic Plugin#5058
tinalenguyen merged 9 commits into
livekit:mainfrom
Phonic-Co:qiong/add-generate-reply-and-update-chat-ctx

Conversation

@qionghuang6

Copy link
Copy Markdown
Contributor

This PR adds support for generate_reply and update_chat_ctx to the Phonic Plugin.

These are implemented in:
livekit/agents-js#1103 and livekit/agents-js#1114 in the Livekit Agents JS repo.

generate_reply was recently added to Phonic as a feature.

For update_chat_ctx, we would like to support 2 scenarios:

  • Rehydrating a conversation with chat history when a RealtimeSession begins: For this use case, in situations where the config message has not yet been sent to Phonic, we include the conversation history's roles and text content as an addendum to the system prompt being sent over to Phonic.
  • Adding system or developer messages to the conversation history. If we detect that the chat_ctx has been updated to include these messages, we can send them to Phonic using the add_system_message message. This will allow the user to steer the conversation without calling generate_reply

I have also updated the example.

Here's a video demo: https://screen.studio/share/p6wLZbrY

@qionghuang6
qionghuang6 marked this pull request as ready for review March 9, 2026 23:42
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 thread examples/voice_agents/phonic_realtime_agent.py Outdated
@tinalenguyen

Copy link
Copy Markdown
Member

I tried out the example with phonic==0.31.3 and I get spammed with this error:

  01:24:35.537 WARNI… phonic.c…et_client Skipping unknown WebSocket message; update your SDK version to support new message types.  
  01:24:35.542 WARNI… phonic.c…et_client Skipping unknown WebSocket message; update your SDK version to support new message types.

Should I upgrade anything else or might I be missing something?

@qionghuang6

Copy link
Copy Markdown
Contributor Author

I tried out the example with phonic==0.31.3 and I get spammed with this error:

  01:24:35.537 WARNI… phonic.c…et_client Skipping unknown WebSocket message; update your SDK version to support new message types.  
  01:24:35.542 WARNI… phonic.c…et_client Skipping unknown WebSocket message; update your SDK version to support new message types.

Should I upgrade anything else or might I be missing something?

So sorry, there was an issue with today's updated SDK that I just patched.

@tinalenguyen tinalenguyen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thank you for the quick late night fix!

@tinalenguyen
tinalenguyen merged commit ee5837a into livekit:main Mar 10, 2026
13 of 19 checks passed
iancarrasco-b10 pushed a commit to iancarrasco-b10/agents that referenced this pull request Mar 17, 2026
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