helpful-insurance-33864
10/29/2025, 10:44 PMDELETE_ROOM. Does anyone know why the room might be deleted right after the agent disconnects, especially while other participants are still in it?tall-airline-16756
10/29/2025, 10:44 PMtall-airline-16756
10/29/2025, 10:45 PMdelete_room_on_close=True option. When this is turned on, the room gets automatically deleted through the deleteRoom API as soon as the agent session ends, even if there are still other participants in the room.
To help avoid this, you can make sure that delete_room_on_close is set to False in the RoomInputOptions when you start the agent session. This way, the agent can disconnect without deleting the room, so it stays available for everyone else who’s still there.
Sources: livekit-agents/livekit/agents/job.py | Managing rooms | LiveKit docs | Connecting to LiveKit | LiveKit docshelpful-insurance-33864
10/29/2025, 10:52 PMtall-airline-16756
10/29/2025, 10:52 PMhelpful-insurance-33864
10/29/2025, 11:02 PMtall-airline-16756
10/29/2025, 11:04 PMdelete_room_on_close setting. When rooms are created through dispatch rules, agents might be deployed with certain configurations. If an agent has delete_room_on_close=True, the room will be deleted as soon as that agent disconnects, even if others are still in the room.
To help avoid this, you can make sure the agent’s RoomInputOptions explicitly sets delete_room_on_close=False. This way, the room will stay open after the agent leaves, so other participants won’t be affected.
If you’re still experiencing issues after this, could you please let me know whether the dispatch rules are creating a new room for each session or if they’re reusing a shared room? That info will really help us dig deeper and find the best solution for you.
Sources: livekit-api/livekit/api/agent_dispatch_service.py | pkg/service/agent_dispatch_service.go | examples/voice_agents/session_close_callback.py | SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | SIP dispatch rule | LiveKit Docshelpful-insurance-33864
10/29/2025, 11:29 PMtall-airline-16756
10/29/2025, 11:29 PMdelete_room_on_close directly within dispatch rules. To help you better, could you please clarify a few things for me?
• Are you working with LiveKit Cloud or a self-hosted setup?
• Would you like to control room deletion when a SIP participant leaves, or only when all participants have left?
• Is this setting something you want to include as part of a room preset or a room configuration linked to the dispatch rule?
Getting these details will really help me guide you to the best solution for your setup. Looking forward to your reply!
Sources: SIP dispatch rule | LiveKit Docs | livekit-protocol/src/livekit.rs | packages/livekit-server-sdk/src/SipClient.ts | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | Development Tools & Resources | livekit/livekit_composite | DeepWikihelpful-insurance-33864
10/29/2025, 11:30 PMtall-airline-16756
10/29/2025, 11:31 PMdeparture_timeout parameter. Just set departure_timeout to 0 when you're creating or updating the room configuration. This way, the room will be deleted right after the last participant leaves—pretty handy, right?
For example, if you're using the CreateRoom API, you can do it like this:
CreateRoomRequest {
name: "my-room"
departure_timeout: 0
}
And if you’re working with a configuration file or SDK, just set departureTimeout to 0 in the room configuration. If you have any questions or want me to walk you through it, just let me know—I’m here to help!
Sources: livekit/livekit_room.pb.go | cmd/lk/room.go | Sources/LiveKit/Types/RoomConfiguration.swift | Core Platform Architecture & Authentication | livekit/livekit_composite | D... | examples/voice_agents/session_close_callback.pyhelpful-insurance-33864
10/30/2025, 12:12 AMtall-airline-16756
10/30/2025, 12:13 AMdeparture_timeout when using the AgentDispatch method with the Golang SDK, you’ll want to set this parameter in the room configuration right when you create the room. The departure_timeout is really useful because it makes sure the room only gets deleted after everyone has left and the timeout period has passed.
Here’s a simple example to guide you:
client, err := livekit.NewRoomServiceClient("wss://your-server-url", "api-key", "api-secret")
if err != nil {
log.Fatal(err)
}
room, err := client.CreateRoom(context.Background(), &livekit.CreateRoomRequest{
Name: "example-room",
DepartureTimeout: 120, // 2 minutes
})
if err != nil {
log.Fatal(err)
}
Just be sure to replace "wss://your-server-url", "api-key", and "api-secret" with your own LiveKit Cloud credentials. You can also adjust the DepartureTimeout value to fit your needs—for example, use 0 if you want the room to be deleted immediately.
If you have any questions or need a hand with anything else, please don’t hesitate to ask. I’m here to help!
Sources: livekit/src/room/mod.rs | pkg/service/utils.go | src/main/kotlin/io/livekit/server/RoomServiceClient.kt | livekit-rtc/livekit/rtc/_proto/room_pb2.pyi | Sources/LiveKit/Types/RoomConfiguration.swifthelpful-insurance-33864
10/30/2025, 1:09 AMctx.shoutdown() hook?tall-airline-16756
10/30/2025, 1:10 AMctx.shutdown() function works in LiveKit. This function is designed to gracefully disconnect an agent from a room without disturbing other participants or the room itself. When you call it, the agent leaves the room, but everyone else can keep enjoying their session without any interruptions. Plus, it takes care of running the agent's shutdown hooks for any cleanup or post-processing tasks.
It’s important to know that ctx.shutdown() doesn’t delete the room or affect other participants in any way. If you’ve noticed the room getting deleted after the agent disconnects, it’s probably because the delete_room_on_close option is set to True in your agent's RoomInputOptions. This setting is what tells the system to delete the room once the agent’s session ends.
So, if you want the room to stay active even after the agent leaves, just double-check that delete_room_on_close is set to False. Feel free to reach out if you’d like me to walk you through this or if you have any other questions—I’m here to help!
Sources: examples/voice_agents/realtime_joke_teller.py | agent.py | Job lifecycle | LiveKit Docs | Managing rooms | LiveKit docs