{"message": "starting worker", "level": "INFO", "n...
# ask-ai
s
{"message": "starting worker", "level": "INFO", "name": "livekit.agents", "version": "1.2.17", "rtc-version": "1.0.17", "timestamp": "2025-11-01T152501.232527+00:00"} {"message": "preloading plugins", "level": "INFO", "name": "livekit.agents", "packages": ["livekit.plugins.deepgram", "livekit.plugins.openai", "livekit.plugins.elevenlabs", "livekit.plugins.silero", "av"], "timestamp": "2025-11-01T152501.232666+00:00"} {"message": "worker failed", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/cli/_run.py\", line 79, in _worker_run\n await worker.run()\n File \"/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/worker.py\", line 454, in run\n await self._http_server.start()\n File \"/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/utils/http_server.py\", line 27, in start\n self._server = await self._loop.create_server(handler, self._host, self._port)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/root/.local/share/uv/python/cpython-3.13.9-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py\", line 1630, in create_server\n raise OSError(err.errno, msg) from None\nOSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 8081): [errno 98] address already in use", "timestamp": "2025-11-01T152501.235586+00:00"} {"message": "draining worker", "level": "INFO", "name": "livekit.agents", "id": "unregistered", "timeout": 1800, "timestamp": "2025-11-01T152501.237208+00:00"} {"message": "shutting down worker", "level": "INFO", "name": "livekit.agents", "id": "unregistered", "timestamp": "2025-11-01T152501.237373+00:00"} Traceback (most recent call last): File "/root/agents/agent2.py", line 453, in <module> cli.run_app( ~~~~~~~~~~~^ WorkerOptions( ^^^^^^^^^^^^^^ ...<4 lines>... ) ^ ) ^ File "/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/cli/cli.py", line 246, in run_app cli() ~~~^^ File "/root/agents/.venv/lib/python3.13/site-packages/click/core.py", line 1462, in call return self.main(*args, **kwargs) ~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/root/agents/.venv/lib/python3.13/site-packages/click/core.py", line 1383, in main rv = self.invoke(ctx) File "/root/agents/.venv/lib/python3.13/site-packages/click/core.py", line 1850, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/root/agents/.venv/lib/python3.13/site-packages/click/core.py", line 1246, in invoke return ctx.invoke(self.callback, **ctx.params) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/agents/.venv/lib/python3.13/site-packages/click/core.py", line 814, in invoke return callback(*args, **kwargs) File "/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/cli/cli.py", line 73, in start _run.run_worker(args) ~~~~~~~~~~~~~~~^^^^^^ File "/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/cli/_run.py", line 101, in run_worker loop.run_until_complete(worker.aclose()) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ File "/root/.local/share/uv/python/cpython-3.13.9-linux-x86_64-gnu/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "/root/agents/.venv/lib/python3.13/site-packages/livekit/agents/worker.py", line 624, in aclose assert self._close_future is not None ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AssertionError
t
Thanks for reaching out, ABHIRAM. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like you're encountering the error "OSError: [Errno 98] Address already in use," which happens when the HTTP server in the LiveKit worker tries to bind to a port that’s already taken by another process. Don’t worry, I’m here to help you work through this! Here are some friendly steps you can follow to get things running smoothly: 1. Ensure Unique Port Binding: If you’re running multiple workers on the same machine, make sure each one has its own unique port by setting the
port
option in
WorkerOptions
. This keeps everything nicely organized. 2. Kill Conflicting Processes: Sometimes, another process might be using that port. On Linux or macOS, you can find it with
lsof -i :8081
or
netstat -tulpn | grep 8081
, and then stop it using
kill <pid>
. This frees up the port for your worker. 3. Use Dynamic Port Assignment: For development purposes, setting the port to
0
lets your operating system pick an available port automatically, which can save you some hassle. 4. Graceful Shutdown: Make sure your workers shut down properly by calling
worker.close()
in your shutdown routine. This helps release the port cleanly so it’s ready to use next time. 5. Check for Duplicate Workers: Double-check that you’re not accidentally starting multiple workers on the same port at the same time — that’s a common cause of this error. 6. Container Environments: If you’re using Docker or Kubernetes, ensure each worker has its own unique or dynamically assigned HTTP port to avoid conflicts. I hope these tips help you resolve the issue! If you run into any trouble or have more questions, please don’t hesitate to reach out — I’m happy to assist you further. Sources: Deploying to custom environments | LiveKit Docs | livekit-agents/livekit/agents/worker.py | agents/src/http_server.ts
s
ok then i cannot run multiple agents ?
t
It's great that you're looking to run multiple agents! Just a quick heads-up: each agent needs to have its own unique port for its HTTP server to keep everything running smoothly without any conflicts. You can easily manage this by setting a different
port
value in the
WorkerOptions
for each agent. If you're working with containerized setups like Docker or Kubernetes, there's some handy flexibility—you can assign ports dynamically or let orchestration tools handle the port assignments for you automatically. Feel free to reach out if you'd like a hand with setting this up—I’m here to help!