steep-balloon-41261
09/22/2025, 6:42 PMtall-airline-16756
09/22/2025, 6:42 PMtall-airline-16756
09/22/2025, 6:43 PMVoicePipelineAgent or MultimodalAgent. Once set up, transcriptions will be automatically forwarded to clients if your frontend supports it.
• Next, listen for transcription events in your application. For example, if you're using JavaScript, you can use this snippet:
room.on(RoomEvent.TranscriptionReceived, (segments) => {
for (const segment of segments) {
console.log(`New transcription from ${segment.senderIdentity}: ${segment.text}`);
// Save the segment.text to your database here
}
});
• Each transcription segment comes with useful metadata like the sender's identity and the text itself. You can store these details in your database as you see fit.
• If you want to tailor the transcription behavior, there are options to disable transcription output or enable TTS-aligned transcriptions—feel free to customize it to what works best for you.
One important note: the RoomEvent.TranscriptionReceived event is deprecated and will be removed in a future version. To keep your implementation future-proof, it’s best to use text streams on the lk.chat topic instead.
Please don’t hesitate to reach out if you have any questions or need a hand with the implementation—I’m here to help!
Sources: Transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs | Docs::Agentstall-airline-16756
09/22/2025, 6:47 PMsession.history in the Python SDK! Let me walk you through how you can do this step-by-step:
1. Save Full Transcript at Session End
A great way to save the transcript is by using the add_shutdown_callback method, which triggers when the session ends. Here's a simple example for you:
from datetime import datetime
import json
def entrypoint(ctx):
session = AgentSession()
async def write_transcript():
current_date = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"/tmp/transcript_{ctx.room.name}_{current_date}.json"
with open(filename, 'w') as f:
json.dump(session.history.to_dict(), f, indent=2)
print(f"Transcript for {ctx.room.name} saved to {filename}")
ctx.add_shutdown_callback(write_transcript)
2. Real-Time Transcript Access
If you're interested in real-time updates, you can listen to events like user_input_transcribed. Here's how you might do that:
@session.on("user_input_transcribed")
def on_transcript(transcript):
if transcript.is_final:
print(f"Final transcript: {transcript.transcript}")
# You can save this to a database or process it further here
3. Structure of session.history
Just so you know, the session.history object includes:
• role: Who's speaking (user or assistant).
• text_content: The actual message text.
• timestamp: When the message happened (if available).
4. Additional Options
• You can enable or disable transcription using RoomOutputOptions.
• For word-level synchronization, try enabling TTS-aligned transcription with use_tts_aligned_transcript=True.
If you'd like, I’m here to help with more details or even a complete working example. Just let me know!
Sources: Session recording and transcripts | LiveKit Docs | complex-agents/teleprompter/README.md | Text and transcriptions | LiveKit Docs