glamorous-oil-12326
11/20/2025, 7:06 PMtall-airline-16756
11/20/2025, 7:29 PMfrom livekit.agents import tts
from livekit.plugins import elevenlabs, groq
tts_fallback = tts.FallbackAdapter([
elevenlabs.TTS(),
groq.TTS()
], sample_rate=24000)
2. Ensure Agent Receives TTS from Session
Make sure the agent inherits the session’s TTS instance during session.start(). It’s best to avoid overriding the TTS in the agent’s constructor unless it’s really necessary. 3. Check Activity Context Setup
Remember that tts_node accesses self._activity.tts, which only gets set after the agent is launched via session.start(). So, please ensure tts_node isn’t called too early. 4. Enable Logging for Fallback Transitions
To get more insight, enable debug logging to watch fallback transitions and see if all TTS providers are failing:
import logging
logging.basicConfig(level=logging.INFO)
5. Test with Minimal Configuration
Try testing with a simple agent that doesn’t override tts_node to help isolate the issue:
class TestAgent(Agent):
pass
session = AgentSession(tts=tts.FallbackAdapter([elevenlabs.TTS(), groq.TTS()]))
await session.start(agent=TestAgent(), room=ctx.room)
If you still run into issues, it’s a good idea to verify each TTS provider individually to make sure they work fine on their own before combining them in the fallback chain. I hope this helps you move forward smoothly! If you have any questions or need further assistance, feel free to reach out—I’m here to help. Sources: examples/voice_agents/structured_output.py | Events and error handling | LiveKit docs | Pipeline nodes and hooks | LiveKit docs | Agents v0.x migration guide - Python | LiveKit docs