fierce-zoo-69908
12/07/2025, 4:45 AMtall-airline-16756
12/07/2025, 4:45 AMtall-airline-16756
12/07/2025, 4:45 AMparticipant_left / participantLeft).
• On each leave, fetch the current participant list.
• If exactly one participant remains and their kind is SIP, call the Room Delete API (delete_room / deleteRoom).
Implementation notes (concise examples)
• Python: after connecting your agent, subscribe to participant_left, call ctx.room.list_participants(), check len(participants) == 1 and participant.kind == livekit.ParticipantInfo.Kind.KIND_SIP, then call api.LiveKitAPI(...).room.delete_room(...).
• Node.js/TS: subscribe to participantLeft, call ctx.room.listParticipants(), check participants.length === 1 && participants[0].kind === 'SIP', then call RoomServiceClient.deleteRoom(roomName).
Why this is needed
• LiveKit does not automatically close rooms when a single SIP participant remains; SIP (and agent/service) participants are treated as long-lived. Explicitly deleting the room ensures it’s removed when your business logic requires it.
If you want, I can:
• Provide a ready-to-run code snippet for your stack (Node or Python).
• Recommend where to place this logic (agent entrypoint / server-side webhook). Sources: Agent server | LiveKit docs | Managing rooms | LiveKit docs