Access transcripts and typed messages from Cloud Agent Embed Widget host page

I’m using a LiveKit Cloud Agent with the Agent Embed Widget inside my desktop application.

The deployed agent uses Python AgentSession with openai.realtime.RealtimeModel (gpt-realtime-2). Voice conversations through the Embed Widget are already working.

I want my host application to do two things with the widget’s existing voice session:

  1. Receive the finalized user speech transcript and agent response transcript so I can display both in my application’s own conversation UI.
  2. Send a typed user message from my application’s text input into that same active agent session/context, so voice and typed input share one conversation.

While inspecting the widget, I can see transcription functionality being consumed internally, but I have not found a documented host-page callback/event API or an exposed LiveKit Room / session object.

Does the Cloud Agent Embed Widget expose a supported public JavaScript API for either of these?

  • Subscribe to user and agent transcript events from the existing widget session
  • Send typed messages into that same session/context

If yes, could you provide the API or a minimal example?

If the Embed Widget intentionally does not expose these capabilities, is the recommended approach to replace the widget with a custom LiveKit client while continuing to use the same deployed Cloud Agent?

I specifically want to avoid relying on undocumented widget internals.

@Mike925, The Embed Widget’s documented surface is the script tag plus data-attribute customization, nothing more (embed widget). It does not expose a public host-page API for transcript events or for sending text into its session, so there is no supported way to do either through the widget. Avoiding its internals is the right call; they can change without notice.

The supported path is the one you proposed: run a custom LiveKit web client against the same deployed Cloud Agent. That client owns the Room, so you subscribe to transcripts and send typed text on documented topics, and because voice and text go through the same agent session, they share one conversation.

Transcripts arrive as a text stream on lk.transcription; the lk.transcription_final attribute marks final vs interim, so you render only finalized lines (text & transcriptions). Typed input goes out with sendText on the lk.chat topic, which the AgentSession consumes as user text:

room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
  const text = await reader.readAll();
  const isFinal = reader.info.attributes?.['lk.transcription_final'] === 'true';
  if (isFinal) render(participantInfo.identity, text);   // user + agent finalized lines
});

await room.localParticipant.sendText(userTyped, { topic: 'lk.chat' });