aloof-hydrogen-58523
04/15/2026, 5:15 PMtall-airline-16756
04/15/2026, 5:15 PMtall-airline-16756
04/15/2026, 5:16 PMclose_on_disconnect / delete_room_on_close is set as you expect.
• Departure timeout: rooms close only after the departure timeout (default ~20s) plus the sweeper delay (~30–45s). If your load is high, cleanup can appear delayed.
• Room ID reuse / race conditions: rapidly re-creating rooms with the same name can cause cleanup delays. Using unique room names (UUIDs or timestamps) avoids this.
Immediate actions you can take
• Verify agent sessions: confirm agent participants are actually disconnected when users leave and that delete_room_on_close (or equivalent) is enabled for agent sessions.
• Manually delete stuck rooms via the server API (deleteRoom) for any urgent cleanup.
• Check recent deploys or config changes that might affect session close behavior.
If you share whether you’re using agents and one example room ID or timestamps, I’ll check the most likely causes and suggest the exact setting change or the API call you should run.
Sources: Agent session | LiveKit Documentation | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | Job lifecycle | LiveKit Documentation, with interactive elementsaloof-hydrogen-58523
04/15/2026, 5:17 PMdelete_room_on_closetall-airline-16756
04/15/2026, 5:17 PMdelete_room_on_close and how to use it.
What it does
• delete_room_on_close makes the room be deleted immediately when an agent session ends, disconnecting any remaining participants. It prevents leftover rooms after the session shuts down.
Defaults & availability
• Default: False.
• Available in the Python SDK. Node.js does not expose this flag; you must delete the room via the server API instead.
How to use (Python)
1. Set it in RoomOptions when starting an `AgentSession`:
await session.start(
agent=boss_agent,
room=ctx.room,
room_options=room_io.RoomOptions(delete_room_on_close=True),
)
1. When the session ends (e.g., session.shutdown()), the room will be deleted automatically.
If you’re not using Python
• Call the server API deleteRoom after the agent session ends to remove the room immediately.
If you want, tell me which SDK you’re using (Python or Node.js) and an example room ID — I can give the exact API call or a code snippet to delete stuck rooms.
Sources: Agent session | LiveKit Documentation | Job lifecycle | LiveKit Documentation | Build a salary negotiation coach with a LemonSlice avatar | LiveKit, with interactive elementsaloof-hydrogen-58523
04/15/2026, 5:19 PMtall-airline-16756
04/15/2026, 5:19 PMdelete_room_on_close deletes the room immediately when the agent session ends. There is no built‑in option to add a delay to that behavior.
• If you need a delay, implement manual deletion in your agent logic instead of using `delete_room_on_close`:
a. End the session without delete_room_on_close.
b. Wait the desired amount of time (e.g., await asyncio.sleep(seconds) in Python).
c. Call the server API deleteRoom (or api_client.room.delete_room(...)) to remove the room.
Tell me which SDK you’re using (Python or Node.js) and how long a delay you want, and I’ll provide a short code snippet for that flow.
Sources: Agent session | LiveKit Documentation | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | Job lifecycle | LiveKit Documentation, with interactive elementsaloof-hydrogen-58523
04/15/2026, 5:20 PMtall-airline-16756
04/15/2026, 5:21 PMroom_io from `livekit.agents`:
from livekit.agents import room_io Sources: Agent session | LiveKit Documentation, with interactive elementsaloof-hydrogen-58523
04/15/2026, 10:36 PMin delete_room\n return await self._client.request(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/bundle/lib/python3.12/site-packages/livekit/api/twirp_client.py\", line 129, in request\n raise TwirpError(\nlivekit.api.twirp_client.TwirpError: TwirpError(code=not_found, message=requested room does not exist, status=404tall-airline-16756
04/15/2026, 10:36 PMrequested room does not exist error when calling delete_room.
What this error means
• The server cannot find a room with the name you passed to delete_room. Common causes:
◦ The room was already deleted (double-delete).
◦ A race condition: you called delete before the room was fully created or after auto-cleanup finalized.
◦ The room name/ID passed is incorrect or malformed.
◦ Temporary DB/state lag or connectivity issues causing the room to be unavailable.
Quick checks to run
• Confirm the exact room name you pass to delete_room (the API identifies rooms by name).
• Check logs/timestamps: does a prior delete or auto-close happen before this call? Look for earlier delete calls, agent shutdowns, or auto-cleanup events.
• If you recreate rooms with the same name, add a short delay (1–2 minutes) or better, use unique names (UUID/timestamp) to avoid reuse/race issues.
• If you suspect transient state lag, retry the delete once after a short backoff and log the room existence before attempting deletion.
If you want, share:
• The SDK and code snippet you use to call delete_room (Python or Node).
• An example room name/ID and the timestamps around create/delete attempts.
I can then suggest a short code change (existence check + safe retry or unique naming) or a specific retry/backoff snippet for your SDK.
Sources: Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name, with interactive elementsaloof-hydrogen-58523
04/15/2026, 10:37 PMtall-airline-16756
04/15/2026, 10:37 PM