when using agent session, how do i retrieve localP...
# ask-ai
f
when using agent session, how do i retrieve localParticipants from the room?
t
Thanks for reaching out, Mok. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! In an agent session, the local participant is actually the agent themselves, and you can easily access it using the
local_participant
property of the room. Here's a quick example to help you out:
Copy code
# Python example
await room.local_participant.publish_data("hello world")

# Node.js example
await room.localParticipant?.sendText('hello world', { topic: 'hello-world' });
Sources: Inside a session | LiveKit Docs | Docs::Agents
f
i meant how to retrive the participants identity
t
I'm happy to help you with retrieving a participant's identity in LiveKit! You can easily access the
identity
property of the
Participant
object. Here are some examples for different SDKs to guide you: • JavaScript/TypeScript:
participant.identity
• Python:
participant.identity
• Node.js:
participant.identity
• Unity:
participant.Identity
Just so you know, the
identity
is unique within each room and you can access it for both local and remote participants. If you have any more questions or need further assistance, feel free to ask! Sources: livekit-rtc/livekit/rtc/room.py | packages/livekit-rtc/src/participant.ts | Runtime/Scripts/Room/Participant/Participant.cs | Managing participants | LiveKit Docs | Rooms, participants, and tracks | LiveKit Docs