early-butcher-66889
12/23/2025, 1:22 AMtall-airline-16756
12/23/2025, 1:23 AMtall-airline-16756
12/23/2025, 1:23 AMon_participant_join, on_participant_leave). Short answer and guidance below.
Acknowledgement
• The Agent class does not expose on_participant_join / on_participant_leave lifecycle methods.
What to use instead
• Participant lifecycle is handled on the room object via event listeners:
◦ participant_connected — when a remote participant joins
◦ participant_disconnected — when a participant leaves
◦ Other participant-related events you can listen for: track_published, track_unpublished, participant_attributes_changed, participant_metadata_changed
Where to attach listeners
• Register handlers on the room available from JobContext or AgentSession. Example:
@server.rtc_session()
async def entrypoint(ctx: JobContext):
@ctx.room.on("participant_connected")
def on_participant_connected(participant):
print(f"Participant {participant.identity} joined.")
@ctx.room.on("participant_disconnected")
def on_participant_disconnected(participant):
print(f"Participant {participant.identity} left.")
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
Agent lifecycle hooks (separate)
• The Agent class provides conversation-flow hooks, not room events:
◦ on_enter() — when agent becomes active
◦ on_exit() — before agent gives control to another agent
◦ on_user_turn_completed() — when user finishes speaking
Documentation link
• For the full event list and examples, see: https://docs.livekit.io/home/client/events
If you want, I can:
• List all room event names and signatures relevant to Python agents, or
• Show a fuller example demonstrating subscribing/unsubscribing listeners and handling track events.
Which would you prefer?
Sources: Handling events | LiveKit docs | Job lifecycle | LiveKit docs | Pipeline nodes and hooks | LiveKit docs