enough-dentist-75383
11/28/2025, 1:39 PMtall-airline-16756
11/28/2025, 1:39 PMtall-airline-16756
11/28/2025, 1:39 PMopenai.LLM).
• Ensure you consume the LLM as a stream (async iterable). Example pattern:
async for chunk in llm_stream:
yield chunk # forwarded to downstream nodes
2) TTS streaming
• TTS streaming is enabled when the TTS node receives incremental text. If the LLM streams tokens, the tts_node will synthesize audio incrementally.
• Some TTS plugins offer latency tuning (e.g., ElevenLabs streaming_latency) to reduce audio delay.
3) End-to-end pipeline
• STT -> LLM -> TTS streams end-to-end by default when the LLM outputs incrementally and you pass those chunks to the TTS node. Example config:
session = AgentSession(
llm="openai/gpt-4.1-mini",
stt="assemblyai/universal-streaming:en",
tts="cartesia/sonic-3:…",
)
4) Troubleshooting quick checklist
• Confirm your LLM integration returns an async stream (not a single batched string).
• Ensure your code forwards chunks to the TTS node as they arrive.
• If using a plugin with latency/settings, lower streaming_latency or equivalent for faster audio output.
If you want, tell me which LLM and TTS plugin you're using and I’ll show the exact code snippet to stream tokens through your AgentSession.
Sources: ElevenLabs TTS plugin guide | LiveKit Docs | Large language models (LLM) | LiveKit Docs | Pipeline nodes and hooks | LiveKit docsenough-dentist-75383
11/28/2025, 1:40 PMtall-airline-16756
11/28/2025, 1:40 PMapi_key parameter.
Minimal Python example
from livekit.agents import AgentSession
from livekit.plugins import google, cartesia
llm = google.LLM(model="gemini-2.5-flash")
tts = cartesia.TTS(model="sonic-3", voice="your_voice_id")
session = AgentSession(llm=llm, tts=tts, stt=None)
# When generating replies, consume streamed chunks and pass to TTS
async for chunk in llm.chat_stream(chat_ctx): # stream of token chunks
await tts.synthesize_stream(chunk.delta) # feed incremental text to TTS
Quick troubleshooting
• If audio waits until the end, confirm your LLM code returns an async stream (not a single string).
• If playback lags, check Cartesia connection/voice settings; some plugins offer latency tuning.
• Ensure GOOGLE_API_KEY (or api_key) is set for Google plugin.
If you want, tell me whether you want the full AgentSession start/room example or a Node.js snippet and I’ll provide it.
Sources: Google Gemini LLM plugin guide | LiveKit Docs | Gemini TTS plugin guide | LiveKit Docs | Cartesia TTS plugin guide | LiveKit docs | Agent speech and audio | LiveKit docs