crooked-dawn-90821
10/28/2025, 5:59 PMtall-airline-16756
10/28/2025, 5:59 PMtall-airline-16756
10/28/2025, 6:00 PMsession.update_agent() method in the LiveKit Python SDK. It doesn’t automatically keep or clear the conversation history. By default, the session’s internal chat_ctx (which stores the conversation history) stays just as it is. However, the new agent won’t automatically get this context unless you set it up explicitly.
If you’d like to keep the conversation history, you can pass the current context to the new agent when you create it, like this:
current_ctx = session._chat_ctx
new_agent = MyAgent(chat_ctx=current_ctx)
session.update_agent(new_agent)
And if you want to start fresh and clear the history, just initialize the new agent with a clean context:
new_agent = MyAgent(chat_ctx=ChatContext.empty())
session.update_agent(new_agent)
If anything feels unclear or you want me to walk you through this step-by-step, please don’t hesitate to ask. I’m here to help!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | Agents v0.x migration guide - Python | LiveKit Docs | complex-agents/personal_shopper/README.md