victorious-train-86407
08/12/2025, 10:44 AMtall-airline-16756
08/12/2025, 10:44 AMtall-airline-16756
08/12/2025, 10:45 AMAgentSession
to manage those transcription events.
3. Then, add an event handler for user_input_transcribed
events to catch and save the transcription results into a list.
4. Finally, append the final transcription results to a Python list.
Here’s a quick example to get you started:
from livekit.agents.voice import Agent, AgentSession
from livekit.plugins import deepgram
async def entrypoint(ctx):
session = AgentSession()
transcriptions_list = []
@session.on("user_input_transcribed")
def on_transcript(transcript):
if transcript.is_final:
transcriptions_list.append(transcript.transcript)
await session.start(
agent=Agent(
instructions="Transcribe user speech to text.",
stt=deepgram.STT()
),
room=ctx.room
)
With this, all the final transcriptions will be saved in the transcriptions_list
, ready for you to use however you like.
If you want me to walk you through any part or need more help, just let me know—I’m here for you!