fierce-jordan-44682
10/01/2025, 3:45 AMtall-airline-16756
10/01/2025, 3:45 AMtall-airline-16756
10/01/2025, 3:45 AM@ctx.room.on("participant_disconnected") event is designed to track when any remote participant disconnects, which includes both local participants and agents—it doesn’t exclude agents by default.
If you want to specifically keep an eye on when an agent disconnects, a helpful way is to check the participant's kind property. Here’s a little example to guide you:
@ctx.room.on("participant_disconnected")
def _on_participant_disconnected(participant: rtc.RemoteParticipant):
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_AGENT:
# Handle agent disconnection
pass
Using this method, you can easily manage agent disconnections separately. Hope this helps! If you have any more questions, feel free to ask—we’re here for you.
Sources: Handling events | LiveKit Docs | livekit-rtc/livekit/rtc/_proto/room_pb2.pyi | examples/warm-transfer/warm_transfer.pyfierce-jordan-44682
10/01/2025, 3:46 AMtall-airline-16756
10/01/2025, 3:47 AM@ctx.room.on("participant_disconnected") event, you can simply filter participants by checking their kind property. Here’s a friendly example to guide you:
@ctx.room.on("participant_disconnected")
def on_participant_disconnected(participant: rtc.RemoteParticipant):
if participant.kind != rtc.ParticipantKind.PARTICIPANT_KIND_AGENT:
# Handle only non-agent participants
print(f"Non-agent participant disconnected: {participant.identity}")
# Feel free to add your custom logic here
This way, you’ll be sure that only the disconnections of participants who aren’t agents will trigger your logic. If you have any questions or want to explore this further, I’m here to help!
Sources: agent-console/lib/event-types.ts