wooden-smartphone-55787
08/07/2025, 10:33 AMtall-airline-16756
08/07/2025, 10:33 AMtall-airline-16756
08/07/2025, 10:33 AMwooden-smartphone-55787
08/07/2025, 10:34 AMtall-airline-16756
08/07/2025, 10:34 AMErrWorkerNotAvailable, which basically means there’s no one around to take on the job. This error will then be sent back to you.wooden-smartphone-55787
08/07/2025, 10:35 AMtall-airline-16756
08/07/2025, 10:36 AMload_fnc and load_threshold parameters in WorkerOptions. This lets you create a custom load function that checks how busy the worker is and sets a limit for taking on new jobs.
For instance, if you'd like to cap a worker at 10 concurrent jobs, here's a simple way to do it:
from livekit.agents import Worker, WorkerOptions
def compute_load(worker: Worker) -> float:
# Returns 1.0 when there are 10 or more active jobs
return min(len(worker.active_jobs) / 10, 1.0)
opts = WorkerOptions(
entrypoint_fnc=entrypoint,
load_fnc=compute_load,
load_threshold=0.9 # Stops accepting jobs at 90% load (which is 9 jobs)
)
With this setup, the worker will stop picking up new jobs once it hits that threshold. If you want more control, you can also use the request_fnc to manually reject jobs based on how many are currently running.
Sources: Deployment and scaling | LiveKit Docs | Worker options | LiveKit Docs | livekit-agents/livekit/agents/worker.pywooden-smartphone-55787
08/07/2025, 10:37 AMtall-airline-16756
08/07/2025, 10:38 AMwooden-smartphone-55787
08/07/2025, 10:49 AMtall-airline-16756
08/07/2025, 10:49 AMwooden-smartphone-55787
08/07/2025, 10:50 AMtall-airline-16756
08/07/2025, 10:51 AMAssignmentTimeoutError or ErrAvailabilityTimeout. When that happens, the system calling this will need to handle the error in a way that makes sense for your workflow. We’re here to help if you need any tips on that!
Sources: tests/test_ipc.py | agents/src/worker.ts | pkg/agent/agent_test.go | Deploying to production | LiveKit Docswooden-smartphone-55787
08/07/2025, 10:54 AMtall-airline-16756
08/07/2025, 10:54 AMASSIGNMENT_TIMEOUT kicks in right after a worker accepts a job. It’s basically the time limit the server has to assign that job to the worker. If the server doesn’t get it done within that window, the worker will raise an AssignmentTimeoutError, and then the job might be passed along to another available worker. Hope that clears things up!
Sources: livekit-agents/livekit/agents/job.py | README.mdwooden-smartphone-55787
08/07/2025, 10:55 AMtall-airline-16756
08/07/2025, 10:55 AMwooden-smartphone-55787
08/07/2025, 10:56 AMtall-airline-16756
08/07/2025, 10:57 AM