melodic-zoo-29246
02/13/2026, 8:01 PMtall-airline-16756
02/13/2026, 8:01 PMtall-airline-16756
02/13/2026, 8:01 PMagent_name so LiveKit will spread work across them. That gives automatic failover and isolates a single user’s error to the worker that encountered it.
Recommended setup and actions
• Run at least 2–3 worker containers for the same agent_name for redundancy.
• Deploy workers so each registers with the same agent_name — LiveKit’s agent orchestration will load-balance incoming jobs across all registered workers.
• Use rolling updates or staggered deployments (deploy a subset first, verify, then roll the rest) to avoid full-cluster outages.
• Implement auto-scaling based on CPU, memory, or request/room counts so you keep capacity up during peaks.
• Monitor health, logs, and metrics (worker crashes, error rates, room creation failures) so you can detect and roll back problematic releases quickly.
• Use rollback tooling (for example lk agent rollback if you are using the LiveKit CLI flow) to revert a bad deploy fast.
If you want, I can:
• Walk you through a step-by-step rolling deploy plan for your current setup.
• Suggest a simple health-check and restart policy (container-level) to reduce noisy failures.
• Help pick autoscale triggers or sample metrics to monitor.
Which would be most helpful right now — a short rolling-deploy checklist, a sample worker deployment config, or help defining monitoring/health checks?
Sources: Agents (Python) | livekit/livekit_composite | DeepWiki | Agents Framework | livekit/livekit_composite | DeepWiki | examples/frontdesk | livekit/livekit_composite | DeepWikimelodic-zoo-29246
02/13/2026, 8:03 PMtall-airline-16756
02/13/2026, 8:03 PMagent_name so LiveKit can load-balance across them.
◦ Include project.subdomain / agent.id in your livekit.toml or env variables.
1. Staged rollout
◦ Deploy to a small subset (e.g., 1 instance of N) first.
◦ Verify the new instances accept jobs and handle sessions correctly.
1. Monitor initial traffic
◦ Watch job assignment, error logs, and latency for the new instances for a short window (5–15 minutes).
1. Roll forward gradually
◦ Increase new-version replicas in waves (e.g., 25% → 50% → 100%) while keeping old replicas available.
1. Drain old workers gracefully
◦ Allow old workers to finish active sessions; do not force-kill. Use termination grace periods.
1. Validate and finalize
◦ Confirm new workers handle normal load. If issues appear, run an immediate rollback.
1. Rollback plan
◦ Keep the previous working version ready. Roll back instantly if errors spike.
Sample Kubernetes deployment (you can paste and adapt)
apiVersion: apps/v1
kind: Deployment
metadata:
name: livekit-agent-worker
spec:
replicas: 3
selector:
matchLabels:
app: livekit-agent
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: livekit-agent
spec:
containers:
- name: agent
image: your-agent-image:latest
env:
- name: AGENT_NAME
value: "your-agent-name"
- name: PROJECT_SUBDOMAIN
valueFrom:
secretKeyRef:
name: livekit-secrets
key: project_subdomain
resources:
requests:
cpu: "4000m"
memory: "8Gi"
limits:
cpu: "4000m"
memory: "8Gi"
livenessProbe:
httpGet:
path: /health
port: 8081
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: 8081
initialDelaySeconds: 10
periodSeconds: 5
terminationGracePeriodSeconds: 600
Key config notes:
• replicas: start with 3 for redundancy; increase for higher capacity.
• readiness/liveness: point to the agent’s /health endpoint so Kubernetes only routes traffic to healthy pods.
• terminationGracePeriodSeconds: set long enough (e.g., 600s) to allow sessions to finish gracefully during rolling updates.
• CPU/memory: tune per your agent workload; the example uses 4 CPU / 8GB as a baseline for voice/LLM agents.
Monitoring & health-check strategies (what to watch and how to react)
• Health endpoints
◦ Use the agent’s /health for Kubernetes liveness/readiness probes.
◦ Readiness should reflect “can accept new jobs”; liveness should reflect process health.
• Auto-drain & load protection
◦ Ensure workers expose a load metric (or respect a load_threshold) so they stop taking new jobs before saturation.
• Metrics to collect
◦ Session/job counts per worker (active sessions).
◦ CPU and memory utilization (per pod).
◦ Job error/crash rate (exceptions per minute).
◦ Latency metrics: Time To First Token (TTFT) and Time To First Byte (TTFB) for LLM/audio responses.
◦ Connection-quality signals (packet loss, jitter) if available.
• Alerts & thresholds (examples)
◦ CPU > 70% sustained for 1–2 minutes → scale up.
◦ Error rate spike > 3x baseline → roll back or divert traffic.
◦ Increase in TTFT/TTFB > 2x baseline → investigate model or network issues.
◦ Pod restarts > 3 times in 5 minutes → mark node unhealthy and remove from rotation.
• Logs & tracing
◦ Stream lk agent logs during rollout for build/deploy errors.
◦ Capture worker crash stacks and the associated session ID to replay/debug in staging.
• Dashboard & CLI checks
◦ Use LiveKit Cloud dashboard for realtime session counts, agent status, and deployment logs.
◦ CLI commands to use:
◦ lk agent deploy to deploy
◦ lk agent status --id <agent-id> to check rollout
◦ lk agent logs --id <agent-id> to tail logs
◦ lk agent rollback --version <previous> to revert quickly
• Autoscaling recommendations
◦ Scale by CPU or job-queue depth. Start with CPU 50% as a scale-up trigger to maintain headroom.
◦ Maintain at least 2–3 instances during low traffic to avoid single-failure impact.
• Runbook actions for failures
a. If a single pod crashes: let orchestrator restart it; check crash logs. If repeated, cordon node and replace image/version.
b. If new version causes errors across pods: initiate immediate rollback to the previous version.
c. If capacity shortages cause “room connection not established within 10s”: scale up replicas and prioritize urgent users if supported.
Quick deployment / reliability strategies (practical tips)
• Staggered deployments: never replace all workers at once — deploy a canary, validate, then continue.
• Warm instances: keep a small pool of warm workers to avoid cold-start latency for realtime sessions.
• Isolation of failures: keep agent workers dedicated (no other heavy processes on the same nodes).
• Secrets & config updates: treat secret changes as rolling restarts; plan for them in deploy windows.
If you want, I can:
• Provide a short, tailored rolling-deploy checklist based on your current cluster size and CI/CD pipeline.
• Generate a Kubernetes manifest tuned to your expected concurrent sessions (tell me expected concurrent rooms & average session duration).
• Recommend specific alert thresholds if you share typical baseline CPU, memory, and error rates.
Which of those would you like next?
Sources: Examples | livekit/livekit_composite | DeepWiki | Agents (Node.js) | livekit/livekit_composite | DeepWiki | Agents (Python) | livekit/livekit_composite | DeepWiki | Server-side | livekit/livekit_composite | DeepWiki | Deploy and scale agents on LiveKit Cloudmelodic-zoo-29246
02/13/2026, 8:07 PMtall-airline-16756
02/13/2026, 8:07 PMmelodic-zoo-29246
02/13/2026, 8:13 PMtall-airline-16756
02/13/2026, 8:13 PM