adorable-bear-14321
04/06/2026, 3:37 PMtall-airline-16756
04/06/2026, 3:37 PMtall-airline-16756
04/06/2026, 3:37 PMdrain_timeout to the maximum time you want the server to wait for active jobs during shutdown. Key points:
• drain_timeout is the maximum wait (default 1800 seconds / 30 minutes).
• Configure it when constructing the server, e.g.:
server = AgentServer(
drain_timeout=600, # 10 minutes
)
• On shutdown the server stops accepting new jobs and waits up to drain_timeout for active jobs to finish; if jobs exceed that time an asyncio.TimeoutError occurs and the process exits.
• In LiveKit Cloud, the effective drain window may be limited by Cloud policies (instances can get up to 1 hour during rolling deployments), so the actual shutdown window is the minimum of your drain_timeout and the Cloud policy.
If you’re not using AgentServer, or you want the process to stop exactly at a fixed time (not just a maximum wait), tell me what runtime or job system you’re using and whether jobs can be checkpointed or cancelled — I’ll give precise steps.
Sources: Server options | LiveKit Documentation | Deployment reliability on LiveKit Cloud | LiveKit, with interactive elementsadorable-bear-14321
04/06/2026, 3:38 PMtall-airline-16756
04/06/2026, 3:38 PMdrain_timeout to the maximum seconds you want the server to wait for active jobs during shutdown (example: drain_timeout=600 for 10 minutes). The server will stop accepting new jobs, wait up to that timeout for active jobs to finish, and then exit (jobs still running will be terminated and an asyncio.TimeoutError will occur). Note Cloud deployments may impose their own maximum (up to 1 hour), so the effective window is the minimum of your drain_timeout and the Cloud policy.
If you mean a different process or need the shutdown to occur exactly at a fixed time (not just a maximum wait), please tell me:
• which runtime or job system you’re using (AgentServer, systemd, Kubernetes, plain Python process, etc.), and
• whether jobs can be cancelled, checkpointed, or must finish gracefully.
I’ll give specific steps once you confirm.
, with interactive elements