nice-room-70150
11/05/2025, 9:30 PMtall-airline-16756
11/05/2025, 9:30 PMtall-airline-16756
11/05/2025, 9:31 PMagent_name or room_config.agents (Agent dispatch).
If you can share whether you’re on LiveKit Cloud or self-hosted and what outcome you’re aiming for (region affinity, agent routing, etc.), I can outline exact steps.
Sources: Distributed Setup | LiveKit docs | Deploying to custom environments | LiveKit Docs | Agent dispatch | LiveKit Docs | Voice Assistant Applications | livekit/livekit_composite | DeepWiki | Core Platform Architecture & Authentication | livekit/livekit_composite | D...nice-room-70150
11/05/2025, 9:35 PMtall-airline-16756
11/05/2025, 9:36 PMagent_name on workers you want to use as a named pool. Workers with agent_name don’t receive automatic dispatch; they only accept explicit requests matching that name (Agent dispatch, Worker options).
◦ Trigger dispatch by:
▪︎ Adding room_config.agents to the access token so the server dispatches agents with that name when a participant connects (Authentication/token config).
▪︎ Calling the dispatch API (AgentDispatchService) to start a named agent for a room (Agent dispatch).
▪︎ For SIP, include agents in your SIP dispatch rule so the room spawns the desired agent on call-in (SIP dispatch rule).
• Worker-side controls:
◦ Implement request_fnc to accept/reject each job (e.g., based on metadata or capacity).
◦ Use load_fnc and load_threshold to control when a worker is considered available (customizable in self-hosted; fixed in Cloud) (Worker options, Deploying to custom environments).
Want a short example for: setting agent_name, adding room_config.agents to a token, or using the dispatch API?
Sources: LiveKit Docs | Worker lifecycle | LiveKit Docs | Job lifecycle | LiveKit Docs | Node.js Agents Architecture | livekit/livekit_composite | DeepWiki | Worker options | LiveKit Docsnice-room-70150
11/05/2025, 9:36 PMtall-airline-16756
11/05/2025, 9:37 PMagent_name so it only accepts explicit dispatches.
• Docs: Agent dispatch, Worker options
Example (Node/TS):
Worker.run(myEntrypoint, {
agent_name: "my-agent",
// optional: request_fnc/load_fnc/load_threshold
});
Trigger dispatch via token (room_config.agents):
• Add a named agent to the participant’s access token so it’s auto-dispatched on join.
• Docs: Authentication
Example (Node/TS):
const at = new AccessToken(apiKey, apiSecret, { identity: userId });
at.addGrant({ roomJoin: true, room: roomName });
at.roomConfig = new RoomConfiguration({
agents: [ new RoomAgentDispatch({ agentName: "my-agent", metadata: "any-json" }) ],
});
const token = await at.toJwt();
Trigger dispatch via API (server-side):
• Use the dispatch service to start a named agent for a room.
• Docs: Agent dispatch
Worker-side acceptance (optional controls):
• Accept/reject jobs and manage capacity.
• Docs: Worker options
Example:
Worker.run(myEntrypoint, {
agent_name: "my-agent",
request_fnc: async (req) => {
if (req.metadata?.tier === "gold") return req.accept();
return req.reject();
},
// load_fnc/load_threshold can gate availability (customizable self-hosted)
});
Want this in Python instead, or an example of using the dispatch API call end-to-end?
Sources: Worker lifecycle | LiveKit Docs | Job lifecycle | LiveKit Docs | Node.js Agents Architecture | livekit/livekit_composite | DeepWiki | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | Authentication | LiveKit Docs