polite-furniture-24847
10/15/2025, 6:25 AMtall-airline-16756
10/15/2025, 6:26 AMtall-airline-16756
10/15/2025, 6:26 AMDisconnected event for them.
Here's a friendly example in Node.js:
const roomService = new RoomServiceClient(LIVEKIT_URL, API_KEY, API_SECRET);
await roomService.removeParticipant('roomName', 'agentIdentity');
And here’s how you can do it in Python:
from livekit import api
lk_api = api.LiveKitAPI("wss://your-livekit-url", "API_KEY", "API_SECRET")
await lk_api.room.remove_participant(
room="roomName",
identity="agentIdentity"
)
If you prefer the agent to disconnect itself in a smooth and graceful way, you can call session.shutdown() within the agent’s logic. This helps make sure any necessary cleanup happens before the agent leaves the room.
Please feel free to reach out if you have any more questions or need a hand with anything else—I’m here to support you!
Sources: pkg/rtc/room.go | Job lifecycle | LiveKit Docs | Managing participants | LiveKit Docs | Managing rooms | LiveKit Docspolite-furniture-24847
10/15/2025, 7:29 AMtall-airline-16756
10/15/2025, 7:30 AMfrom livekit.api import LiveKitAPI
import asyncio
async def delete_room():
lkapi = LiveKitAPI()
await lkapi.room.delete_room(DeleteRoomRequest(room="your-room-name"))
Also, if you're working with LiveKit Agents, a handy tip is to set delete_room_on_close=True in RoomInputOptions. This way, the room will be deleted automatically when the agent session ends.
If you have any questions or want me to walk you through this step-by-step, just let me know—I’m here to help!
Sources: pkg/service/roomservice.go | Connecting to LiveKit | LiveKit Docs | Managing rooms | LiveKit Docs | examples/voice_agents/error_callback.py | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name