fierce-zoo-69908
10/24/2025, 9:09 AMtall-airline-16756
10/24/2025, 9:09 AMtall-airline-16756
10/24/2025, 9:10 AMsession.say() or agent.say() directly within the tool’s execution function to create that TTS output.
Would you like me to walk you through how to use these methods step-by-step to get speech working during a tool call? I’m here to help!
Sources: Text-to-speech (TTS) models | LiveKit Docs | agent.py | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | examples/src/basic_tool_call_agent.tsfierce-zoo-69908
10/24/2025, 9:10 AMtall-airline-16756
10/24/2025, 9:11 AMsession.say() method might not work as expected when using a realtime model, and I'm here to help clarify why. Realtime models handle speech generation internally, so they don’t rely on a separate TTS plugin. Instead, a great way to get speech output is by using the generate_reply() method, which works perfectly with realtime models.
Let me walk you through how you can use generate_reply() step-by-step:
1. First, initialize your realtime model with the parameters you want, like voice and modalities. For example:
from livekit.plugins.openai import realtime
model = realtime.RealtimeModel(
voice="sage",
modalities=["audio"],
instructions="You are a helpful assistant."
)
2. Next, create and start an AgentSession using the realtime model:
from livekit.agents import AgentSession
session = AgentSession(llm=model)
await session.start()
3. Finally, you can trigger speech output by calling generate_reply() like this:
await session.generate_reply(instructions="Greet the user warmly.")
If you have any questions or need help tailoring this to your specific needs, please don’t hesitate to reach out. I’m here to support you!
Sources: Agent speech and audio | LiveKit Docs | sip-refer/agent.py | livekit-agents/livekit/agents/llm/realtime.py | Realtime model plugins | LiveKit Docsfierce-zoo-69908
10/24/2025, 9:12 AMtall-airline-16756
10/24/2025, 9:12 AMagent.tts property. This will give you the configured TTS object or None if there isn’t one set up. Here’s a quick example:
if agent.tts is not None:
print("TTS model is configured")
else:
print("No TTS model is configured")
If you have any more questions or need a hand with this, just let me know—I’m here to help!
Sources: agents/src/inference/tts.ts | Text-to-speech (TTS) models | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | complex-agents/medical_office_triage/triage.py