little-king-41579
04/09/2026, 5:16 AMtall-airline-16756
04/09/2026, 5:16 AMtall-airline-16756
04/09/2026, 5:16 AMchat_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:
return SpecialistAgent(chat_ctx=ChatContext()), "Transferring with reset context"
• Summarize previous conversation and pass only the summary as a system message:
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:
return TechnicalSupportAgent(chat_ctx=self.chat_ctx.copy().truncate(max_items=6))
• Remove prior agent/system instructions when copying:
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