fierce-jordan-44682
09/05/2025, 8:55 AMtall-airline-16756
09/05/2025, 8:55 AMtall-airline-16756
09/05/2025, 8:56 AMctx (Job Context) right at the start of the entrypoint function. It only becomes available after you connect to the room and get a RemoteParticipant instance.
Here’s how you can access the participant name:
• First, connect to the room using ctx.connect().
• Then, wait for a participant to join with await ctx.wait_for_participant() or set up a listener using ctx.add_participant_entrypoint().
• Finally, you can grab the name via RemoteParticipant.name.
If you’d like to have the participant name earlier on, a handy trick is to pass it explicitly through job.metadata when dispatching the job, so you can access it right away in the entrypoint function.
Sources: Inside a session | LiveKit Docs | Job lifecycle | LiveKit Docs | External data and RAG | LiveKit Docs | examples/primitives/participant_entrypoint.pyfierce-jordan-44682
09/05/2025, 8:57 AMRemoteParticipant.name
Where do I access this from? is it from job context?? bascially i am fine with getting the name after connecting to the room. Do i need to await ctx.wait_for_participant() if i am doing automatic dispatch of agent based on token with user identity?tall-airline-16756
09/05/2025, 8:58 AMRemoteParticipant.name, you can grab it from the RemoteParticipant object right after you connect to the room. Here’s a quick example:
await ctx.connect()
participant = await ctx.wait_for_participant()
print(f"Participant name: {participant.name}")
If you’re using automatic dispatch of agents based on tokens with user identity, you don’t absolutely need to use ctx.wait_for_participant(), but it’s a good idea. It helps your code wait until at least one human participant has joined the room. Otherwise, the remote_participants list might be empty if no one’s joined yet.
Another way is to loop through the participants who are already connected like this:
for participant in ctx.room.remote_participants.values():
print(f"Participant name: {participant.name}") Sources: complex-agents/ivr-agent/agent.py | Rooms, participants, and tracks | LiveKit Docs | Inside a session | LiveKit Docs | Dispatching agents | LiveKit Docs