many-forest-60185
10/15/2025, 7:01 PMtall-airline-16756
10/15/2025, 7:01 PMtall-airline-16756
10/15/2025, 7:02 PM.say completing instantly while .generate_reply works as expected. This usually points to something with how your custom TTS node is set up or implemented. Let's walk through some steps together to troubleshoot this:
1. Verify TTS Node Integration: Please double-check that your custom TTS node is correctly configured to return an AsyncIterable[rtc.AudioFrame]. If your TTS doesn’t support streaming, try wrapping it with a StreamAdapter and a sentence tokenizer to help manage that.
2. Check Agent Initialization: Make sure your agent session is initialized with a valid TTS plugin. For example:
session = AgentSession(llm=llm_instance, tts=YourTTSPlugin()) This ensures the TTS is properly linked.
3. Monitor Events: Keep an eye on the agent_state_changed event — it should switch to "speaking" after you call .say. Also, listen for the speech_created event with source="say" to confirm the TTS task has started.
4. Test with Pre-Synthesized Audio: To isolate the issue, try using the audio parameter in session.say() to supply some pre-synthesized audio. This can help determine if the problem is with audio generation or elsewhere.
5. Inspect Custom Overrides: If you’ve overridden the tts_node, please ensure it correctly forwards the audio output. A proper override might look like this:
def tts_node(self, text: AsyncIterable[str], model_settings: ModelSettings):
return Agent.default.tts_node(self, text, model_settings)
I hope these steps help you pinpoint and fix the issue. If you run into any roadblocks or have more questions, please don’t hesitate to reach out—I’m here to help!
Sources: Pipeline nodes and hooks | LiveKit Docs | agents/src/voice/agent.ts | Agent speech and audio | LiveKit Docs | Events and error handling | LiveKit Docs | Realtime model plugins | LiveKit Docs