incalculable-furniture-97332
12/11/2025, 2:50 PMtall-airline-16756
12/11/2025, 2:50 PMtall-airline-16756
12/11/2025, 2:51 PMincalculable-furniture-97332
12/11/2025, 2:54 PMtall-airline-16756
12/11/2025, 2:54 PMuser_intent, billing_status, last_agent_action) so agents get exactly what they need.
• Selective recall
Retrieve and include only recent or task-relevant messages when handing off, not every message.
• Token-aware pruning
Truncate or compress low-value history automatically when token limits are approached.
• Use hierarchical workflows
Keep high-level orchestration agents that route tasks and lightweight task agents that operate with minimal context.
These approaches preserve continuity without letting prompts grow unbounded. Do you want an example structure for summarizing context for handoffs?incalculable-furniture-97332
12/11/2025, 2:56 PMtall-airline-16756
12/11/2025, 2:56 PMchat_ctx
Pass the prior agent’s chat_ctx into the new agent so it has the conversation history up to that point:
return TechnicalSupportAgent(chat_ctx=self.session.chat_ctx)
• Full session history available
session.history stores the complete interaction log and is accessible to agents regardless of handoffs.
• Selective copying and filters
Use chat_ctx.copy() with options like exclude_empty_message, exclude_instructions, or exclude_function_call to include only relevant parts of history when handing off.
• Use cases supported
◦ Preserve full continuity for seamless transitions
◦ Reset context for a clean slate when starting a new phase
◦ Implement summarized or partial context for token efficiency
If you’d like, I can show a short example of a summarized handoff structure or how to call copy() with specific filters. Which would help you more?
Sources: Agents and handoffs | LiveKit docs | Agent-assisted warm transfer | LiveKit docs | Workflows | LiveKit docsincalculable-furniture-97332
12/11/2025, 3:00 PMtall-airline-16756
12/11/2025, 3:01 PMchat_ctx or large transcripts increases tokens sent to the model and raises request/response time.
• Passing minimal, structured context (summaries, selected fields, or keys) keeps payloads small and reduces latency.
• Fetching history from session.history on demand can add a small lookup cost but avoids sending unnecessary tokens to the model.
Ways to optimize latency with LiveKit
• Send summaries or structured context instead of whole transcripts.
• Use chat_ctx.copy() with filters (exclude_empty_message, exclude_instructions, exclude_function_call) to trim what’s forwarded.
• Store long histories externally and pass only relevant slices or references during handoffs.
• Keep agents stateless and lightweight for quick triage; escalate to larger models only when needed.
• Prune or compress history when token limits approach.
If you want, I can suggest a specific handoff pattern (code example) tailored to your expected conversation length and latency targets. Which scenario should I model?