broad-boots-9735
02/17/2026, 6:08 PMtall-airline-16756
02/17/2026, 6:08 PMtall-airline-16756
02/17/2026, 6:08 PMdispatchClient.createDispatch does in JavaScript. Here's a concise explanation and an example to help.
What it does
• createDispatch explicitly assigns (dispatches) a named agent to a LiveKit room.
• If the target room doesn't exist, the call will create it automatically.
• You can pass metadata with the dispatch; that metadata becomes available to the agent in its JobContext when it starts.
• Common uses: initiating outbound calls, routing inbound SIP calls to a specific agent, or programmatically triggering an agent to join a session with contextual information.
Example
const dispatch = await agentDispatchClient.createDispatch(
'my-room',
'test-agent',
{
metadata: '{"user_id":"12345"}',
}
);
Notes
• The method is part of the AgentDispatchClient in the LiveKit server SDK and requires proper API key/secret authentication.
• If you want, I can show how to read the metadata inside the agent's JobContext, or provide a full minimal example including authentication. Which would be most helpful for you? Sources: Agent dispatch | LiveKit Documentation | Outbound Calling Script | LiveKit Documentation