able-jackal-19719
08/26/2025, 12:19 PMtall-airline-16756
08/26/2025, 12:19 PMtall-airline-16756
08/26/2025, 12:19 PMable-jackal-19719
08/26/2025, 12:20 PMtall-airline-16756
08/26/2025, 12:20 PMclose_on_disconnect is enabled. If that’s turned off, no worries—you can just close the session yourself with session.aclose().
Here’s a quick rundown:
• Automatic Closure: Make sure close_on_disconnect=True (which is the default). This way, the session wraps up as soon as the participant leaves.
• Manual Closure: Keep an eye out for the participant_disconnected event, then call session.aclose() in your agent code.
• Room-Level Termination: If you want to end everything—including agents and recordings—just use ctx.delete_room().
If you want a hand setting any of this up, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/voice/room_io/room_io.py | Inside a session | LiveKit Docsable-jackal-19719
08/26/2025, 12:23 PMsession.aclose() what event will be triggered? does the agent session on close event will be triggered?tall-airline-16756
08/26/2025, 12:24 PMsession.aclose(), it kicks off the agent session's on close event. This event happens when the session closes, and you can catch it by using the .on("close") handler on your AgentSession instance.
Feel free to ask if you'd like me to explain more or share some examples!
Sources: Events and error handling | LiveKit Docs | Events and error handling | LiveKit Docs | examples/voice_agents/error_callback.py | basics/exit_message.py