crooked-zebra-83774
12/11/2025, 3:14 PMtall-airline-16756
12/11/2025, 3:14 PMtall-airline-16756
12/11/2025, 3:14 PMsession.history (which contains prior transcriptions) or your persistent store.
• Add a REST or WebSocket endpoint that returns the full transcript (or a range).
• On FE, fetch that endpoint immediately after authentication and render the returned transcript, then subscribe to live lk.transcription updates via room.registerTextStreamHandler to append new lines.
2) Replay past transcriptions into the room (advanced)
• Agent republishes historical transcription messages onto the lk.transcription text stream when a new participant joins.
• Tag replayed messages (e.g., attribute replay=true) so the frontend can display them as historical.
3) Post-session reports (if only needed after session)
• Use make_session_report() or session reporting to retrieve the full transcript after the session ends.
If you want, I can:
• Provide a concise Node.js example for a REST endpoint that returns session.history.
• Show the exact FE code to fetch that endpoint and wire room.registerTextStreamHandler for live updates.
Which example would you like?
Sources: Text and transcriptions | LiveKit docs | Observability data hooks | LiveKit docscrooked-zebra-83774
12/11/2025, 3:16 PMtall-airline-16756
12/11/2025, 3:16 PMlk.transcription text stream (or a custom text topic) when a new participant joins. Tag replayed messages (e.g., attribute replay=true) so the FE can distinguish history from live updates.
• Send a summary via data messages: use room.localParticipant.sendText() (or other data message APIs) to push a full transcript or summary to connected clients on a custom topic like transcript-full.
• Egress / storage export: use LiveKit Egress to write the full transcript (or session report) to cloud storage (S3/GCS) and share the storage URL with the FE. This is best if you only need the complete transcript after or near the end of the session.
• Agent-side push to your backend (if available): if you have any external backend you control, the agent can post history to that backend, and the FE can fetch it there.
Quick clarification to recommend exact steps Do you need transcripts delivered in real time to users who join mid-session, or is it acceptable to provide the full transcript only after/near session end?
Sources: Text and transcriptions | LiveKit docs | Observability data hooks | LiveKit docs | Sending text | LiveKit docs | Agent insights in LiveKit Cloud | LiveKit docs | Agents (Node.js) | livekit/livekit_composite | DeepWikicrooked-zebra-83774
12/11/2025, 3:18 PMlk.transcription text stream (or a custom text topic) when a new participant joins. Tag replayed messages (e.g., attribute replay=true) so the FE can distinguish history from live updates.tall-airline-16756
12/11/2025, 3:18 PMreplay=true. It uses a custom topic so you don't interfere with live lk.transcription.
Server / Agent (Node.js)
1. Store transcripts as they arrive:
const transcriptHistory: Array<{text: string, meta?: any}> = [];
session.on(voice.AgentSessionEventTypes.ConversationItemAdded, (event) => {
const txt = event.item.textContent;
if (txt) transcriptHistory.push({ text: txt, meta: { role: event.item.role } });
});
1. When a participant joins, create a text writer targeted to that identity and publish history with attributes:
const REPLAY_TOPIC = 'lk.transcription_replay';
ctx.room.on('participant_joined', async (participant) => {
const writer = await ctx.room.localParticipant.streamText({
topic: REPLAY_TOPIC,
attributes: { replay: 'true' },
destinationIdentities: [participant.identity],
});
for (const entry of transcriptHistory) {
await writer.write(entry.text);
}
await writer.close();
});
Notes:
• Use destinationIdentities so only the joining participant receives the replay.
• Add per-message metadata if you need timestamps/roles: either include in the text (JSON) or maintain parallel attributes if supported.
Frontend
1. Register handler for replay topic and for live transcriptions:
room.registerTextStreamHandler('lk.transcription_replay', async (reader, participantInfo) => {
const msg = await reader.readAll();
// treat as historical because attribute replay=true is set on the stream
displayTranscript({ text: msg, replay: true });
});
room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
const msg = await reader.readAll();
displayTranscript({ text: msg, replay: false });
});
1. If you need to mark boundary between replayed history and live updates, show a divider after replayed items or use the replay flag.
Variations / Considerations
• If you need per-message attributes (timestamps/roles), send JSON strings and parse on FE.
• If many messages/large history, paginate replay (send chunks) to avoid UI freeze.
• Use a custom topic name to avoid confusion with live transcription consumers.
• If you want replays to be visible to multiple existing participants, omit destinationIdentities or include more identities.
If you want, I can:
• Show how to include timestamps/role metadata in the messages,
• Provide a chunked replay example (pagination) for very large histories,
• Or adapt this to send replays on the live lk.transcription topic and include a replay attribute instead. Which would you prefer? Sources: Sending text | LiveKit docs