creamy-window-79763
10/14/2025, 4:09 PMtall-airline-16756
10/14/2025, 4:09 PMtall-airline-16756
10/14/2025, 4:10 PMremoveParticipant method from the RoomServiceClient. This method will gently disconnect the specified participant (including agents) from the room, while keeping the room itself safe and sound.
Here’s a friendly example in Node.js/TypeScript to guide you:
import { RoomServiceClient } from 'livekit-server-sdk';
const roomService = new RoomServiceClient(
process.env.LIVEKIT_URL,
process.env.LIVEKIT_API_KEY,
process.env.LIVEKIT_API_SECRET
);
// Remove the agent by specifying the room name and the agent's identity
await roomService.removeParticipant(roomName, agentIdentity);
Just swap out roomName with your room's name and agentIdentity with the agent's identity you want to remove. This will disconnect the agent right away, without disturbing the room itself. If you have any questions or need more help, feel free to ask—I'm here for you!
Sources: Managing participants | LiveKit Docs | agent-console/app/api/room/remove-participant/route.ts | pkg/rtc/room.go | Job lifecycle | LiveKit Docscreamy-window-79763
10/14/2025, 4:10 PMtall-airline-16756
10/14/2025, 4:11 PMremove_participant method from the RoomService client. Here's a simple example to guide you through it:
from livekit import api
import asyncio
async def remove_participant_from_room():
lkapi = api.LiveKitAPI("https://your-livekit-server.com")
try:
await lkapi.room.remove_participant(
api.RoomParticipantIdentity(room="my-room", identity="participant-identity")
)
print("Participant removed successfully")
except Exception as e:
print(f"Failed to remove participant: {e}")
finally:
await lkapi.aclose()
asyncio.run(remove_participant_from_room())
Just swap out "my-room" with your actual room name, and "participant-identity" with the participant's identity you want to remove. Also, handling exceptions like in the example will help you catch any issues smoothly. If you have any questions or run into troubles, feel free to ask—I'm here to help!
Sources: Managing participants | LiveKit Docs | Connecting to LiveKit | LiveKit Docs | README.md | pkg/service/roommanager.gocreamy-window-79763
10/14/2025, 4:13 PMtall-airline-16756
10/14/2025, 4:13 PMfrom livekit import api
import asyncio
async def remove_agent_from_room():
lkapi = api.LiveKitAPI("https://your-livekit-server.com")
try:
# Just replace 'room-name' with your room's name and 'agent-identity' with the agent's identity
await lkapi.room.remove_participant(
api.RoomParticipantIdentity(room="room-name", identity="agent-identity")
)
print("Agent removed successfully")
except Exception as e:
print(f"Failed to remove agent: {e}")
finally:
await lkapi.aclose()
asyncio.run(remove_agent_from_room())
Simply swap out "room-name" for your actual room name and "agent-identity" for the agent's identity you'd like to remove. This will disconnect the agent right away without impacting the rest of the room. If you have any questions or need further help, feel free to ask!creamy-window-79763
10/14/2025, 4:52 PMtall-airline-16756
10/14/2025, 4:53 PMidentity property on the participant object. This works for both local and remote participants, so you don’t always have to rely on the local participant to get this info.
Here’s a simple way to do it:
• For the local participant: Just use room.localParticipant.identity.
• For a remote participant: You can use remoteParticipant.identity, or find them by identity with methods like getParticipantByIdentity() or by checking the room's participant map.
The identity is a unique string assigned to each participant as soon as they join the room, so you’ll have this information right away.
Sources: Tests/LiveKitCoreTests/ParticipantTests.swift | livekit/src/room/mod.rs | Rooms, participants, and tracks | LiveKit Docs | livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt | README.md