shy-gold-2095
12/26/2025, 2:08 PMtall-airline-16756
12/26/2025, 2:08 PMtall-airline-16756
12/26/2025, 2:09 PMAPIConnectionError when the agent tries to reach the LiveKit WebSocket, and a high memory usage warning (≈565 MB, above the 500 MB warning). I’ll help you troubleshoot both since they can be related.
Quick checklist and steps to try
1. Verify basic network/connectivity
• Can the host/container reach LiveKit Cloud endpoints? Run a simple connectivity test from the same environment (DNS resolution + TCP to the LiveKit signaling endpoint). If you have the Connection Test utility, run it from the agent host.
• Check for recent network changes (VPC, firewall, proxy, egress rules, or NAT gateway changes) or cloud infra updates that could block outbound WebSocket/TCP.
1. Inspect WebSocket stability
• Confirm the agent is pointed to the correct LiveKit Cloud URL and using the expected API key/credentials.
• Check for intermittent packet loss or long latency from the host to LiveKit (mtr/traceroute, ping). WebSocket errors often follow degraded network quality.
• Look at server-side LiveKit logs (if available in your dashboard) for any rejected connections or auth/limit errors.
1. Address high memory usage
• Review what the agent is doing when memory climbs (TTS synthesize attempts, audio buffers, concurrent jobs). High memory can cause event loop stalls or process restarts which break connections.
• If you’re running in a container/orchestrator, confirm memory limits and whether the process is being OOM-killed or throttled.
• Reduce memory pressure by lowering concurrency, clearing/streaming buffers sooner, or using smaller TTS models if configurable.
1. Skim SDK/runtime issues
• Ensure the deployed agent version (you’re using @livekit/agents v1.0.27 per the stack trace) is compatible with your environment and there were no recent forced upgrades/changes. If you recently updated the runtime or SDK, roll back to the previously-working version to test.
Questions to narrow this down
• Did anything change in your deployment around when this started (network rules, cloud region, image updates, autoscaling config)?
• Are all agents in the same deployment affected, or only this host/pod instance?
• Do you see any OOM/kube eviction events, container restarts, or platform-level network issues at the same timestamps as the errors?
• Can you run a short connectivity test (ping/traceroute/mtr) from the failing host and paste results or key findings?
Next steps I can take for you
• Walk through a connection test command to run in your environment and interpret results.
• Suggest memory-tuning changes or a quick diagnostic to capture a heap snapshot or process metrics during TTS attempts.
• If you share whether this is a single node or multiple, I can propose targeted mitigations (scale down concurrency, increase memory, or pin to a stable agent image).
Tell me which of the above you want to start with and provide the answers to the questions you can — I’ll guide you step-by-step.
Sources: How to Enable Agent-to-Agent Speech Detection in LiveKit | Diagnosing Connection Errors with Connection Test Utility | Agent server options | LiveKit docs