dry-helmet-74553
07/30/2025, 5:53 PMtall-airline-16756
07/30/2025, 5:56 PMtall-airline-16756
07/30/2025, 5:57 PMgenerate_reply() method: This is the primary way to send an initial greeting. You can provide specific instructions, such as:
await session.generate_reply(
instructions="Greet the user and offer your assistance."
)
• You can also call generate_reply() without specific instructions to let the agent initiate the conversation based on its general settings:
# Generate initial greeting
self.session.generate_reply()
• Why not use session.say()? Realtime models do not support the session.say() method directly. If you need to use it, you must configure a separate TTS plugin for your session.
• Alternative with TTS: Configure your realtime model to use text-only output and include a TTS plugin for more control over the greeting text:
session = AgentSession(
llm=openai.realtime.RealtimeModel(modalities=["text"]),
tts=cartesia.TTS() # Or other TTS plugin
)
Note that when using generate_reply() with instructions, the output may not precisely follow the provided script, as the model interprets and responds to the instructions rather than reading them verbatim.
Sources: Realtime model integrations | LiveKit Docs | livekit-agents/README.md | telephony/answer_call.py | Agent speech and audio | LiveKit Docs