When I try to connect the agent with Livekit Agent...
# ask-ai
s
When I try to connect the agent with Livekit Agents UI, it says "Agent did not join the room." after a few seconds, it shows the state as "Listening..."
t
Thanks for reaching out, Fahim. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re hitting that. I’m responding to the message where the Agents UI shows “Agent did not join the room.” and then the UI state becomes “Listening...”. This typically means the UI started but the actual agent process never successfully joined the LiveKit room. I can help pinpoint the cause, but I need a bit more information. Could you answer the quick questions below and share any logs you can? 1. How are you running the agent? ◦ Locally in dev mode, inside Docker, or deployed to a cloud/VM? ◦ If locally, did you run it with a dev flag or a specific start command? 1. How is the agent dispatched to a room? ◦ Automatic dispatch, token-based, or via the Agent Dispatch API? ◦ If you’re using an
agent_name
or explicit dispatch flow, did you call the dispatch API or create a dispatch token? 1. Environment / configuration checks ◦ Are these environment variables set for the agent:
LIVEKIT_URL
,
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
? ◦ Is the room being created beforehand, or does the agent expect the UI to create/join it? 1. Logs and console output (most helpful) ◦ Agent server logs (startup logs and any errors) — especially messages mentioning registration, join attempts, or token validation. ◦ Browser console logs from the Agents UI when you try to connect (any network / WebSocket errors). ◦ LiveKit server logs (if available) showing join/connection attempts or token rejections. 1. Network / connectivity ◦ Are there any firewalls, proxies, or NAT rules that might block WebRTC/WS (ports typically used by LiveKit)? ◦ Can you confirm the agent host can reach your
LIVEKIT_URL
(a simple curl to that URL if it’s an HTTP endpoint is fine)? What I can do after you share that: • If logs show authentication/token failures, I’ll walk you through verifying token generation and permissions. • If dispatch wasn’t performed, I’ll explain the required dispatch flow for your chosen method and the minimal steps to make the agent join. • If it’s a connectivity issue, I’ll give targeted checks (ports/protocols to test) and how to confirm WebSocket/STUN/TURN reachability. If you paste the agent logs and the browser console errors here, I’ll review them and point out the next fix. Sources: Build agent experiences faster with Session APIs | LiveKit | Agents UI | LiveKit | Agent dispatch | LiveKit Documentation | Build Your First AI Voice Agent in Python: Complete Tutorial | LiveKit | examples/drive-thru | livekit/livekit_composite | DeepWiki