For Python LiveKit Agent SDK, what happens when I ...
# ask-ai
f
For Python LiveKit Agent SDK, what happens when I use the self.session.generate_reply() method? Do the instructions get added as a system message?
t
Thanks for reaching out, Amitrajit. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The
self.session.generate_reply()
method in the Python LiveKit Agent SDK gently encourages the LLM to create a response based on the current context and any instructions you provide. It’s important to know that these instructions aren’t added as a system message in the chat history. Instead, they’re temporarily added to the agent’s base instructions just for that particular response. This way, the LLM can blend all the guidance to craft its reply, but the extra instructions don’t stick around in the conversation history. Only the assistant’s generated response and any
user_input
you provide get saved. If anything isn’t clear or you’d like to dive deeper, please don’t hesitate to reach out—I’m here to help! Sources: examples/voice_agents/restaurant_agent.py | Agent speech and audio | LiveKit Docs