microscopic-gold-81132
03/23/2026, 1:40 PMtall-airline-16756
03/23/2026, 1:40 PMtall-airline-16756
03/23/2026, 1:41 PMmicroscopic-gold-81132
03/23/2026, 1:45 PMentrypoint is called again (agent is dispatched again)tall-airline-16756
03/23/2026, 1:46 PMentrypoint runs again and a new worker connects to the same room.
Short answer
• This is expected behavior. When the main LiveKit server kills an unresponsive agent worker, the job is re-dispatched and a new worker process will be started (and will connect to the same room) so the job can continue. This failover behavior is part of LiveKit’s agent/job lifecycle and is not something you can disable.
Why this happens
• The server treats a killed/unresponsive worker as an unfulfilled job and re-dispatches it to available agents.
• If the same agent is still registered/available, it receives the job and invokes entrypoint again, creating a fresh worker process.
• The new process connects to the same room because the job is tied to that room and the room typically still exists (for example, other participants remain). This design preserves continuity instead of dropping the session.
What you can do to reduce or control reconnections
• Ensure workers shut down gracefully where possible:
◦ Implement graceful disconnects and cleanup in your agent code so that when the process is terminated it notifies or disconnects cleanly instead of leaving partial state.
• Improve worker stability:
◦ Allocate sufficient CPU/memory and avoid resource throttling that could cause the worker to become unresponsive.
◦ Add error handling and timeouts in the agent logic to avoid stalls.
• Adjust deployment/scale strategy:
◦ Run multiple agents for redundancy (the framework supports multiple workers per agent_name).
◦ Scale horizontally rather than relying on frequent restarts.
• Monitoring and diagnostics:
◦ Monitor worker health, resource usage, and logs to find why a worker becomes unresponsive (e.g., long GC pauses, blocking I/O, heavy CPU).
◦ If you can capture stack traces or core dumps from the unresponsive worker, that helps pinpoint root cause.
Relevant links
• Server lifecycle: https://docs.livekit.io/agents/server/lifecycle/
• Job lifecycle: https://docs.livekit.io/agents/server/job/
• Server options (graceful shutdown / configuration): https://docs.livekit.io/agents/server/options/
If you’d like, I can:
• Help review specific log excerpts (redact secrets) to look for root-cause clues.
• Suggest code patterns for graceful shutdown in your agent entrypoint.
• Recommend metrics to monitor that commonly precede unresponsiveness (CPU, memory, event loop/blocking indicators).
Which would you prefer next?
Sources: Troubleshooting Latency and Timeout Errors with Turn Detection on AWS | Job lifecycle | LiveKit Documentation | Agents Framework | livekit/livekit_composite | DeepWiki | Server options | LiveKit Documentation | examples/drive-thru | livekit/livekit_composite | DeepWiki, with interactive elementsmicroscopic-gold-81132
03/23/2026, 1:51 PMThis is expected behavior. When the main LiveKit server kills an unresponsive agent worker, the job is re-dispatched and a new worker process will be started (and will connect to the same room) so the job can continue. This failover behavior is part of LiveKit’s agent/job lifecycle and is not something you can disable.Could you find the specific section of the documentation that states this claim, if there is one?
tall-airline-16756
03/23/2026, 1:51 PMentrypoint, resource limits, or deployment patterns) would reduce the frequency of these restarts. Which would be most helpful? Sources: Self-hosted deployments | LiveKit Documentation | Agents Framework | livekit/livekit_composite | DeepWiki | Server lifecycle | LiveKit Documentation | Server options | LiveKit Documentation, with interactive elementsmicroscopic-gold-81132
03/23/2026, 1:55 PMThe lifecycle and job-crash pages describe that a killed or unresponsive job only affects that job, and LiveKit will reassign work to available agent servers.Is this really true? I don't see it in the docs, give me verbatim version from the docs.
tall-airline-16756
03/23/2026, 1:55 PMmicroscopic-gold-81132
03/23/2026, 1:58 PMThere is no single sentence in the docs that literally says, "When the main LiveKit server kills an unresponsive agent worker, the job is re-dispatched and a new worker process will be started and connect to the same room." Instead, that behavior is implied by the combined statements above: isolated job processes, automatic load-balanced dispatch, and reassignment on failure/timeouts.Exactly, therefore I'm not convinced. 1. Do you have access to issues here https://github.com/livekit/agents/issues and see if you can find anything relevant to what we describe? 2. Do you have access to the source code, can you check if there's a code path that produces this behavior?
tall-airline-16756
03/23/2026, 1:59 PM