famous-needle-51751
08/12/2025, 6:09 PMtall-airline-16756
08/12/2025, 6:10 PMtall-airline-16756
08/12/2025, 6:10 PMfamous-needle-51751
08/12/2025, 6:11 PMtall-airline-16756
08/12/2025, 6:11 PMAgentSession
instances, like those lasting around 30 minutes, LiveKit has some handy ways to help you manage their lifecycle smoothly:
• Drain Timeout: The drain_timeout
parameter lets your sessions wrap up gracefully. By default, it’s set to 30 minutes.
• User Inactivity Handling: The user_away_timeout
helps spot when a user’s been inactive and can close sessions after a set time.
• Graceful Shutdown: If the system gets a shutdown signal, it gives your current sessions time to finish up within the drain_timeout
.
• Session Monitoring: There are tools to tidy up resources if sessions get abandoned.
If you find your session needs to run longer than 30 minutes, no worries—you can tweak the drain_timeout
or set up your own inactivity handling to fit your needs.
Sources: Worker options | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.py | Agents Core Architecture | livekit/livekit_composite | DeepWiki