rhythmic-librarian-54602
02/20/2026, 9:01 AMpython -m agents.main -a mem0stt dev
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
/home/user/repos/backend/.venv/lib/python3.13/site-packages/livekit/agents/cli/cli.py:1503: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
17:48:33.958 DEBUG asyncio Using selector: EpollSelector
17:48:33.962 DEV livekit.agents Watching /home/user/repos/backend/agents
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
17:48:39.355 DEBUG asyncio Using selector: EpollSelector
/home/user/repos/backend/.venv/lib/python3.13/site-packages/livekit/agents/utils/http_server.py:13: DeprecationWarning: loop argument is deprecated
self._app = web.Application(loop=self._loop)
17:48:39.361 INFO livekit.agents starting worker {"version": "1.3.5", "rtc-version": "1.0.19"}
17:48:39.362 INFO livekit.agents preloading plugins {"packages": ["livekit.plugins.langchain", "livekit.plugins.openai", "livekit.plugins.silero", "livekit.plugins.turn_detector", "av"]}
17:48:39.366 INFO livekit.agents starting inference executor
17:48:40.985 INFO livekit.agents initializing process {"pid": 112805, "inference": true}
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
17:48:47.912 INFO livekit.agents process initialized {"pid": 112805, "inference": true, "elapsed_time": 6.92}
/home/user/repos/backend/.venv/lib/python3.13/site-packages/livekit/agents/utils/http_server.py:26: DeprecationWarning: Application.make_handler(...) is deprecated, use AppRunner API instead
handler = self._app.make_handler()
17:48:48.756 INFO livekit.agents registered worker {"agent_name": "", "id": "AW_dhHficBPa5KE", "url": "<wss://livekit.myselfhostedvm.io>", "region": "", "protocol": 16}
17:49:17.864 INFO livekit.agents received job request {"job_id": "AJ_a7fmJ3ySGuvb", "dispatch_id": "AD_qvESNXerPFdT", "room": "room-daef50db-bb9d-4f5e-973f-ff4dcba5ce75", "room_id": "RM_U6yfTTRse5mT", "agent_name": "",
"resuming": false, "enable_recording": false}
17:49:18.047 DEBUG livekit.agents received assignment {"agent_name": "", "room_id": "RM_U6yfTTRse5mT", "room": "room-daef50db-bb9d-4f5e-973f-ff4dcba5ce75", "job_id": "AJ_a7fmJ3ySGuvb", "dispatch_id": "AD_qvESNXerPFdT",
"enable_recording": false}
17:49:18.058 INFO livekit.agents initializing process {"pid": 113183}
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
17:49:22.128 INFO livekit.agents process initialized {"pid": 113183, "elapsed_time": 4.07}
17:49:22.125 DEBUG asyncio Using selector: EpollSelector {"pid": 113183}
2026-02-20 17:49:22.148 | DEBUG | agents.mem0stt:entrypoint:97 - [*] Starting the entrypoint
17:49:32.152 WARNI… livekit.agents The room connection was not established within 10 seconds after calling job_entry. This might mean that job_ctx.connect() {"pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}
was never invoked, or that no AgentSession with an active RoomIO has been started.
17:49:37.816 WARNI… livekit livekit::rtc_engine:401:livekit::rtc_engine - failed to connect: Connection("wait_pc_connection timed out"), retrying... {"pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}
(1/3)
17:49:38.159 INFO livekit.agents process exiting {"reason": "", "pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}
17:49:38.158 DEBUG livekit.agents shutting down job task {"reason": "", "user_initiated": false, "pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}
17:49:38.161 DEBUG livekit.agents http_session(): closing the httpclient ctx {"pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}
DEBUG livekit.agents http_session(): creating a new httpclient ctx {"pid": 113183, "job_id": "AJ_a7fmJ3ySGuvb", "room_id": "RM_U6yfTTRse5mT"}tall-airline-16756
02/20/2026, 9:02 AMtall-airline-16756
02/20/2026, 9:02 AMwait_pc_connection timed out retry.
Below is a focused checklist (what the logs indicate plus concrete things to check and try). If anything is unclear, tell me which part of your agent code or which config file you want to share and I’ll walk through it with you.
Key facts from your logs
• Worker registers successfully with your server: registered worker ... "url": "<wss://livekit.myselfhostedvm.io>". So job dispatch/connect for control is working.
• Job is received and the agent starts processing, but:
◦ “The room connection was not established within 10 seconds after calling job_entry.” — either job_ctx.connect() was never invoked in your entrypoint, or it was invoked but WebRTC negotiation failed.
◦ failed to connect: Connection("wait_pc_connection timed out") — the peer connection never completed (ICE/DTLS/WebRTC negotiation).
What to check and try (step-by-step)
1) Confirm your entrypoint calls connect
• Ensure your agent’s entrypoint calls await ctx.connect(...) (or job_ctx.connect() equivalent) to start the RoomIO/peer connection.
• Example pattern to include:
await ctx.connect(auto_subscribe=AutoSubscribe.ALL_ROOM)
If you don’t call this, the job will never establish the per-job media connection and will hit the 10s timeout.
2) Verify TURN/ICE and networking on your self-hosted VM
• Self-hosted setups commonly fail at this stage when ICE/STUN/TURN is not available or UDP is blocked.
• Ensure TURN is enabled in your LiveKit config (for a self-hosted VM you must provide a TURN/relay for NAT/firewall situations).
• Open required ports on your VM/firewall:
◦ UDP ephemeral ports (for direct ICE) and TCP/443 for TURN/TLS fallback.
• If UDP is blocked and TURN is not configured, the peer connection will timeout.
3) Check TLS / WebSocket access
• Confirm <wss://livekit.myselfhostedvm.io> resolves and the certificate is valid (not self-signed).
• A valid TLS cert is required in many environments for WebRTC to fully work.
• Quick test: try a wss connection from the worker host with a tool like wscat to confirm handshake (or curl/openssl s_client to confirm certificate).
4) Try a browser client to the same room
• Join the same room from a browser (using your server URL). If the browser also fails to connect -> problem is server/network/TURN.
• If the browser can join but agent cannot -> issue is agent-side (code, environment, or missing dependencies).
5) Review agent logs for model-loading delays
• Your logs show repeated: “None of PyTorch, TensorFlow >= 2.0, or Flax have been found.”
• Missing ML frameworks won’t directly prevent connect(), but if your entrypoint waits on models before calling ctx.connect() that could delay/hang and trigger the timeout. If your agent depends on models, preload them in a prewarm or ensure await ctx.connect() runs before long loads.
6) Retry/connect settings
• The error shows it retries (1/3). If you want longer time to establish the peer connection in code, ensure your job logic calls await ctx.connect() promptly and doesn’t block the event loop during setup.
• Avoid long synchronous/blocking initialization before calling connect().
If you want, I can help further with either:
• Reviewing the relevant portion of your agent entrypoint (paste the function that handles job start / calls connect).
• Reviewing your LiveKit livekit.yaml (TURN/port/cert settings) — paste the relevant portions (mask secrets).
• Commands to test connectivity from your VM (I can give specific commands to run).
Which would you like to do next — share the entrypoint code that starts the job, or share your LiveKit config / network details so I can point to the next specific change?
Sources: Agents Framework | livekit/livekit_composite | DeepWiki | Job lifecycle | LiveKit Documentation | Firewall Tips for LiveKit Connectivity | LiveKit | server-sdk-js | livekit/livekit_composite | DeepWiki | Agents (Node.js) | livekit/livekit_composite | DeepWikirhythmic-librarian-54602
02/20/2026, 9:44 AMtall-airline-16756
02/20/2026, 9:45 AMawait ctx.connect() promptly in the job entrypoint, or it’s delayed/blocking by model loads or heavy sync work.
• The agent calls connect() but WebRTC negotiation fails (ICE/DTLS/TURN) and the connection times out/disconnects.
• The agent’s join token is invalid or expires immediately.
• The agent process is exiting or the job task is being shut down after connect (e.g., an exception after connect).
• TLS or certificate issues that affect the agent but not the browser demo (different client implementations/sensitivity).
To diagnose quickly, please provide one or more of the following (pick whichever is easiest to share):
• The agent entrypoint function (the code that receives the job and calls connect()), especially around where ctx.connect() is called.
• The LiveKit server livekit.yaml lines for TURN and TLS (mask secrets).
• The agent logs around the moment of connect/disconnect (from just before connect through the disconnect). You’ve shared earlier logs — a contiguous snippet that includes the connect attempt, any errors/exceptions, and the disconnect lines will help.
• Confirm whether the agent uses the same server URL, token generation method, and certificate trust chain as the browser demo.
Immediate checks you can run now 1) Confirm connect is called early
• Verify await ctx.connect(...) runs before any blocking model loads or long sync setup. If model loading runs first, call await ctx.connect() before heavy initialization.
2) Watch for exceptions after connect
• After your agent calls connect(), is there any exception or call to process exiting or shutting down job task? If so, paste those log lines — they indicate why the job ended.
3) Token validity
• Ensure the join token used by the agent is valid and not expiring immediately. If you create a short-lived token, try a token with a longer TTL to rule out immediate expiry.
4) Compare ICE/TURN behavior vs demo
• Since the Meet demo works, confirm the demo and the agent use the same signaling URL and that the agent environment can reach the TURN server (if used). From the agent host, test TCP 443 and UDP connectivity to your TURN host.
5) Confirm TLS trust
• If the agent runtime rejects a self-signed cert while the browser was allowed/trusted, the agent will disconnect. Confirm the agent environment trusts the certificate used by your LiveKit host.
If you’re ready to share one thing now, paste your agent entrypoint function (the job start code) with any surrounding try/except and the connect call. I’ll look for: missing/late ctx.connect(), blocking calls before connect, or exceptions after connect that cause the worker to shut down.
If you’d rather run commands first, tell me which you prefer and I’ll give the exact commands to test connectivity and token checks.