how can i get access to the full converstation tra...
# ask-ai
w
how can i get access to the full converstation transcript?
t
Thanks for reaching out, Mohammad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help you access the full conversation transcript in LiveKit! You have a couple of options depending on what works best for you: 1. Post-Session Transcript Retrieval: After your session ends, you can use the agent code to save the entire transcript. The
session.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:
Copy code
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...