how to send reset chat_context before handoff the ...
# ask-ai
l
how to send reset chat_context before handoff the agents?
✅ 1
t
Thanks for reaching out, Rajadurai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you're asking how to reset
chat_context
before handing off to another agent. You can do this a few ways depending on whether you want a full reset, a summarized context, or a truncated history: • Full reset: pass a new empty context when creating the next agent:
Copy code
return SpecialistAgent(chat_ctx=ChatContext()), "Transferring with reset context"
• Summarize previous conversation and pass only the summary as a system message:
Copy code
chat_ctx = ChatContext()
  chat_ctx.add_message(role="system", content=f"Prior conversation summary: {summary}")
  return SpecialistAgent(chat_ctx=chat_ctx)
• Truncate history: copy and keep only the last N items:
Copy code
return TechnicalSupportAgent(chat_ctx=self.chat_ctx.copy().truncate(max_items=6))
• Remove prior agent/system instructions when copying:
Copy code
return BillingAgent(chat_ctx=self.chat_ctx.copy(exclude_instructions=True))
Note: If you simply omit
chat_ctx
when constructing the new agent, it starts with a clean slate by default. Which of these approaches fits your use case (full reset, keep a brief summary, or keep recent turns)? Sources: Agents and handoffs | LiveKit Documentation, with interactive elements