Got the following error logs - `{"level": "WARNIN...
# ask-ai
t
Got the following error logs -
{"level": "WARNING", "name": "livekit.agents", "message": "The room connection was not established within 10 seconds after calling job_entry. This might mean that job_ctx.connect() was never invoked, or that no AgentSession with an active RoomIO has been started.", "room": "my-first-room", "pid": 36, "job_id": "AJ_8Du7tcCSVwA9", "room_id": "RM_sG8P5urCwRuT", "timestamp": "2025-12-03T14:02:16.557651+00:00"}
{"level": "WARNING", "name": "livekit", "message": "livekit::rtc_engine:401:livekit::rtc_engine - failed to connect: Connection(\"wait_pc_connection timed out\"), retrying... (1/3)", "room": "my-first-room", "pid": 36, "job_id": "AJ_8Du7tcCSVwA9", "room_id": "RM_sG8P5urCwRuT", "timestamp": "2025-12-03T14:02:21.718022+00:00"}
t
Thanks for reaching out, Atul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m looking at the two warnings you shared: the agent didn’t establish a room connection within 10s, and the WebRTC peer connection timed out (
wait_pc_connection timed out
). I can help narrow this down and get you a fix. Quick checklist and next steps you can run now: 1. Confirm how your agent joins the room ◦ Are you using
AgentSession
(calling
session.start()
) or manual
ctx.connect()
? If neither is called promptly the job will time out. 1. Check for blocking initialization before connect ◦ Move heavy startup work before the job starts or call
ctx.connect()
immediately in the job entry so the connect attempt happens within 10s. 1. Test network / TURN accessibility from the agent host ◦ Run the LiveKit Connection Test from the agent server to verify WebSocket, ICE, and TURN connectivity (especially TURN over TLS/443). If UDP is blocked, force TURN relay:
Copy code
await ctx.connect(rtc_config={"iceTransportPolicy": "relay"})
1. Verify firewall and outbound ports on the agent host ◦ Ensure outbound TCP 443, TCP 7880/7881 (signaling), and UDP media ports are permitted. TURN over TLS (443) is most firewall-friendly. 1. Check agent host health and deployment topology ◦ Ensure the host isn’t CPU/memory constrained (burstable instances may throttle). Deploy multiple agent workers (≥3) and place them in a region close to the LiveKit region/users. If you’d like, tell me: • Whether you use
AgentSession
or
ctx.connect()
(paste the relevant snippet if possible). • Where the agent runs (local, AWS, Docker, etc.). • Whether this happens every time or intermittently. • Results from the LiveKit Connection Test if you’ve run it. Share those details and I’ll suggest the most targeted next action. Sources: How to Get Help from LiveKit | Job lifecycle | LiveKit docs | Agents (Node.js) | livekit/livekit_composite | DeepWiki | Connecting to LiveKit | LiveKit docs | Firewall Tips