plain-hamburger-12701
03/05/2026, 10:42 AMlivekit-agents==1.3.5 with livekit-plugins-aws==1.3.5 on EKS (4 CPU / 4 GB, currently at ~1.3 CPU). The agent uses aws.STT (Transcribe Streaming), aws.TTS (Polly), and bedrock_llm.LLM (Claude Haiku).
The exact same code, same Docker image, same Python environment works perfectly on local Docker Compose — clean audio, no lag spikes, no flush warnings. The issue is cloud (EKS) only.
We observe the following pattern every ~16 seconds in EKS, even during TTS playback when no user speech is occurring:
livekit.plugins.aws logs restarting transcribe session
Immediately before and during the reconnect, the asyncio event loop blocks for 0.5s to 3.5s (measured via loop.slow_callback_duration)
1. This triggers flush audio emitter due to slow audio generation spam from livekit.agents, causing audible audio cutoffs mid-speech
What we have already ruled out:
• AWS credentials / IMDS — credentials are fully static, injected via AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN env vars. Startup confirms Found credentials in environment variables. We ran a manual experiment: exported local Azure SSO creds directly into the pod and ran the agent by hand — same lag pattern, same cutoffs.
• CPU throttling — pod has 4 CPUs, currently using 1.3 CPU. Not throttled.
• UDP NAT timeout — confirmed TCP-only TURN via browser ICE stats.
Key difference between local and cloud:
Local Docker: ~/.aws/credentials file, single-node, no DNS round-trips to AWS endpoints
• EKS cloud: env var credentials, VPC DNS, traffic goes through VPC endpoints or NAT to <http://transcribestreaming.ap-southeast-2.amazonaws.com|transcribestreaming.ap-southeast-2.amazonaws.com>
The lag always starts building just before the 16s Transcribe reconnect and peaks during it. Between reconnects, the event loop is clean (1–5ms lag).tall-airline-16756
03/05/2026, 10:42 AMtall-airline-16756
03/05/2026, 10:42 AMlivekit-plugins-aws.STT supports an endpoint_url or similar, set it to the regional transcribe URL to avoid extra resolution logic or use an internal VPC endpoint hostname.
◦ If the plugin doesn’t expose this, you can try patching/wrapping the plugin to inject the endpoint into the underlying AWS client.
1. Capture network timings (tcpdump) across a reconnect
◦ Run tcpdump in the pod during a reconnect and inspect timing for:
▪︎ DNS query/response,
▪︎ TCP SYN → SYN/ACK,
▪︎ TLS ClientHello → ServerHello.
◦ Long delays in any of these indicate where the block occurs.
1. Verify if you’re using an AWS VPC endpoint for Transcribe
◦ If you are not using a VPC endpoint, try using one (if available) so traffic stays inside AWS and avoids NAT/IGW.
◦ VPC endpoints often reduce latency and remove external DNS/NAT variability.
Mitigations if DNS/TLS is confirmed
• Short term: Pre-resolve/pin IP in /etc/hosts (described above).
• Medium term: Configure a VPC endpoint for Transcribe or ensure node DNS caching (e.g., CoreDNS caching) is tuned.
• Longer term: If the blocking call is inside the Transcribe client on the main asyncio loop, change the client usage to offload blocking operations to a thread pool or use an async-aware HTTP/2 client that doesn’t block the loop. This requires code changes or a plugin update.
Info I need to help further (please provide any that you can)
1. Can you confirm whether livekit-plugins-aws.STT accepts an endpoint_url or allows you to pass a precreated HTTP session/client? If yes, I can give exact code to inject a pre-warmed session.
2. Are you using an AWS VPC endpoint for Transcribe or are requests going out via NAT to the public endpoint?
3. Can you run a tcpdump during one reconnect and share these timings (SYN/TLS handshake timing and DNS timing)? Even a short summary like “DNS response took X ms; TLS handshake took Y ms” will help pinpoint the blocker.
4. Do your EKS nodes have any sidecars (Istio/AppMesh) or network policies that could be affecting connection setup?
If you want, we can proceed in this order: 1) Try the /etc/hosts pre-resolve test (fast and non-invasive). Tell me whether the event-loop spikes stop. 2) If not fixed, capture and share simple tcpdump timing details and whether a VPC endpoint exists.
I’ll help interpret the tcpdump/DNS timings and propose the safest next code or infra change.
Sources: Amazon Transcribe plugin guide | LiveKit Documentation