I have a delay on receiving the audio stream from ...
# ask-ai
a
I have a delay on receiving the audio stream from agent on the client, what would it be from?
t
Thanks for reaching out, Sebastián. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing a delay receiving the agent's audio — here are the most likely causes and quick checks to narrow it down. What I’m responding to: the client experiences delayed audio coming from an agent. Possible causes and what to check • Buffering on the agent: the audio source’s
queue_size_ms
can add buffering. Check the agent’s audio config and try increasing
queue_size_ms
(e.g., 1000–2000 ms) if it’s low. • Network latency / service proximity: high RTT between the agent server and services (STT, TTS, LLM) adds delay. Where is your agent deployed relative to those services? • Agent cold starts: agents on the Build plan may take 10–20s to start if they scale down between sessions. Do you see the delay only on first connection? • End-of-turn detection: VAD/endpointing (e.g.,
min_endpointing_delay
) can add ~500ms or more before the agent responds. Check your endpointing settings. • Serial publishing / blocking: if audio is published sequentially with other work (video, TTS synthesis), that can block audio. Ensure audio frames are pushed in parallel tasks. • TTS / encoding overhead: synthetic audio generation or extra hops (intermediate servers) increases time to first byte. Is TTS done locally on the agent or via another service? Quick diagnostics I can help with • Tell me whether the delay happens only at session start or continuously. • Share whether the agent uses TTS or live-capture audio, and if TTS/LLM/STT are remote services. • If you can, share the agent’s
queue_size_ms
,
min_endpointing_delay
, and whether the agent runs in the same region as your other services. If you prefer, I can walk through targeted checks for buffering, endpointing, network latency, or agent cold-starts once you tell me which of the above fits your setup. Sources: Resolving "InvalidState - failed to capture frame" errors in AudioSource | examples/bank-ivr | livekit/livekit_composite | DeepWiki | How can I reduce latency in voice agents using STT, TTS and LLM? | Quotas and limits | LiveKit docs | Improving voice AI's turn detection with transformers
a
Only on start and on receiving the Audio Track streams
t
Thanks — since the delay happens only at start when the audio track is first received, the most likely causes are agent cold-starts and initial buffering/endpointing. Quick suggestions and a few targeted questions so I can give concrete steps: What to try now • Pre-warm the agent so it’s already running before the client joins (reduces 10–20s cold-start delay). • Increase the agent audio
queue_size_ms
(try 1000–2000 ms) to smooth initial capture and prevent frame issues. • Reduce endpointing latency by checking
min_endpointing_delay
if you use VAD (default ~500 ms). • Ensure TTS/LLM/STT services are in the same region as the agent to lower Time To First Byte/Token. Two quick questions 1. Which plan is the agent on (Build or Enterprise)? 2. Is the agent using TTS-generated audio or live-capture audio, and where (which region) is the agent deployed relative to your other services? Answer those and I’ll provide the most effective next steps (pre-warm patterns, exact config lines to change, or region/placement advice).
a
Ship plan, cloud agent are in LiveKit cloud and cliente in South America How can you adjust the queue size ms?
t
You can adjust the agent audio buffer by changing the
queue_size_ms
on the audio source. Since your agent runs in LiveKit Cloud, update the agent configuration where the audio source is created. Example (conceptual) steps you can follow: 1. Locate where the agent creates/publishes the audio track in your agent code (the audio source configuration). 2. Add or modify the
queue_size_ms
setting for that audio source and set it to a higher value (try 1000–2000). 3. Restart or pre-warm the agent so the new setting is loaded before the client connects. If you want, share the agent audio-source code snippet (the part that constructs the audio source or publishes the audio track) and I’ll give the exact lines to change.