creamy-tiger-14805
09/01/2025, 9:21 AMtall-airline-16756
09/01/2025, 9:21 AMtall-airline-16756
09/01/2025, 9:22 AMpython agent.py dev), it registers itself as a worker and patiently waits for the server to send over tasks.
This worker is kind of like a web server process—it keeps an eye on things and launches agent instances in separate child processes. When someone joins a room, the LiveKit server sends a job request to a free worker, and that worker spins up a new process to handle the task. We call this process agent dispatch.
Here are some neat features of workers:
• Job Isolation: Workers can juggle multiple agent jobs at once, keeping each one in its own little bubble so if something goes wrong, it doesn’t mess up the others.
• Load Balancing: Workers chat with the server about how busy they are, so jobs get spread out nicely based on who has the capacity.
• Overload Protection: When a worker’s getting too busy—usually if CPU usage is high—it politely stops taking new jobs to avoid getting overwhelmed.
• Graceful Shutdown: If a worker needs to stop, it won’t take on new jobs but will finish up the ones it’s already working on before shutting down.
You can customize how a worker behaves using the WorkerOptions class. This lets you tweak things like load limits, permissions, dispatch rules, and health check settings to fit your needs.
So, to sum it up: workers are the heart and soul of the LiveKit Agents system. They keep everything running smoothly by handling scalability, managing loads, and making sure programmable participants—like AI agents, media processors, or your own real-time logic—work reliably.
Sources: Worker lifecycle | LiveKit Docs | Anatomy of an Agent | LiveKit Docs | Deployment and scaling | LiveKit Docs | README.md | livekit-agents/livekit/agents/worker.pycreamy-tiger-14805
09/01/2025, 9:24 AMtall-airline-16756
09/01/2025, 9:25 AMSIGTERM) to the worker process. This gently tells the worker to stop taking new jobs but lets it finish up any active sessions first, so nothing gets interrupted.
If you have any questions or need a hand with this, just give me a shout—I’m here to help!creamy-tiger-14805
09/01/2025, 9:26 AMtall-airline-16756
09/01/2025, 9:26 AMps aux | grep livekit-worker
2. Then, send the SIGTERM signal to shut it down gracefully: kill -15 <worker-pid>
And if you’re running a development worker, a simple Ctrl+C in the terminal where it’s running will send a SIGINT signal to stop it.
Feel free to reach out if you want me to walk you through this or if you have any other questions!
Sources: LiveKit CLI | livekit/livekit_composite | DeepWiki | agents/src/ipc/job_proc_lazy_main.ts | Worker options | LiveKit Docscreamy-tiger-14805
09/01/2025, 10:02 AMtall-airline-16756
09/01/2025, 10:03 AMcreamy-tiger-14805
09/01/2025, 10:04 AM