rich-monitor-70665
05/06/2026, 12:21 PM@session.on("user_input_transcribed")
def on_transcript(ev):tall-airline-16756
05/06/2026, 12:21 PMtall-airline-16756
05/06/2026, 12:21 PMuser_input_transcribed handler. I can help with that.
It's common for LiveKit event objects to include a participant property. Try accessing ev.participant.identity (or ev.participant.id) inside your handler. For example:
@session.on("user_input_transcribed")
def on_transcript(ev):
participant = getattr(ev, "participant", None)
if participant is not None:
identity = getattr(participant, "identity", None) or getattr(participant, "id", None)
print("participant identity:", identity)
else:
print("participant not present on event:", ev)
If that doesn't work, could you:
• Share the runtime error or the printed ev structure (e.g., print(ev.__dict__))?
• Tell me which LiveKit Python package/version you're using?
With that I can give a precise field name or alternative.
Sources: Layered Caller Verification for LiveKit SIP Calls | LiveKit | Turns overview | LiveKit Documentation, with interactive elementsrich-monitor-70665
05/06/2026, 12:23 PMtall-airline-16756
05/06/2026, 12:23 PMev for user_input_transcribed does not include a participant field.
Use the session's linked participant instead. For example:
@session.on("user_input_transcribed")
def on_transcript(ev):
linked = session.room_io.linked_participant
if linked:
print("participant identity:", linked.identity)
else:
print("no linked participant (session.room_io.linked_participant is None)")
If you need to target a specific participant in multi‑participant rooms, create a RoomIO bound to that identity when you start the session:
room_io = RoomIO(session, room=ctx.room, participant="desired-participant-identity")
If that doesn't match your setup, please share:
• the printed structure of ev (e.g., print(ev.__dict__))
• the livekit-agents package version
and I’ll guide the exact fix.
Sources: Agent session | LiveKit Documentation | How to set a fixed participant for agent audio processing, with interactive elementsrich-monitor-70665
05/06/2026, 12:25 PMtall-airline-16756
05/06/2026, 12:25 PMuser_input_transcribed does not include a participant object. The transcription payload you showed (type, transcript, is_final, speaker_id, etc.) is expected and won't contain the participant identity.
What you can do instead:
• Use the session's linked participant: session.room_io.linked_participant (or session.linked_participant depending on your setup). This is the participant the session is currently wired to for audio I/O.
@session.on("user_input_transcribed")
def on_transcript(ev):
linked = session.room_io.linked_participant
if linked:
print("participant identity:", linked.identity)
else:
print("no linked participant")
• If you need transcripts tied to a specific participant in a multi-participant room, create the session with a RoomIO bound to that identity:
room_io = RoomIO(session, room=ctx.room, participant="desired-participant-identity")
Note: speaker_id in the event may be None in many setups; it is not a reliable substitute for participant identity unless your configuration explicitly populates it.
If you want, share your livekit-agents version and how you create the session/RoomIO and I’ll suggest the exact code changes.
, with interactive elementsrich-monitor-70665
05/06/2026, 12:26 PMtall-airline-16756
05/06/2026, 12:27 PMspeaker_id to get the participant identity.
Short answer: you cannot reliably map speaker_id to LiveKit participant.identity. speaker_id comes from STT speaker diarization (labels like "A", "B") and is not the same as LiveKit participant identity. It may also be None for short utterances.
What you can do:
• If you only need one participant’s audio, bind the session to that participant so all transcripts belong to that identity:
room_io = RoomIO(session, room=ctx.room, participant="desired-participant-identity")
• For multi‑participant rooms, restrict which participant(s) feed the STT by configuring RoomInputOptions / RoomIO so you only process known identities.
• Enable diarization in your STT config (e.g., speaker_labels=True for AssemblyAI) if you want diarization output — but note diarization still won’t provide participant.identity.
If you need a manual mapping approach, I can suggest workflows (for example, creating short registration prompts per participant to map diarization labels to identities), but I’ll need:
• your livekit-agents SDK version, and
• which STT provider and diarization settings you’re using.
Which of those would you like to try?
Sources: AssemblyAI STT | LiveKit Documentation | Deepgram STT | LiveKit Documentation | Speech-to-text (STT) models overview | LiveKit Documentation | Agent session | LiveKit Documentation | How to set a fixed participant for agent audio processing, with interactive elements