When I call `await self.room.local_participant.pub...
# ask-ai
i
When I call
await self.room.local_participant.publish_track(self._video_track)
which participant it actually refers to? Agent or user participant?
t
Thanks for reaching out, Jan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When calling
await self.room.local_participant.publish_track(self._video_track)
, the
local_participant
refers to the user participant. It represents the local user who is publishing the track, not an agent participant. Sources: Inside a session | LiveKit Docs | livekit/src/room/participant/local_participant.rs | Rooms, participants, and tracks | LiveKit Docs
i
how to refer to agent participant to publish the track?
Hello, tell me how to get the agent participant in the room
t
Hey there! To grab the agent participant in a LiveKit room, here are some easy ways depending on the SDK or framework you're using: • Swift SDK: Just use the
agentParticipant
property on the
Room
object to get the agent participant directly. • JavaScript/TypeScript: You can filter the
remoteParticipants
collection to find the one with
kind === 'AGENT'
, and make sure it’s not an avatar worker by checking that the
lk.publish_on_behalf
attribute isn’t there. • React: The
useVoiceAssistant
hook is your friend here—it gives you the agent participant along with its state and tracks. If you want me to dive deeper or share some examples for a specific SDK, just give me a shout!
i
I am talking about the python solution
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!