nice-napkin-15455
08/07/2025, 11:11 PMagent_name="interviewer",
and then in the client token generation I set
at.roomConfig = new RoomConfiguration({
agents: [
new RoomAgentDispatch({
agentName: 'interviewer',
}),
],
});
but agent never joins the room. why?tall-airline-16756
08/07/2025, 11:11 PMnice-napkin-15455
08/07/2025, 11:13 PMtall-airline-16756
08/07/2025, 11:13 PMnice-napkin-15455
08/07/2025, 11:14 PMtall-airline-16756
08/07/2025, 11:15 PMagent_name
. Since explicit dispatch turns off automatic dispatch, the names need to match perfectly.
2. Look at Your Token Setup: In your React frontend, confirm that the token includes the agent dispatch details inside the RoomConfiguration
. Here’s a quick example:
const roomName = "my-room";
const agentName = "test-agent";
function createTokenWithAgentDispatch() {
const token = api.AccessToken()
.with_identity("my_participant")
.with_grants(api.VideoGrants({ room_join: true, room: roomName }))
.with_room_config(
api.RoomConfiguration({
agents: [
api.RoomAgentDispatch({ agent_name: agentName, metadata: "my_metadata" })
]
})
)
.to_jwt();
return token;
}
1. Keep an Eye on Connection Status: Use connection state indicators in your frontend to see how the agent’s connection is doing. Here’s an example snippet:
useEffect(() => {
const handleConnect = async () => {
try {
// Generate token and connect to room
} catch (error) {
console.error('Connection failed:', error);
}
};
}, []);
1. Watch Out for Common Issues:
◦ Make sure the room name exists and matches everywhere.
◦ Check that the agent_name
is consistent in both your worker and token setup.
◦ Look out for any network connectivity hiccups.
◦ Confirm that token generation and validation are working as expected.
1. Handle Async Operations Properly: Be sure all async calls (like room.connect()
) are awaited correctly.
If you’re still stuck after trying these, feel free to share with me:
• The exact error message or logs you’re seeing
• Whether you’re using explicit dispatch via API or token-based dispatch
• The specific versions of LiveKit and SDKs you’re working with Sources: Dispatching agents | LiveKit Docs | examples/agent-dispatch/index.ts | Web and mobile frontends | LiveKit Docs