faint-arm-51818
09/26/2025, 9:46 AMtall-airline-16756
09/26/2025, 9:46 AMtall-airline-16756
09/26/2025, 9:47 AMfaint-arm-51818
09/26/2025, 9:48 AMtall-airline-16756
09/26/2025, 9:48 AMsession.say()
This is a great option if you want your agent to say a specific message right when the session starts. It uses the Text-to-Speech (TTS) engine to speak directly to the user.
await session.say("Hello! How can I assist you today?")
Just a quick note: You'll need to have a TTS plugin set up in your session for this to work smoothly.
2. Using generate_reply()
If you're working with an LLM-based pipeline, generate_reply() is a wonderful way to have your agent start the conversation with a response that's tailored dynamically based on the context or instructions you provide.
await session.generate_reply(instructions="Greet the user and offer your assistance.")
This method is especially handy for creating dynamic responses, and if you're using a realtime model, you won’t need a TTS plugin.
Some best practices to keep in mind:
• For realtime models, generate_reply() is usually the way to go unless you add a TTS plugin.
• If you're working with telephony, it’s helpful to use guards (like checking if phone_number exists) so your agent only speaks first during inbound calls.
• You might also want to place your generate_reply() or say() calls inside the on_enter() lifecycle hook of your agent, so it happens automatically when the agent joins.
Please feel free to reach out if you'd like me to walk you through any part of this or if you have other questions. I’m here to help!
Sources: Docs::Agents | examples/warm-transfer/warm_transfer.py | Agent speech and audio | LiveKit Docs | Agent speech and audio | LiveKit Docs | Docs::Agents