narrow-pager-84057
10/31/2025, 7:42 AMtall-airline-16756
10/31/2025, 7:42 AMtall-airline-16756
10/31/2025, 7:42 AMdeleteRoom endpoint to immediately end the session for everyone involved. This will stop any further audio or processing right away.
2. Enable automatic room deletion: When you start an AgentSession, simply set the delete_room_on_close option to True in RoomInputOptions. This way, the room will be deleted automatically as soon as the agent session closes. Here's a quick example:
await session.start(
agent=MyAgent(),
room=ctx.room,
room_input_options=RoomInputOptions(
delete_room_on_close=True,
),
)
3. Manually stop egress or close the agent session: If you’re working with recordings, you might want to manually stop egress when the participant leaves or call session.aclose() to end the session immediately.
From my experience, the best way to handle this is by deleting the room as soon as the participant leaves—either by using the server API or by enabling delete_room_on_close in your agent setup. If you have any questions or need further guidance, feel free to ask. I'm here to support you!
Sources: Job lifecycle | LiveKit Docs | livekit-agents/livekit/agents/voice/room_io/room_io.py | How to capture real-time agent transcriptions during conversationsnarrow-pager-84057
10/31/2025, 7:44 AMtall-airline-16756
10/31/2025, 7:44 AMclose_on_disconnect option is set to True, which it is by default.
If you’re noticing a delay, it could be related to other settings like room lifecycle configurations or recording processes. Please feel free to let me know if you'd like me to help you take a closer look at those—I’m here to help!
Sources: CHANGELOG.md | livekit-agents/livekit/agents/utils/http_context.py | Worker options | LiveKit Docs