modern-winter-66316
12/03/2025, 12:50 AMtall-airline-16756
12/03/2025, 12:50 AMtall-airline-16756
12/03/2025, 12:50 AMmodern-winter-66316
12/03/2025, 12:55 AMtall-airline-16756
12/03/2025, 12:56 AMagent_name in your agent code or dispatch request? If yes, what value (or confirm both sides match for SIP)?
4. Do you reuse room names or create a unique name per session?
5. Any error logs, timestamps, or observed behavior (e.g., agent cold-start delay ~10–20s, immediate failure, or silent no-join)?
6. Which SDK/language and plan (Build/cloud) are you running the agent on?
With those details I’ll point to the most likely cause and the exact steps to fix it.
Sources: Agent dispatch | LiveKit docs | SIP troubleshooting guide | LiveKit docs | Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | Quotas and limits | LiveKit docs | How to test your agent using another agentmodern-winter-66316
12/03/2025, 12:56 AMtall-airline-16756
12/03/2025, 12:56 AMmodern-winter-66316
12/03/2025, 12:59 AMtall-airline-16756
12/03/2025, 12:59 AMmodern-winter-66316
12/03/2025, 1:09 AM[DebugClient] Requesting token from /api/connect-debug
[DebugClient] Token endpoint response: {
"token": "eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiRW5nbGlzaCBUZWFjaGVyIFN0dWRlbnQiLCJ2aWRlbyI6eyJyb29tIjoiZW5nbGlzaC10ZWFjaGVyLTE3NjQ3MjQwNzYwNDItdDY0MGduNyIsInJvb21Kb2luIjp0cnVlLCJjYW5QdWJsaXNoIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlfSwicm9vbUNvbmZpZyI6eyJhZ2VudHMiOlt7ImFnZW50TmFtZSI6IkNBXzRUMmN2cWJMNkp3SCIsIm1ldGFkYXRhIjoie1wic2NlbmFyaW9cIjpcImRlYnVnXCIsXCJsZXZlbFwiOlwiZGVidWdcIixcInZvaWNlX3Byb3ZpZGVyXCI6XCJsaXZla2l0XCIsXCJ2b2ljZVwiOlwiZGVmYXVsdFwifSJ9XX0sImlzcyI6IkFQSUxGSzY0V3JWTmVXTCIsImV4cCI6MTc2NDcyNDY3NiwibmJmIjowLCJzdWIiOiJ1c2VyLTE3NjQ3MjQwNzYzODQifQ.Dpkh_fzKj8eOjag9g7xEoiz_FRaLS2bqDQPuDXMzNX0",
"url": "wss://englishlive-3qjapr2j.livekit.cloud",
"room": "english-teacher-1764724076042-t640gn7",
"metadata": {
"scenario": "debug",
"level": "debug",
"voice_provider": "livekit",
"voice": "default"
},
"dispatchId": null,
"agentName": "CA_4T2cvqbL6JwH",
"token_debug": {
"name": "English Teacher Student",
"video": {
"room": "english-teacher-1764724076042-t640gn7",
"roomJoin": true,
"canPublish": true,
"canSubscribe": true,
"canPublishData": true
},
"roomConfig": {
"agents": [
{
"agentName": "CA_4T2cvqbL6JwH",
"metadata": "{\"scenario\":\"debug\",\"level\":\"debug\",\"voice_provider\":\"livekit\",\"voice\":\"default\"}"
}
]
},
"iss": "APILFK64WrVNeWL",
"exp": 1764724676,
"nbf": 0,
"sub": "user-1764724076384"
}
}
[DebugClient] Decoded token payload: {
"name": "English Teacher Student",
"video": {
"room": "english-teacher-1764724076042-t640gn7",
"roomJoin": true,
"canPublish": true,
"canSubscribe": true,
"canPublishData": true
},
"roomConfig": {
"agents": [
{
"agentName": "CA_4T2cvqbL6JwH",
"metadata": "{\"scenario\":\"debug\",\"level\":\"debug\",\"voice_provider\":\"livekit\",\"voice\":\"default\"}"
}
]
},
"iss": "APILFK64WrVNeWL",
"exp": 1764724676,
"nbf": 0,
"sub": "user-1764724076384"
}
[DebugClient] Connecting to wss://englishlive-3qjapr2j.livekit.cloud
[DebugClient] Connected. Local participant identity: user-1764724076384
[DebugClient] Published local audio track
[DebugClient] Staying connected for 30000ms to allow agent dispatch
[DebugClient] connectionQualityChanged excellent user-1764724076384tall-airline-16756
12/03/2025, 1:09 AMroomConfig.agents with agentName: "CA_4T2cvqbL6JwH".
• The client connected to wss://englishlive-3qjapr2j.livekit.cloud as user-1764724076384, published audio, and stayed connected waiting for agent dispatch.
• dispatchId in the token response is null (no explicit dispatch was created).
Next checks I need from you (quick answers)
1. Is your agent process/server running and able to receive dispatches?
2. Did you set agent_name in the agent code (e.g., WorkerOptions/@server.rtc_session)? If so, confirm it exactly equals CA_4T2cvqbL6JwH.
3. Are you expecting automatic dispatch or did you explicitly dispatch agents via API/SIP/participant token? (Token shows roomConfig.agents, which should dispatch the agent when the participant connects.)
4. Do you have agent-side logs from around this connection time showing any incoming dispatch, errors, or cold-start delays?
5. Which plan is this on (Build vs Cloud)? If Build, did the agent need a cold-start (10–20s delay)?
Immediate troubleshooting steps you can try now
• Confirm the agent process is online and listening for dispatches; check agent logs for an incoming dispatch matching CA_4T2cvqbL6JwH.
• If the agent is configured with an explicit agent_name, ensure it exactly matches the token agentName. Mismatch prevents joins.
• If you reuse room names often, create a unique room name for a fresh room and test again.
• If on Build plan, allow ~20s after the participant connects for the agent cold-start and watch agent logs.
If you prefer, paste the agent logs around the same timestamp (or confirm the answers to questions 1–5) and I’ll point to the exact cause and next fix.modern-winter-66316
12/03/2025, 1:10 AMtall-airline-16756
12/03/2025, 1:11 AMCA_4T2cvqbL6JwH. To pinpoint why it still isn't joining, please answer these quick checks and share any agent logs if available:
1. How is the agent being dispatched — automatic (via roomConfig.agents in the token) or explicit (API/SIP)?
2. Do agent logs show an incoming dispatch or any errors at the time the participant connected? Please paste the agent log lines around that timestamp.
3. Which plan is the agent on (Build or Cloud)? If Build, did you observe a ~10–20s cold-start delay?
4. Are you reusing the same room name repeatedly or creating unique room names per session?
5. Does the agent require any special RoomInputOptions (e.g., to listen to agent audio) or other room configuration that might block joining?
If you paste the agent-side logs for the connection time (or confirm answers 1–5), I’ll analyze them and give exact next steps.modern-winter-66316
12/03/2025, 1:12 AMtall-airline-16756
12/03/2025, 1:12 AMagent_name in your agent server (for example via WorkerOptions or your framework's agent decorator), that value identifies the running agent instance. If you set this, automatic dispatch is disabled and the agent will only join when explicitly dispatched to that exact agent_name.
• In the participant token or dispatch request:
◦ Include roomConfig.agents (in the token) or create an AgentDispatch via the API with agentName: "YOUR_AGENT_NAME". When a participant connects with a token that contains roomConfig.agents, the system will attempt to dispatch an agent with that agentName.
• For SIP inbound calls:
◦ Ensure the agent_name in the agent server matches the agent_name specified in the SIP dispatch rule (RoomAgentDispatch.agent_name). A mismatch prevents the agent from answering.
What I can do next
• If you tell me which SDK/language your agent uses (Node/Python/other) and whether you use automatic token-based dispatch or explicit API/SIP dispatch, I’ll give a short, exact code snippet showing where to set agent_name and how to dispatch.modern-winter-66316
12/03/2025, 1:16 AMtall-airline-16756
12/03/2025, 1:17 AMagent_name in the worker options and the token includes roomConfig.agents (automatic dispatch). That combination explains the behavior.
Short explanation
• When an agent process sets an agent_name in its WorkerOptions, automatic token-based dispatch is disabled for that agent process; the agent will only join when explicitly dispatched to that exact agent_name. Your token contains roomConfig.agents, which requests automatic dispatch, so the running agent didn't receive an automatic dispatch match.
Two simple ways to fix (pick one)
1) Use automatic token-based dispatch (no agent_name in the agent process)
• Remove setting agent_name from WorkerOptions so the agent can be auto-dispatched when a token contains roomConfig.agents.
2) Use explicit dispatch (keep agent_name in the agent and dispatch to it)
• Keep agent_name in WorkerOptions and create a dispatch that targets that name (via the AgentDispatch API, or include the exact agentName in the participant token/dispatch request).
What to check now
• After making your chosen change, connect a participant with the token you posted and watch agent logs for either:
◦ "Agent job received: room=..." (explicit dispatch) or
◦ agent joining the room within ~10–20s (allow for Build cold-starts) if using automatic dispatch.
• If you keep agent_name, verify the string exactly matches the token's agentName (CA_4T2cvqbL6JwH).
If you'd like, tell me which option you prefer and I’ll provide a short code snippet for your agent language (Node or Python) showing the exact change and a sample dispatch call.modern-winter-66316
12/03/2025, 1:20 AMtall-airline-16756
12/03/2025, 1:20 AMagent_name in WorkerOptions so the agent process remains eligible for automatic dispatch from roomConfig.agents.
Python agent worker (minimal example)
# agent/main.py
from livekit_agent import Worker, WorkerOptions, Agent # adjust imports to your package
def create_agent():
# DO NOT set agent_name here for automatic dispatch
options = WorkerOptions(
# agent_name=None, # do not set or pass agent_name
# other options as needed, e.g. region, logging, etc.
)
worker = Worker(options=options)
@worker.on_rtc_session() # example decorator - use your framework's handler
async def handle_session(session):
agent = Agent(session)
await agent.run()
return worker
if __name__ == "__main__":
worker = create_agent()
worker.start()
Testing steps
1. Deploy this updated agent without an agent_name in WorkerOptions.
2. Connect a participant using a token that includes roomConfig.agents (like the token you posted).
3. Watch agent logs — you should see an incoming dispatch/job and the agent joining the room. Allow ~10–20s if the agent requires a cold-start.
4. Confirm the participant hears/receives the agent and that logs show something like "Agent job received: room=..." or "Joined room ...".
If you want, tell me which Python agent library or decorator names you use (exact imports), and I’ll give a snippet tailored to your code.modern-winter-66316
12/03/2025, 1:22 AMtall-airline-16756
12/03/2025, 1:22 AMagent_name in WorkerOptions, provide roomConfig.agents in the participant token, and implement an entrypoint that calls ctx.connect().
Checklist to verify now
• WorkerOptions: confirm you do NOT pass agent_name.
• Token: contains roomConfig.agents with the exact agentName you expect (your pasted token shows this).
• Agent logs: when participant connects, you should see "Agent job received: room=..." and then "Connected to LiveKit room" after await ctx.connect().
• Cold-start: if on Build or suspended worker, allow ~10–20s for the agent to start.
• Room uniqueness: continue using unique room names per session.
Minimal code snippet adjusted to your imports (matches your pattern)
from livekit.agents import AgentSession, JobContext, WorkerOptions, cli
from livekit.agents.worker import ServerType
def cli_entry() -> None:
cli.run_app(
WorkerOptions(
entrypoint_fnc=entrypoint,
_worker_type=ServerType.ROOM,
# DO NOT set agent_name here for automatic token-based dispatch
)
)
async def entrypoint(ctx: JobContext) -> None:
logger.info(f"Agent job received: room={ctx.job.room_name}, metadata={ctx.job.metadata}")
await ctx.connect() # join the room
logger.info("Connected to LiveKit room")
# ... rest of agent logic ...
If after this you still don't see the "Agent job received" log line when the participant connects, paste the agent logs for that timeframe and I’ll help interpret them. Would you like that?modern-winter-66316
12/03/2025, 1:54 AM[DebugClient] Requesting token from /api/connect-debug
[DebugClient] Token endpoint response: {
"token": "eyJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiRW5nbGlzaCBUZWFjaGVyIFN0dWRlbnQiLCJ2aWRlbyI6eyJyb29tIjoiZW5nbGlzaC10ZWFjaGVyLTE3NjQ3MjY4Mzc0NDQtZW5paGNqdiIsInJvb21Kb2luIjp0cnVlLCJjYW5QdWJsaXNoIjp0cnVlLCJjYW5TdWJzY3JpYmUiOnRydWUsImNhblB1Ymxpc2hEYXRhIjp0cnVlfSwicm9vbUNvbmZpZyI6eyJhZ2VudHMiOlt7ImFnZW50TmFtZSI6IkNBXzRUMmN2cWJMNkp3SCIsIm1ldGFkYXRhIjoie1wic2NlbmFyaW9cIjpcImRlYnVnXCIsXCJsZXZlbFwiOlwiZGVidWdcIixcInZvaWNlX3Byb3ZpZGVyXCI6XCJsaXZla2l0XCIsXCJ2b2ljZVwiOlwiZGVmYXVsdFwifSJ9XX0sImlzcyI6IkFQSUxGSzY0V3JWTmVXTCIsImV4cCI6MTc2NDcyNzQzNywibmJmIjowLCJzdWIiOiJ1c2VyLTE3NjQ3MjY4Mzc5NDgifQ.bCmgZbSMywp6M6AYV9cJ_dctcslWk61V_ejjXjDL0WQ",
"url": "wss://englishlive-3qjapr2j.livekit.cloud",
"room": "english-teacher-1764726837444-enihcjv",
"metadata": {
"scenario": "debug",
"level": "debug",
"voice_provider": "livekit",
"voice": "default"
},
"dispatchId": null,
"agentName": "CA_4T2cvqbL6JwH",
"token_debug": {
"name": "English Teacher Student",
"video": {
"room": "english-teacher-1764726837444-enihcjv",
"roomJoin": true,
"canPublish": true,
"canSubscribe": true,
"canPublishData": true
},
"roomConfig": {
"agents": [
{
"agentName": "CA_4T2cvqbL6JwH",
"metadata": "{\"scenario\":\"debug\",\"level\":\"debug\",\"voice_provider\":\"livekit\",\"voice\":\"default\"}"
}
]
},
"iss": "APILFK64WrVNeWL",
"exp": 1764727437,
"nbf": 0,
"sub": "user-1764726837948"
}
}
[DebugClient] Decoded token payload: {
"name": "English Teacher Student",
"video": {
"room": "english-teacher-1764726837444-enihcjv",
"roomJoin": true,
"canPublish": true,
"canSubscribe": true,
"canPublishData": true
},
"roomConfig": {
"agents": [
{
"agentName": "CA_4T2cvqbL6JwH",
"metadata": "{\"scenario\":\"debug\",\"level\":\"debug\",\"voice_provider\":\"livekit\",\"voice\":\"default\"}"
}
]
},
"iss": "APILFK64WrVNeWL",
"exp": 1764727437,
"nbf": 0,
"sub": "user-1764726837948"
}
[DebugClient] Connecting to wss://englishlive-3qjapr2j.livekit.cloud
[DebugClient] Connected. Local participant identity: user-1764726837948
[DebugClient] Published local audio track
[DebugClient] Staying connected for 30000ms to allow agent dispatch
[DebugClient] connectionQualityChanged excellent user-1764726837948tall-airline-16756
12/03/2025, 1:54 AMroomConfig.agents containing agentName: "CA_4T2cvqbL6JwH", and your worker is launched without agent_name in WorkerOptions. To find why the agent still isn't joining, please do the following checks and paste any relevant agent logs:
Checklist (run now)
• Confirm the agent process is running and connected to LiveKit control plane at the time the participant connects.
• Inspect agent logs around the participant connect time for any of these messages:
◦ "Agent job received: room=..." (dispatch received)
◦ "Connected to LiveKit room" (after await ctx.connect())
◦ Any errors, tracebacks, or warnings.
• If you see no "Agent job received" line, verify the agent can reach the control plane and that there are no network/firewall issues blocking outbound connections.
• Confirm the worker is not accidentally setting agent_name from an environment variable or default (print WorkerOptions() at startup to verify it’s unset).
• If on Build or with autoscaling, allow ~10–20s for cold-start and watch logs during that window.
• Confirm room name in the token matches the room the debug client joined.
If you paste the agent log lines for the exact timestamp when the debug client connected, I’ll analyze them and tell you the exact next step. Would you like me to look at those logs now?