quaint-gigabyte-48282
10/08/2025, 8:08 AMtall-airline-16756
10/08/2025, 8:08 AMtall-airline-16756
10/08/2025, 8:08 AMtranscription_enabled=True in RoomOutputOptions. Here’s a simple example to get you started:
await session.start(
agent=YourAgent(),
room=ctx.room,
room_output_options=RoomOutputOptions(
transcription_enabled=True,
audio_enabled=False, # disable if audio output isn’t needed
),
)
1. Save Full Transcript: You can easily access the conversation history using session.history and save it when the session shuts down. Here’s how you might do that:
@session.on("shutdown")
async def on_shutdown():
history = session.history
with open("transcript.json", "w") as f:
f.write(history.model_dump_json(indent=2))
1. Real-Time Transcription: If you want to get live updates, listen for events like user_input_transcribed. It’s a great way to stay in the loop as things happen:
@session.on("user_input_transcribed")
async def on_transcribed(text: str, is_final: bool):
if is_final:
logger.info(f"Final transcript: {text}")
1. Advanced Option: For more customized handling, you can use text streams with the topic lk.transcription. Here’s a snippet to guide you:
await self._room.local_participant.stream_text(
topic=TOPIC_TRANSCRIPTION,
sender_identity=self._participant_identity,
attributes=attributes,
)
If you’d like to dive deeper, the LiveKit Session Recording docs and the Python transcription example are fantastic resources. Feel free to explore them at your own pace!
Sources: livekit-agents/livekit/agents/tts/tts.py | Session recording and transcripts | LiveKit Docs | Agents v0.x migration guide - Python | LiveKit Docs | Agents v0.x migration guide - Node.js | LiveKit Docs