salmon-scientist-37595
09/22/2025, 6:51 PMtall-airline-16756
09/22/2025, 6:51 PMtall-airline-16756
09/22/2025, 6:52 PMstream_text() method on the local participant to send your transcription data. Make sure to set the topic to 'lk.transcription' and include helpful metadata like lk.transcribed_track_id and lk.segment_id to keep everything in sync.
2. Other participants can receive these transcriptions by registering a handler for the 'lk.transcription' topic using registerTextStreamHandler().
Here’s an example of how you might send a transcription:
const writer = await room.localParticipant.stream_text({
topic: 'lk.transcription',
attributes: {
'lk.transcribed_track_id': trackSid,
'lk.segment_id': 'segment-123',
'lk.transcription.final': 'false'
}
});
await writer.write("Hello world");
await writer.aclose({ 'lk.transcription.final': 'true' });
And to receive transcriptions, you can do this:
room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
let message = '';
for await (const chunk of reader) {
message += chunk;
console.log(`Partial transcription:`, message);
}
});
This way, everyone in the room will get the transcription events smoothly. If you have any questions or want to dive deeper into this, just let me know—I’m here to help!
Sources: hooks/useDataStreamTranscriptions.ts | Text and transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs | packages/core/src/observables/dataChannel.tssalmon-scientist-37595
09/22/2025, 6:53 PMtall-airline-16756
09/22/2025, 6:54 PMAgentSession with transcription enabled.
When the agent processes speech-to-text (STT), the transcriptions are automatically shared with all participants through the 'lk.transcription' text stream topic. This covers both what users say and the agent’s responses, and they’re nicely synced with the audio playback by default.
If you’d like, you can also tweak this behavior using `RoomOutputOptions`:
• Turn off transcription forwarding: transcription_enabled: false
• Turn off sync with audio: sync_transcription: false
Feel free to reach out if you want a hand setting this up or if you have any other questions—I’m here to help!
Sources: Text and transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs | agents/src/voice/room_io/_output.ts | livekit-agents/livekit/agents/voice/room_io/_output.py