late-helmet-58096
09/11/2025, 11:08 AMtall-airline-16756
09/11/2025, 11:08 AMtall-airline-16756
09/11/2025, 11:09 AMtranscription_node
or llm_node
to process and forward speech as it happens. Events like user_input_transcribed
and conversation_item_added
are great for capturing transcriptions in real time.
• Session-Level Transcripts: If you'd like to access the full conversation history, the session.history
property is your go-to. Plus, you can save the transcript after the session ends by using add_shutdown_callback
.
• Frontend Integration: You can forward transcriptions to clients using the lk.transcription
text stream topic. There are also synchronization options available for agent speech transcriptions to keep everything smooth.
• STT Plugin-Based Transcription: Another option is to use a standalone speech-to-text plugin to create a streaming transcription agent and forward the results to your clients.
If you want to dive deeper into the implementation, I highly recommend checking out the Voice AI quickstart and the Transcriptions documentation. They have some fantastic resources that can really help you along the way.
Sources: Session recording and transcripts | LiveKit Docs | Session recording and transcripts | LiveKit Docs | agents/src/voice/agent_activity.ts | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | Transcriptions | LiveKit Docslate-helmet-58096
09/11/2025, 1:17 PMtall-airline-16756
09/11/2025, 1:17 PMRoomEvent.TranscriptionReceived
event is a great way to catch real-time transcriptions. And don’t worry, similar options are available for Android and Flutter SDKs too.
• Server-Side: If you want to handle transcriptions outside of the agent logic, you can register a text stream handler for the lk.transcription
topic. This is especially helpful if you're looking to monitor or process things on the backend.
• Agent Logic: You can also access real-time transcriptions through the transcription_node
or by listening to events like user_input_transcribed
and conversation_item_added
. Plus, if you need the full conversation history, the session.history
has you covered.
If you want to dive deeper, I highly recommend checking out the Text and Transcriptions documentation—it’s a fantastic resource that walks you through everything step-by-step.
Sources: Transcriptions | LiveKit Docs | Docs::Agents | src/components/playground/Playground.tsx | examples/other/chat-stream-receiver.py | Session recording and transcripts | LiveKit Docstall-airline-16756
09/11/2025, 1:18 PMRoomEvent.TranscriptionReceived
event. For instance, if you're working with JavaScript, you might try something like this:
room.on(RoomEvent.TranscriptionReceived, (segments, participant) => {
segments.forEach((segment) => {
console.log(`Transcription from ${participant.identity}: ${segment.text}`);
});
});
• This kind of support is also available if you're using Android, Flutter, or other SDKs.
• Another neat option is the useTrackTranscription
hook for React components, which helps keep your transcriptions nicely synchronized.
• Server-Side: If you want to handle transcriptions outside of the agent logic, you can register a text stream handler for the lk.transcription
topic. Here's a quick example in Python:
room.register_text_stream_handler(topic="lk.transcription", handler=on_transcription_received)
• Agent Logic: You also have the option to access real-time transcriptions through the transcription_node
or by listening to events like user_input_transcribed
. Plus, if you need the full conversation history, you can retrieve it using session.history
.
If you'd like to dive deeper, feel free to check out the Text and Transcriptions documentation. It's a great resource to guide you step-by-step.late-helmet-58096
09/11/2025, 1:45 PMtall-airline-16756
09/11/2025, 1:47 PMsession.history
property.
• Listen to Real-Time Events: It’s super helpful to capture events like user_input_transcribed
or conversation_item_added
so you can log transcripts as they happen.
• Save History After Session: When your session ends, you can save the conversation history by using the add_shutdown_callback
method, storing it in a file like JSON or text.
Here’s a simple example to load and save your chat history in Python:
from livekit.agents import Agent, AgentSession, llm
async def entrypoint(ctx):
chat_history = [
{"role": "assistant", "content": "Hello, how can I help you?"},
{"role": "user", "content": "Tell me about Paris."}
]
chat_ctx = llm.ChatContext.empty()
for item in chat_history:
chat_ctx.add_message(role=item["role"], content=item["content"])
session = AgentSession()
agent = Agent(
instructions="You are a helpful assistant.",
llm=llm.realtime.RealtimeModel(model="gpt-4o-mini-realtime-preview"),
chat_ctx=chat_ctx
)
await session.start(agent=agent, room=ctx.room)
session.interrupt()
session.generate_reply()
# Save history to a file
with open("conversation_history.json", "w") as file:
file.write(session.history)
If you want to explore more or need additional details, feel free to check out the Text and Transcriptions documentation. I’m here if you have any questions along the way!
Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime... | Recording agent sessions | LiveKit Docs | Recording agent sessions | LiveKit Docs | Realtime model integrations | LiveKit Docs | Session recording and transcripts | LiveKit Docs