lemon-match-18357
07/24/2025, 11:59 PMtall-airline-16756
07/24/2025, 11:59 PMtall-airline-16756
07/25/2025, 12:00 AMCLIENT_INITIATED, ROOM_DELETED, or USER_REJECTED.
• Worker Lifecycle Management: By default, a room is automatically closed when the last non-agent participant leaves. Any remaining agents will also disconnect.
To address this issue, you can:
1. Modify the auto-close behavior by setting RoomInputOptions.close_on_disconnect to False to prevent automatic closure when participants disconnect.
2. Implement a close event handler to debug the issue and understand why the session is closing. For example:
@session.on("close")
def on_close(ev: CloseEvent):
print(f"Agent Session closed, reason: {ev.reason}")
This will help you identify the specific reason for the immediate closure, such as CLIENT_INITIATED, ROOM_DELETED, USER_REJECTED, or JOB_SHUTDOWN.
Please check the close reason and ensure that participants are properly joining and remaining in the room when the session is created.
Sources: Rooms, participants, and tracks | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | Worker lifecycle | LiveKit Docs