busy-breakfast-32623
10/07/2025, 5:35 AMtall-airline-16756
10/07/2025, 5:35 AMtall-airline-16756
10/07/2025, 5:35 AMagent_name in the token configuration, you can use the RoomConfiguration class and specify the agent dispatch information. Here's a helpful example to guide you:
const at = new AccessToken(process.env.LIVEKIT_API_KEY, process.env.LIVEKIT_API_SECRET, {
identity: 'quickstart-username',
ttl: '10m',
});
const roomConfig = new RoomConfiguration();
roomConfig.agents = [new RoomAgentDispatch({ agentName: 'your-agent-name' })];
at.roomConfig = roomConfig;
at.addGrant({ roomJoin: true, room: 'quickstart-room' });
const token = await at.toJwt();
This setup embeds the agent_name right into the JWT token, so LiveKit can dispatch the right agent when a participant joins the room.
If you have any questions or want me to walk you through any part of this, just let me know—I’m here to help!
Sources: src/pages/api/token.ts | Job lifecycle | LiveKit Docs | Authentication | LiveKit Docs | CHANGELOG.md | app/api/connection-details/route.ts