What are the possible reasons to get "closing agen...
# ask-ai
r
What are the possible reasons to get "closing agent session due to participant disconnect"
t
Thanks for reaching out, Trevor. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking why you see "closing agent session due to participant disconnect." Here are the possible reasons and what they mean: • User ended the conversation or left the room (participant voluntarily disconnected). • The room closed automatically when the last non-agent participant left, which disconnects remaining agents. • The participant was removed via the
RemoveParticipant
API (disconnect reason
PARTICIPANT_REMOVED
). • The room was deleted via the
DeleteRoom
API (disconnect reason
ROOM_DELETED
). • Network or media path failure (e.g., WebRTC keep-alives stopped,
CONNECTION_TIMEOUT
,
PEER_CONNECTION_DISCONNECT
, or
STATE_MISMATCH
). • Unclean client disconnect or crash (client stopped responding and was timed out). • Duplicate identity: another participant joined using the same identity and the earlier participant was disconnected. • Participant marked idle/away (default timeout), combined with session logic that closes agent sessions. If you want, tell me which disconnect reason(s) or event logs you see (for example:
PARTICIPANT_REMOVED
,
ROOM_DELETED
,
STATE_MISMATCH
, or
CONNECTION_TIMEOUT
) and the room/participant context — I can suggest the next troubleshooting steps. Sources: Events and error handling | LiveKit docs | Agent server | LiveKit docs | Connecting to LiveKit | LiveKit docs | Understanding the STATE_MISMATCH Disconnect Reason | Server-side | livekit/livekit_composite | DeepWiki
r
What does CLIENT_INITIATED mean?
t
You're asking what the disconnect reason CLIENT_INITIATED means. CLIENT_INITIATED indicates the participant intentionally closed their session from the client side — for example, the client app called
Room.disconnect()
or an equivalent leave action. It maps to the server internal reason
ParticipantCloseReasonClientRequestLeave
and represents a normal, graceful disconnection initiated by the client (not a network failure, server action, or crash). Sources: Server-side | livekit/livekit_composite | DeepWiki
r
so this is like, they hung up in SIP context?
t
Yes — that's a good analogy. CLIENT_INITIATED is equivalent to a user intentionally hanging up in SIP: it means the client requested to leave (e.g.,
Room.disconnect()
), a graceful, user‑driven disconnect rather than a network failure or server action. If you want, I can outline which disconnect reasons you should treat like user hangups vs. errors for your logging or UX.