salmon-belgium-62133
10/29/2025, 10:54 AMtall-airline-16756
10/29/2025, 10:54 AMtall-airline-16756
10/29/2025, 10:54 AMAgentSession, here are a couple of friendly ways you can do that:
• Use update_chat_ctx() with an Empty Context: This is the best and simplest way! Just call update_chat_ctx() on your agent and pass in a new, empty ChatContext. This will clear out the conversation history moving forward, giving you a fresh start.
from livekit.agents import llm
# Create an empty chat context
empty_context = llm.ChatContext.empty()
# Update the agent's chat context (this clears the history)
await agent.update_chat_ctx(empty_context)
• Start a New `AgentSession`: If you want to reset not just the chat history but also the agent’s state or behavior, you can start a brand new AgentSession with a fresh agent and an empty ChatContext. This gives you a clean slate all around.
# Start a new session with a clean chat context
new_session = AgentSession()
new_agent = Agent(chat_ctx=llm.ChatContext.empty())
await new_session.start(agent=new_agent, room=room)
If you have any questions or need a hand with these steps, just let me know—I’m here to help!
Sources: Agents v0.x migration guide - Python | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/realtime/real... | Pipeline nodes and hooks | LiveKit Docs | agents/src/voice/agent_session.ts | tools/mtmd/mtmd-cli.cpp