miniature-nail-35141
07/10/2025, 9:40 AMtall-airline-16756
07/10/2025, 9:40 AMtall-airline-16756
07/10/2025, 9:41 AMremoveParticipant
method available in the LiveKit server SDKs (Node.js, Python, Go, Kotlin, Rust). This action requires roomAdmin permissions and will forcibly disconnect the target participant from the room. Here is a summary of the main approaches:
• Node.js: await roomService.removeParticipant(roomName, identity);
• Python: await room_service.remove_participant(RoomParticipantIdentity(room="room_name", identity="participant_identity"))
Key steps:
1. Identify the room name and the participant's identity (the agent you want to remove).
2. Call the relevant removeParticipant
method from your backend using the server SDK with the necessary credentials.
Note: Removing an agent will disconnect them, but their token is not invalidated—they could re-join if they still possess a valid token. To prevent rejoining, limit the token’s TTL or avoid issuing a new one to that participant.
If you need code samples or instructions for another SDK or want to know how to handle agent roles specifically, let me know your stack and I can provide tailored details.
References: Node.js, Python, Go, Kotlin, Rust SDK docs and LiveKit API documentation.
Sources: livekit-api/livekit/api/room_service.py | Managing participants | LiveKit Docs | src/main/kotlin/io/livekit/server/RoomServiceClient.kt | livekit/livekit_room.twirp.go | packages/livekit-server-sdk/src/RoomServiceClient.ts | livekit-api/src/services/room.rs | agent-console/hooks/use-livekit/use-livekit-action.tsx | pkg/rtc/room.go | agent/game_host.pyminiature-nail-35141
07/10/2025, 9:45 AMtall-airline-16756
07/10/2025, 9:46 AMctx.room.remote_participants.values()
and you'll easily access each participant's identity
while you're connected to the room.
• Server-side: If you're on the backend, the server API's list_participants
method is your friend. It'll fetch all participants in a room, complete with identity
and sid
details. Here's a quick Python example to show you how:`participants_response = await lkapi.room.list_participants(room_proto.ListParticipantsRequest(room=room_name))
for participant in participants_response.participants:
print(f"Identity: {participant.identity}")
print(f"SID: {participant.sid}")`
Pro tip: Just remember that participant.identity
is the unique ID you set up (perfect for your app logic), while sid
is the system-generated identifier. For most scenarios, you'll want to use identity
when you're looking to target or remove an agent from a room.
Sources: Managing participants | LiveKit Docs | mcp/server.py | Core API primitives | LiveKit Docs | Inside a session | LiveKit Docs | How to set a fixed participant for agent audio processingminiature-nail-35141
07/10/2025, 12:10 PMtall-airline-16756
07/10/2025, 12:11 PMremove_participant
method. Let me help you sort this out. The method is actually part of the RoomService
class in the Python SDK, and you'll want to access it through lkapi.room.remove_participant(...)
. Usually, this error pops up when there's a small mix-up with imports, how you're using the LiveKitAPI
object, or if your SDK is a bit outdated.
• Here's the right way to do it:
from livekit import api
lkapi = api.LiveKitAPI(url, api_key, api_secret)
await lkapi.room.remove_participant(
api.RoomParticipantIdentity(room="room-name", identity="participant-identity")
)
Just make sure you're calling remove_participant
on lkapi.room
(not straight from the module), and if things are still wonky, try upgrading your LiveKit Python SDK. You've got this! 😊
Sources: livekit-api/livekit/api/room_service.py | agent/game_host.pyminiature-nail-35141
07/10/2025, 12:29 PMtall-airline-16756
07/10/2025, 12:30 PMlist_participants
method from the server API, which makes it super easy to see who's in the room.
from livekit import api
from livekit.protocol import room as room_proto
lkapi = api.LiveKitAPI(url, api_key, api_secret)
request = room_proto.ListParticipantsRequest(room="room-name")
response = await lkapi.room.list_participants(request)
for participant in response.participants:
print(f"Identity: {participant.identity}")
print(f"SID: {participant.sid}")
print(f"State: {participant.state}")
print(f"Metadata: {participant.metadata}")
Quick tip: Just make sure you've got room_admin
permissions in your access token, and you'll be all set!
Sources: README.md | telephony/sip_lifecycle.py