You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using explicit agent dispatch via createRoom({ agents: [{ agentName: "stt-agent", metadata: ... }] }), the dispatch is silently dropped — the agent worker never receives the job request. However, calling AgentDispatchClient.createDispatch() for the same room and agent succeeds immediately (agent connects within 0.5s). This suggests the issue is specifically with the agents field in CreateRoomRequest, not with the dispatch system in general.
This occurs intermittently and is NOT limited to idle periods. In one test, session 1 succeeded via createRoom.agents, but sessions 2, 3, and 4 (created seconds apart) all required a createDispatch() fallback. The agent container was running, registered, and had idle prewarmed workers the entire time.
The issue has three distinct failure modes:
Dispatch silently dropped — createRoom.agents creates the room but the agent never receives the job. Calling createDispatch() as a fallback delivers the job within 0.5s.
Dispatch state is wrong — listDispatch() reports JS_RUNNING for dispatches that were never delivered to the agent. We observed 4 consecutive sessions where listDispatch() showed JS_RUNNING but the agent container logged zero job requests.
Dispatch delivered with significant delay — In some cases the job arrives 6-16 seconds after room creation instead of the normal <2 seconds.
We verified the agent container was running (Azure Container Apps, min-replicas: 1, no restarts) and had a freshly prewarmed worker process available. The agent was registered with LiveKit Cloud (Frankfurt/Germany 2 region, server v1.10.1).
Relevant log output
# Agent container — registered and idle with prewarmed worker
{"level":30,"version":"1.2.3","msg":"starting worker"}
{"level":30,"version":"1.2.3","id":"AW_pppn92uksXfd","server_info":{"edition":"Cloud","version":"1.10.1","region":"Germany 2","nodeId":"NC_OFRANKFURT1B_zQeKyzpij3KH"},"msg":"registered worker"}
[STT-AGENT] Worker prewarmed pid=23
# Session 1 — createRoom.agents dispatch works, agent connects in ~2s
[LIVEKIT createRoom] Room created name=myapp-<redacted-1> metadata=set
[agent-transcript-token] Agent transcript JWT issued (2s after room creation)
[ensureAgentDispatched] Agent stt-agent connected to backend (check 1)
Transcript finalised segmentCount=2 ✅
# Session 2 — createRoom.agents dispatch FAILS, createDispatch() retry works
[LIVEKIT createRoom] Room created name=myapp-<redacted-2> metadata=set
# 5s later — agent never contacted backend:
[ensureAgentDispatched] Agent stt-agent not connected — re-dispatching (attempt 1/3)
[ensureAgentDispatched] Dispatched stt-agent to room
# 0.5s after re-dispatch — agent connects immediately:
[agent-transcript-token] Agent transcript JWT issued
[ensureAgentDispatched] Agent stt-agent connected to backend (check 2)
Transcript finalised segmentCount=2 ✅
# Sessions 3 and 4 — same pattern: createRoom.agents fails, createDispatch() works
[LIVEKIT createRoom] Room created name=myapp-<redacted-3> metadata=set
[ensureAgentDispatched] Agent stt-agent not connected — re-dispatching (attempt 1/3)
# 0.6s later — agent connects:
[agent-transcript-token] Agent transcript JWT issued
[ensureAgentDispatched] Agent stt-agent connected to backend (check 2)
Transcript finalised segmentCount=2 ✅
# Earlier test — createRoom.agents fails AND dispatch state is wrong:
# listDispatch() reported JS_RUNNING but agent container received nothing
# 4 consecutive sessions all failed with segmentCount=0
# Agent container was running with idle prewarmed worker the entire time
Create multiple rooms in sequence (each after the previous one ends)
Some rooms: agent receives job and connects normally
Other rooms: agent never receives job — no pattern to which ones fail
Workaround — calling createDispatch() delivers the job immediately:
awaitdispatchClient.createDispatch(roomName,"stt-agent",{metadata: sessionMetadata});// Agent connects within 0.5s
Additional information
The agent container never crashes or restarts — verified via Azure Container Apps status and logs.
listDispatch() returns false positives: dispatch records with JS_RUNNING status for jobs that were never delivered to the agent. This makes dispatch state unreliable for verification.
createDispatch() works reliably as a fallback — suggesting the issue is specifically with the agents field in CreateRoomRequest, not with the dispatch system in general.
Our workaround: after createRoom, we verify end-to-end that the agent contacted our backend. If not, we call createDispatch() which succeeds immediately.
Describe the bug
When using explicit agent dispatch via
createRoom({ agents: [{ agentName: "stt-agent", metadata: ... }] }), the dispatch is silently dropped — the agent worker never receives the job request. However, callingAgentDispatchClient.createDispatch()for the same room and agent succeeds immediately (agent connects within 0.5s). This suggests the issue is specifically with theagentsfield inCreateRoomRequest, not with the dispatch system in general.This occurs intermittently and is NOT limited to idle periods. In one test, session 1 succeeded via
createRoom.agents, but sessions 2, 3, and 4 (created seconds apart) all required acreateDispatch()fallback. The agent container was running, registered, and had idle prewarmed workers the entire time.The issue has three distinct failure modes:
createRoom.agentscreates the room but the agent never receives the job. CallingcreateDispatch()as a fallback delivers the job within 0.5s.listDispatch()reportsJS_RUNNINGfor dispatches that were never delivered to the agent. We observed 4 consecutive sessions wherelistDispatch()showedJS_RUNNINGbut the agent container logged zero job requests.We verified the agent container was running (Azure Container Apps,
min-replicas: 1, no restarts) and had a freshly prewarmed worker process available. The agent was registered with LiveKit Cloud (Frankfurt/Germany 2 region, server v1.10.1).Relevant log output
Describe your environment
Minimal reproducible example
cli.runApp(new ServerOptions({ agentName: "stt-agent", numIdleProcesses: 2 }))Additional information
listDispatch()returns false positives: dispatch records withJS_RUNNINGstatus for jobs that were never delivered to the agent. This makes dispatch state unreliable for verification.createDispatch()works reliably as a fallback — suggesting the issue is specifically with theagentsfield inCreateRoomRequest, not with the dispatch system in general.@livekit/agents@1.0.50to1.2.3(which includes reconnection fixes from PR fix: address 5 Detail scan bugs from March 11 (reconnect, mutex leak, playout, ordering, retryability) #1188) but the issue persists.createRoom, we verify end-to-end that the agent contacted our backend. If not, we callcreateDispatch()which succeeds immediately.