miniature-oil-11138
12/11/2025, 9:20 PMconst roomMetadata = {
testId: body.test_id,
roundType,
agentName: resolvedAgentNameForRoom,
jdConfig,
createdAt: new Date().toISOString(),
transcriptUploadUrl,
};
this.logger.log(`Creating new room: ${roomName} with agent ${resolvedAgentNameForRoom ?? 'none'}`);
const roomCreateRequest: any = {
name: roomName,
metadata: JSON.stringify(roomMetadata),
emptyTimeout: 60 * 10,
maxParticipants: 2,
};
if (resolvedAgentNameForRoom) {
roomCreateRequest.roomConfig = new RoomConfiguration({
agents: [new RoomAgentDispatch({ agentName: resolvedAgentNameForRoom })],
});
}
await this.roomService.createRoom(roomCreateRequest);tall-airline-16756
12/11/2025, 9:20 PMtall-airline-16756
12/11/2025, 9:21 PMroomConfig with agents: [RoomAgentDispatch({ agentName: resolvedAgentNameForRoom })]. To help diagnose why "preview-agent" isn’t joining, I need a few quick details and can suggest checks you can run now.
Could you confirm:
1. What exact behavior you see when the room is created (no join attempt, join attempt but fails, or an error logged)?
2. Worker deployment details: do both workers advertise the agent name preview-agent in their worker options, and are they currently running/ready?
3. Any logs from the workers or the agent subsystem at the time you create the room (worker startup logs, dispatch logs, or errors)?
4. The value of resolvedAgentNameForRoom at runtime (is it exactly "preview-agent")?
Quick checks to run now:
• Verify the agent name string matches exactly (case and whitespace) between roomConfig and the worker options.
• Confirm the worker that should handle preview-agent is healthy and has finished any warmup/cold-start steps so it can accept dispatches.
• Check worker logs for incoming dispatch requests when you call createRoom and for any failures or rejections.
• If you can, temporarily create a room with no `maxParticipants`/limits or with increased timeouts to rule out immediate disconnects.
If you share the answers and a short excerpt of the worker and server logs around room creation, I’ll suggest targeted next steps (config changes or log lines to watch). Would you like help formatting the logs or collecting specific log lines?
Sources: Agent dispatch | LiveKit docs | Agents telephony integration | LiveKit docs | Deploying to production | LiveKit Docs | SIP troubleshooting guide | LiveKit docsminiature-oil-11138
12/11/2025, 9:40 PMtall-airline-16756
12/11/2025, 9:40 PMpreview-agent isn’t being selected and agent 1 is getting dispatched instead.
Please provide these quick details so I can diagnose:
1. How you start each worker (CLI command or code).
2. Exact agent_name values configured for both workers (copy/paste if possible).
3. The runtime value of resolvedAgentNameForRoom when you create the room (is it exactly "preview-agent"?).
4. Worker registration logs around startup (lines that show the agent name or registration) and logs when you call createRoom (dispatch attempts/errors).
Short checks you can run now:
• Confirm the worker that should be preview-agent is running and reports that exact agent_name (case-sensitive).
• Look in worker logs for an incoming dispatch when the room is created and any rejection or error.
• Ensure there aren’t duplicate or default agent registrations that might match before preview-agent.
Send the requested config/log snippets and the resolvedAgentName value and I’ll point out the likely cause and exact next steps.
Sources: Agent dispatch | LiveKit docstall-airline-16756
12/11/2025, 10:11 PM1 is chosen instead of preview-agent.
From your details: worker 1 has no agent_name, worker 2 is registered as preview-agent, and your resolvedAgentNameForRoom is exactly "preview-agent". The worker-registration log you sent shows the unnamed worker registered as AW_6njcGSJBeegU (no visible agent name). That explains the behavior: an unnamed/default worker can match dispatches unless the dispatch system requires and matches explicit agent names.
Next steps to ensure preview-agent is always selected:
1. Start the intended worker with an explicit agent name:
◦ Run the worker with the option that sets agent_name (CLI flag or WorkerOptions). Ensure the preview worker uses the exact name preview-agent (case-sensitive).
1. Give the default/unnamed worker an explicit, different agent_name or remove it if it shouldn’t accept dispatches.
2. Confirm registration logs show the agent names after startup. You should see entries that include the agent name for each worker.
3. Re-create the room with your RoomAgentDispatch({ agentName: "preview-agent" }) and watch worker logs for the incoming dispatch to the preview worker.
If you want, paste the CLI/worker start command you use now (the full command and flags) and I’ll tell you the exact flag/form to add to set agent_name or how to change the unnamed worker so it won’t be picked.miniature-oil-11138
12/11/2025, 10:14 PMtall-airline-16756
12/11/2025, 10:15 PMagent_name, they operate in explicit-dispatch mode.
• In explicit-dispatch mode, no agent will be dispatched unless you include the matching agent_name in the dispatch (roomConfig, token, API call, or SIP rule).
• So: with both workers named and you omit an agent name, no agent will join the room.
Options you can use:
• Continue using explicit names and always include agent_name when creating rooms.
• Keep one worker unnamed (or register it without an agent_name) to allow automatic dispatch when no name is provided.
Would you like the exact CLI/WorkerOptions flags to set or remove agent_name for your worker start command?
Sources: Agent dispatch | LiveKit docs | SIP dispatch rule | LiveKit docsminiature-oil-11138
12/11/2025, 10:15 PMtall-airline-16756
12/11/2025, 10:16 PMagent_name="preview-agent". Short answer and concrete checks:
• If any worker is running without an agent_name (unnamed/default), it remains eligible for automatic dispatch and can accept the room.
• When you name workers (explicit-dispatch mode), those named workers will only accept explicit dispatches for that name — but unnamed workers do not enter explicit mode and can still be picked up automatically.
• If the named worker (preview-agent) is not registered/available at dispatch time, an unnamed/default worker may take the job.
Do this to guarantee preview-agent is used:
1. Ensure the preview worker is started with the exact name preview-agent (case-sensitive) — set --agent-name preview-agent or WorkerOptions.agentName = "preview-agent" in your start command/code.
2. Give every other worker a different explicit agent_name or stop/remove unnamed workers so no automatic dispatch can occur.
3. Verify registrations with lk agent list and watch dispatch acceptance in the worker logs when you create the room.
If you share the exact worker start commands you use now, I’ll show the exact flag to add (or how to rename the unnamed worker).
Sources: Agent dispatch | LiveKit docs | Agent deployment CLI reference | LiveKit docsminiature-oil-11138
12/11/2025, 10:19 PMtall-airline-16756
12/11/2025, 10:20 PMpreview-agent and dispatch with that name.
Short answer: an unnamed worker can still accept rooms via automatic dispatch. That will happen if the named worker either isn't available/registered at dispatch time or the dispatch request isn't actually matching the registered name. To diagnose, please check these three things now:
1. Confirm the named worker is actually registered before you create the room:
◦ Run lk agent list and verify an entry shows preview-agent (exact spelling/case).
1. Check the dispatch-time logs:
◦ Server logs when you call createRoom (ensure roomConfig.agents contains preview-agent).
◦ Worker logs for preview-agent around the same time (look for registration and incoming dispatch attempts).
1. Ensure there are no unnamed workers left running:
◦ Stop/rename any worker that was started without --agent-name (or give it a different explicit name). Unnamed workers remain eligible for automatic dispatch and can take the room.
If you want, paste:
• The exact command(s) you use to start each worker,
• The lk agent list output,
• The small log snippets showing worker registration + the server call to create the room.
I’ll point out the exact mismatch and the precise flag/command change to make preview-agent the one selected.miniature-oil-11138
12/11/2025, 11:16 PMtall-airline-16756
12/11/2025, 11:16 PMagent_name set, LiveKit is in explicit-dispatch mode: an agent will only join if the dispatch request contains a matching agent_name. If no agent joined, one of these is true:
• The dispatch did not actually include the exact agent name (case/whitespace must match).
• The named worker was not registered/ready when the room was created.
• The workers registered with different names than you expect (typo or flag not applied).
Please run these quick checks and share the outputs so I can pinpoint the problem:
1. Run lk agent list and paste the lines for both workers.
2. Share the exact commands/flags you use to start each worker.
3. Show the runtime value of resolvedAgentNameForRoom (the string sent in roomConfig).
4. Paste the worker startup log lines that show registration and the server log lines when you call createRoom.
With those three snippets I’ll tell you exactly which name mismatches or timing issue is happening and the precise fix (exact flag or ordering change).miniature-oil-11138
12/12/2025, 9:28 AMtall-airline-16756
12/12/2025, 9:29 AMlk agent list — confirm your preview-agent appears (exact case/spelling).
• Stream deploy/runtime logs: lk agent logs --id <agent-id> --log-type=deploy — watch for dispatch acceptance, timeouts, or “no worker available” messages.
• For build logs: lk agent logs --id <agent-id> --log-type=build.
5) Common log messages to look for
• failed to dispatch agent: no worker available — no matching/available worker.
• room connection not established within 10 seconds — agent failed to connect in time.
• Any agent_name mismatch or registration errors.
6) Test a manual dispatch
• Use the CLI to force a dispatch and watch logs:
◦ lk dispatch create --agent-name preview-agent --room my-test-room --metadata '{"test":true}'
7) Long-term log access
• LiveKit Cloud does not retain runtime logs long-term; forward logs to Datadog/CloudWatch/Sentry/New Relic for persistent analysis.
If you want, paste the session ID or the lk agent list output and a short deploy log snippet and I’ll point to the exact error lines to act on.
Sources: Agent insights in LiveKit Cloud | LiveKit docs | https://blog.livekit.io/streamline-troubleshooting-with-agent-observability/#/portal/signup| | Agent dispatch | LiveKit docs | Agent deployment CLI reference | LiveKit docs | SIP dispatch rule | LiveKit docs