microscopic-tiger-52909
08/30/2025, 5:19 PMtall-airline-16756
08/30/2025, 5:19 PMtall-airline-16756
08/30/2025, 5:19 PMagent.py, you can use the remove_participant method from the RoomService API. Here’s a quick example for you:
await self._lkapi.room.remove_participant(
api.RemoveParticipantRequest(
room=self._ctx.room.name,
identity=participant.identity
)
)
All you need to provide is the room name and the participant’s identity. You’ll see this in action in the livepaint example, where the agent first politely asks the participant to disconnect, waits a moment, and then removes them if necessary.
Just a heads up: removing someone doesn’t invalidate their token, so it’s a good idea to use short-lived tokens to avoid them reconnecting right away.
Sources: agent/game_host.py | livekit-api/livekit/api/room_service.py | Managing participants | LiveKit Docs