What do we need to be aware of when deploying the ...
# ask-ai
s
What do we need to be aware of when deploying the agent worker? I’m deploying it to a Hetzner server using k3s and it doesn’t behave as it should. The agent takes ages to connect and then all the requests to the openai.llm timeout.
t
Thanks for reaching out, Amir. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When you're setting up the agent worker, here are some important things to keep in mind to make sure everything runs smoothly: • Networking: The workers chat with LiveKit through WebSocket, so you don’t need to expose anything publicly. If you want, you can set up a health check endpoint at
<HEALTH_CHECK_ENDPOINT>
to keep an eye on things. • Environment Variables: Double-check that
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
are all set up correctly. It’s a good idea to use different credentials for production and development environments. • Resource Allocation: Plan for about 4 CPU cores and 8GB of memory to handle roughly 25 agents. Since workers are stateless, 10GB of ephemeral storage should do the trick. • Graceful Termination: Set a termination grace period (like 600 seconds) so agents have time to wrap up their tasks properly. • Load Balancing: LiveKit takes care of balancing the load across workers. For scaling, Kubernetes is your friend and can autoscale based on demand. If you’re deploying on k3s, make sure your Kubernetes YAML has the right resource requests and limits. You can apply your configuration with
kubectl apply -f <your-manifest.yaml>
. And if you’re using Hetzner, you can either use their Kubernetes service or set up k3s manually on your servers. If you notice the agent is taking a while to connect or requests to
openai.llm
are timing out, here are a few things to check: • Is the network connectivity and DNS resolution for the OpenAI endpoint working properly? • Are resource limits being hit, causing slowdowns? • Take a look at the logs for any errors or warnings that might give clues about what’s going on. Feel free to reach out if you want me to walk you through any of these steps or if you need help troubleshooting. I’m here to help! Sources: Voice Assistants | livekit/livekit_composite | DeepWiki | Deployment and scaling | LiveKit Docs | kubernetes/README.md