rich-monitor-70665
04/30/2026, 12:04 PMtall-airline-16756
04/30/2026, 12:04 PMtall-airline-16756
04/30/2026, 12:04 PMagent_name / agentName) for a room.
• Pass job-specific metadata (user ID, phone number, etc.) into the agent session to personalize behavior or routing.
• Trigger agent assignment only via API, an access token embedding, or SIP dispatch rules when you need precise timing or context.
When NOT to use manual dispatch:
• If you want every new room to automatically get an agent with no extra coordination — automatic dispatch is simpler.
• For very simple prototypes where every room uses the same agent and you don’t need metadata or custom routing.
• When your system cannot generate tokens with room config or cannot make the API calls required to dispatch — manual dispatch requires that external coordination.
If you want, tell me whether you plan to dispatch via API, access token, or SIP and I’ll show the exact steps for that method.
Sources: Agent dispatch | LiveKit Documentation, with interactive elementsrich-monitor-70665
04/30/2026, 12:15 PMtall-airline-16756
04/30/2026, 12:15 PMrich-monitor-70665
04/30/2026, 12:17 PMtall-airline-16756
04/30/2026, 12:18 PMrich-monitor-70665
04/30/2026, 2:18 PMtall-airline-16756
04/30/2026, 2:19 PMchat_ctx and/or userdata on the new agent session so Agent Y continues with Agent X’s state.
• Use chat_ctx.copy(exclude_instructions=True) to preserve prior turns without re-sending system instructions.
Typical pattern
1. Agent X receives an RPC or tool invocation to delegate.
2. Agent X calls the handoff API / function_tool to instantiate Agent Y, supplying:
◦ chat_ctx=self.chat_ctx.copy(...) for conversation history
◦ userdata for any custom state
1. Agent Y starts and resumes processing with the provided context.
When to use this
• Role specialization (e.g., lightweight controller agent delegates heavy inference to a worker agent).
• Stateful transitions where preserving conversation or session data matters.
When not to
• If you need ultra-low latency per-frame processing: spinning up a new agent may add start-up cost. For strict real-time needs, prefer pre-warmed agents or per-publisher agents dispatched up-front.
If you want, tell me whether you need a short code example in Python or Node.js for invoking the handoff and passing `chat_ctx`/`userdata`.
Sources: Agents and handoffs | LiveKit Documentation | Chat context | LiveKit Documentation | Building Multi-Agent Architectures with LiveKit Agents, with interactive elements