how can I get my worker to handle concurrent conve...
# ask-ai
w
how can I get my worker to handle concurrent conversations
t
Thanks for reaching out, Arthur. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help a worker handle multiple conversations at the same time, you can tweak its load and resource settings using the
WorkerOptions
class. Here’s a friendly rundown of the key steps: • Load Function (
load_fnc
):
This function decides how busy the worker is. By default, it looks at CPU usage, but you can easily change it to count how many active jobs the worker has. For example:
Copy code
def load_fnc(worker: Worker) -> float:
    max_concurrent_jobs = 9
    return len(worker.active_jobs) / max_concurrent_jobs
Load Threshold (
load_threshold
):
This sets the max load (between 0 and 1.0) where the worker will still take on new jobs. The default is 0.7, which works well in most cases. • Resource Allocation: Make sure your worker has enough resources—like 4 CPU cores and 8GB RAM—to comfortably handle the number of conversations you expect. With this setup, managing 10-25 concurrent chats is doable, and you can push it up to 30 if you optimize things. These settings will help your worker juggle multiple conversations smoothly without slowing down. If you want, I’m here to help you with any of these steps! Sources: Deploying to production | LiveKit Docs | kubernetes/agent-manifest.yaml | Anatomy of an Agent | LiveKit Docs | Worker options | LiveKit Docs
w
Can two calls to the same number be done concurrently?
t
Absolutely! LiveKit SIP can totally handle multiple calls to the same number at the same time. Its design makes it easy for several participants to connect to the same trunk number all at once. We’ve even run integration tests like
TestSIPAudio
that show multiple clients joining the same room through the same number, with clear audio going back and forth. If you have a particular scenario in mind or want to dive deeper, just give me a shout—I’m here to help! Sources: test/integration/sip_test.go | SIP overview | LiveKit Docs