Add onRichContent callback - #912
Merged
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
giannagerton
force-pushed
the
gianna/rich-content-pr-1
branch
from
August 3, 2026 17:09
e30bbbb to
0659a44
Compare
giannagerton
marked this pull request as ready for review
August 4, 2026 14:23
giannagerton
force-pushed
the
gianna/rich-content-pr-1
branch
from
August 4, 2026 17:58
0659a44 to
a9b4b67
Compare
Removed unnecessary comments from onRichContent API documentation.
kamilk-11
approved these changes
Aug 11, 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
Adds an experimental
onRichContentcallback so the SDK can hand off agent-driven UI components (e.g. an item card) to whoever's consuming it.RichContentClientEvent/RichContentDataschema in@elevenlabs/types(AsyncAPI + generated types)onRichContentcallback in@elevenlabs/client, dispatched fromBaseConversationthe same way every other server-pushed event is — no reply sent back, the agent's turn doesn't wait on it@elevenlabs/react'sHookCallbacksBacks the embedded widget, which is the only client the server sends components to today — this callback won't fire for other consumers yet.
propsis agent-authored; treat it as untrusted when rendering.Summary
RFC
Adds an experimental
onRichContentcallback so the SDK can hand off agent driven UI to the widget.RichContentClientEvent/RichContentDataschema in@elevenlabs/typesonRichContentcallback in@elevenlabs/client, dispatched fromBaseConversation. No reply sent back, the agent's turn doesn't wait on it@elevenlabs/react'sHookCallbacksNote
Medium Risk
New experimental surface that forwards untrusted
propsto app code; misuse when rendering could introduce XSS, but core conversation and auth paths are unchanged.Overview
Adds
rich_contentto the agent WebSocket contract and wires it through@elevenlabs/types,@elevenlabs/client, and@elevenlabs/reactas an experimentalonRichContentcallback.When the server sends a display component (e.g.
item_card), the client invokes the callback with{ rich_content_id, component, props, event_id }. Unlikeclient_tool_call, the SDK does not send a response, so the agent turn is not blocked on the client.BaseConversationdispatchesrich_contentinonMessageviahandleRichContent; tests cover payload forwarding, nosendMessage, and missing callback. The changeset notespropsshould be treated as agent-authored and untrusted when rendering into a document.Reviewed by Cursor Bugbot for commit a9b4b67. Bugbot is set up for automated code reviews on this repo. Configure here.