red-television-3815
07/12/2025, 5:30 AMtall-airline-16756
07/12/2025, 5:30 AMtall-airline-16756
07/12/2025, 5:31 AMcontext.session.generate_reply
and context.session.say
update the chat context in LiveKit:
• session.say()
: By default, this method adds the text to the agent's chat context after playback (unless the add_to_chat_ctx
parameter is set to False
). This message becomes part of the conversation history.
• session.generate_reply()
: This method's effect on chat context depends on the parameters used:
◦ If you use user_input
, it is added as a user message in the chat history.
◦ If you use instructions
, the resulting agent response is added to history, but the instructions themselves are not.
Both methods result in new messages being persisted to the chat context items, and corresponding conversation events are triggered. The messages are role-assigned ("assistant" for agent responses, "user" for user inputs).
Sources: Agent speech and audio | LiveKit Docs | tests/test_agent_session.py