wide-elephant-63050
09/26/2025, 10:58 PMtall-airline-16756
09/26/2025, 10:58 PMtall-airline-16756
09/26/2025, 10:59 PMsession.history object holds the complete conversation history, and by using the add_shutdown_callback method, you can have it saved automatically. Here’s a simple example to guide you:
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 Access:
If you’d like to access the transcript as it’s being created, you can use the useTranscriptions() hook from @livekit/components-react or listen for events like TranscriptionReceived in the client SDKs. Just a heads-up, this method doesn’t save the transcript automatically once the session ends.
If you’d like, I’m here to help you set this up! Just let me know what environment you’re working in (like Python or Node.js), and I can provide more tailored advice.
Sources: Transcriptions | LiveKit Docs | Session recording and transcripts | LiveKit Docs | Docs::Agents | Session recording and transcripts | LiveKit Docs | complex-agents/note-taking-assistant/note-taker-frontend/hooks/useChatAndTr...