bitter-agency-4722
12/31/2025, 10:33 AMtall-airline-16756
12/31/2025, 10:33 AMtall-airline-16756
12/31/2025, 10:33 AMllm_node or tts_node implementations (yes/no)? If yes, paste the relevant snippets.
• Example: the exact expected LLM text vs. what actually gets sent to TTS (or logs showing chunked outputs).
• Any errors, timeouts, or cancellations in logs when the response finishes?
• Are you using sentence-based flushing or any delimiters before calling TTS?
• Which TTS engine are you using?
In the meantime, try these quick checks you can run now:
• Test with default `llm_node`/`tts_node` (no customization) to see if the full text is synthesized.
• Enable verbose logging and verify each LLM chunk is yielded and forwarded to TTS.
• If using a realtime LLM, confirm you set modalities to ["text"] and are not letting the realtime model bypass TTS.
• Check for premature stream termination (timeouts/cancel calls) and for code that filters or returns early from the LLM stream loop.
• If you buffer by sentence, ensure final partial sentences are flushed to TTS.
Send the answers/snippets above and one short example of expected vs actual output and I’ll give focused fixes and code edits to resolve it.
Sources: Pipeline nodes and hooks | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | LLM Output Replacement | LiveKit docs | Live Conversations with AI using ChatGPT and WebRTC | Realtime model plugins | LiveKit Docsbitter-agency-4722
12/31/2025, 10:38 AMtall-airline-16756
12/31/2025, 10:38 AMpreemptive_generation=True on your AgentSession so TTS can start synthesizing earlier and reduce backlog.
1. Use or verify a streaming-capable / low-latency TTS
• Switch to or confirm a low-latency TTS provider (e.g., Cartesia Sonic) so audio frames are produced faster and flushing is less likely.
1. Confirm chunked/sentence streaming is active
• Ensure the agent sends text to TTS incrementally (sentence or chunk boundaries) rather than one large block. This prevents long waits for the first audio frame.
1. Capture TTS input for debugging
• Temporarily log what text segments are passed into TTS to confirm whether the missing phrase is reaching the TTS node:
async def tts_node(self, text: AsyncIterable[str], model_settings):
async for segment in text:
print("TTS input segment:", repr(segment))
async for frame in Agent.default.tts_node(self, [segment], model_settings):
yield frame
1. Check for timeouts / worker shutdown
• Your logs show a worker shutdown after flushing. Verify no timeout/cancel is closing the session before all audio is generated.
1. Upgrade packages
• Upgrade livekit-agents and your TTS plugin to the latest versions; flushing heuristics and TTS performance have improved in recent releases.
If you want, send:
• Which TTS engine/plugin you’re using
• Your AgentSession config (especially preemptive_generation value)
• A short trace showing the LLM output chunks (if available)
I’ll give the exact code/config suggestion based on those details.
Sources: Agent speech and audio | LiveKit docs | Modifying LLM output before TTS | LiveKit docs | Text-to-speech (TTS) models | LiveKit Docs