what are participant kinds in livekit? class Part...
# ask-ai
c
what are participant kinds in livekit? class ParticipantKind(_ParticipantKind, metaclass=_ParticipantKindEnumTypeWrapper): ... PARTICIPANT_KIND_STANDARD: ParticipantKind.ValueType # 0 PARTICIPANT_KIND_INGRESS: ParticipantKind.ValueType # 1 PARTICIPANT_KIND_EGRESS: ParticipantKind.ValueType # 2 PARTICIPANT_KIND_SIP: ParticipantKind.ValueType # 3 PARTICIPANT_KIND_AGENT: ParticipantKind.ValueType # 4 global___ParticipantKind = ParticipantKind which one can i use to identify my own agent?
t
Thanks for reaching out, Faraz. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit supports several participant kinds to help you better understand who’s in your session: • STANDARD: These are your regular end-user participants, like those joining from web or mobile clients. • AGENT: These are server-side processes that are created using the LiveKit Agents framework. • SIP: These participants connect through SIP trunking, typically telephony users. • INGRESS: These handle media ingestion, such as RTMP or WHIP streams. • EGRESS: These are processes that record or export media streams. If you want to identify your own agent, just take a look at the
kind
field in the
ParticipantInfo
object. When it shows
AGENT
, that means the participant is a LiveKit agent. And if you’re using SDKs like Swift, you can also check the
isAgent
property for a quick confirmation. Sources: Community & Support | livekit/livekit_composite | DeepWiki | Rooms, participants, and tracks | LiveKit docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | livekit/livekit_models.pb.go | livekit-protocol/src/livekit.rs
c
how do i list all the active participants in the room? what markers will tell me that an active participant is my agent vs my customer?
t
Hi there! To see all the active participants in a LiveKit room, you can use the
ListParticipants
API. This handy API gives you a list of
ParticipantInfo
objects for everyone currently in the room. Just make sure your token has the
roomList
grant so you can access this feature smoothly. Now, if you want to tell agents and customers apart, you can look at the
kind
field in each
ParticipantInfo
object: • AGENT: These are your server-side agents coming from the LiveKit Agents Framework. • STANDARD: These represent regular end-users or customers. Here’s a quick example in Python to help you get started:
Copy code
agents = [p for p in participants.participants if p.kind == "AGENT"]
customers = [p for p in participants.participants if p.kind == "STANDARD"]
And if you’re using the Swift SDK, it’s even simpler—you can directly grab the agents with the
agentParticipants
property like this:
Copy code
let agentParticipants = room.agentParticipants
If you have any questions or need more help, feel free to ask. We're here to make sure everything goes smoothly for you! Sources: Managing participants | LiveKit docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | Sources/LiveKit/Agent/Room+Agent.swift
c
how do i use the list participants api? can you give me an example? what does the participant info object look lik?
t
I'm happy to guide you through using the
ListParticipants
API in LiveKit! Here's a simple way to get started: Python Example:
Copy code
from livekit import api

# Initialize the API client
lkapi = api.LiveKitAPI()
room_service = lkapi.room

# List participants in a room
list_request = ListParticipantsRequest(room="room-name")
response = await room_service.list_participants(list_request)

# Access the participants
participants = response.participants  # List[ParticipantInfo]
Just a quick note: Make sure your token has
room_admin=True
privileges for the room you're querying to access this information. About the ParticipantInfo Object: Each participant includes these helpful details: • sid: Unique ID for the participant. • identity: The unique identity they used to connect. • state: Their current state (like JOINING, JOINED, ACTIVE, or DISCONNECTED). • kind: The type of participant (such as STANDARD or AGENT). • metadata: Any user-specified metadata. • joined_at: When they joined the room. • tracks: The list of tracks they've published. If you'd like, I’m here to help with more details or examples for other SDKs—just let me know!