This message was deleted.
# ask-ai
s
This message was deleted.
t
Thanks for reaching out, Talha. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! When you self-host LiveKit, there’s no limit on usage minutes. You’re running the LiveKit server on your own infrastructure, so there aren’t any usage-based billing meters like participant minutes or bandwidth. You’ll be in charge of managing and scaling your resources, and the costs will depend on what your setup uses—things like compute, bandwidth, and storage. On the other hand, LiveKit’s hosted service (LiveKit Cloud) does work on a usage-based pricing model. For example, the free tier gives you 5,000 WebRTC participant minutes, and after that, usage is billed incrementally. The hosted service is fully managed, globally distributed, and comes with handy features like analytics, telemetry, and a 99.99% uptime SLA. Since you’re using
livekit-server --dev
, it looks like you’re self-hosting. If you’re running into any limits, it might be something related to your specific setup or configuration. I’m here to help—just let me know if you’d like to troubleshoot it together! Sources: LiveKit Pricing | LiveKit Cloud | LiveKit Docs | Quotas and limits | LiveKit Docs | Billing | LiveKit Docs
a
I actually got it wrong, i am running using python assistant.py dev. Is this not self hosting?
t
Running
python assistant.py dev
starts the LiveKit agent in development mode, which is perfect for testing and development. Whether this setup uses LiveKit Cloud or self-hosting really depends on the environment variables in your
.env
file: • If
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
point to a LiveKit Cloud project, then you’re using LiveKit Cloud. • If these variables point to a locally or privately hosted LiveKit server (like `ws://localhost:7880`), then it’s self-hosted. Most example projects default to LiveKit Cloud unless you’ve set them up specifically for self-hosting. If you’d like, I’m here to help you check or update your configuration—just let me know! Sources: livekit-agents/livekit/agents/cli/cli.py | Docs::Home | README.md | Running LiveKit locally | LiveKit Docs | Voice AI quickstart | LiveKit Docs
a
Yep, the variables point to Livekit's URLs and not local variables
t
It looks like your environment variables are currently set to LiveKit's URLs, which means you're using LiveKit Cloud rather than a self-hosted setup. With this, your usage falls under LiveKit Cloud's limits and billing, including the 5,000 free WebRTC participant minutes offered in the free tier. If you'd like to avoid these limits, you have the option to switch to self-hosting by running the LiveKit server on your own infrastructure and updating your environment variables to point to your self-hosted server (for example, `ws://localhost:7880`). I'm here to help! Just let me know if you'd like some guidance on setting up a self-hosted LiveKit server or if you have any other questions. We're happy to support you every step of the way!
a
So I need to host livekit agent and server separately. When the server will receive a request, it will auto initiate the agent and connect it to the call?
t
In a self-hosted setup, the LiveKit server doesn’t start agents automatically. Instead, agents run as background worker processes that register with the server. Here’s a friendly overview of how it all comes together: 1. Worker Registration: When you start your agent (for example,
python assistant.py start
), it connects with the LiveKit server and waits patiently for dispatch requests. 2. Agent Dispatch: Whenever a new room is created, the server lets the registered workers know. In automatic dispatch mode, these workers happily accept the jobs and launch an agent instance to join the room. 3. Dispatch Modes: You have the option to use automatic dispatch (which is the default) or explicit dispatch, giving you more control through the API. If you’d like, I’m here to help guide you through setting up this workflow or configuring your self-hosted environment—just let me know! Sources: Agent dispatch | LiveKit Docs | Dispatching agents | LiveKit Docs | README.md | LiveKit Pricing | Deploying to custom environments | LiveKit Docs
a
So I need to host both of them separately?
t
I'm happy to help clarify this for you! You'll want to host both the LiveKit server and the agent processes separately. The LiveKit server is responsible for the core signaling, media routing, and room management, while the agent processes work as helpers that register with the server and handle dispatch requests. For a self-hosted setup, here’s a simple way to think about it: • Deploy the LiveKit server on your infrastructure—this could be a cloud VM, Kubernetes, or even a local server. • Run the agent processes separately, making sure they’re set up to connect to your LiveKit server using the right environment variables like
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
. If you’d like, I’m here to walk you through the deployment or help with any configuration questions you have!
It looks like you’ve done a great job setting up your self-hosted LiveKit environment! Here’s a quick recap of what you’ve accomplished: 1. You’ve configured the LiveKit server to run on port 7880 with Redis handling the backend storage, and you’ve set up your API keys for authentication. 2. You’ve started the LiveKit server using
livekit-server --config config-sample.yaml
, and from the logs, it seems to be running smoothly. 3. You’ve connected the agent to your self-hosted LiveKit server with the right API key, secret, and URL (`wss://localhost:7880`). Everything looks well in place! If you run into any hiccups or have questions, please don’t hesitate to reach out—I’m here to help!
I'm sorry you're encountering the error
AssertionError: worker process is not responding.. worker crashed?
. This usually happens when the agent has trouble initializing or connecting to the LiveKit server. Let’s walk through some common causes and easy steps to help you resolve this: 1. Invalid Credentials: Please double-check that your
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and
LIVEKIT_URL
are correctly set and match what’s configured on your server. 2. WebSocket Connection Issue: Make sure your LiveKit server is up and running, and accessible at
wss://localhost:7880
. It’s also helpful to peek at the server logs to see if it’s receiving connection attempts. 3. Health Check Server Failure: The agent uses a health check server (default port 8081). Please confirm that this port is free and not blocked by any firewalls or other applications. 4. Agent Code Crash: If the agent crashes while starting, try enabling debug logging in the agent. This can help identify if any dependencies or environment variables are missing. For a deeper look, you can turn on verbose logging by setting
LK_LOG_LEVEL=debug
. Then, check both the agent and server logs for more detailed error messages. If you’d like, I’m here to help you through any of these steps—just let me know! Sources: README.md | livekit-agents/livekit/agents/job.py | Deploying to custom environments | LiveKit Docs
a
I can connect to HTTP on this port (curl -i http://localhost:7880) this returns HTTP/1.1 200 OK Vary: Origin Date: Mon, 15 Sep 2025 151209 GMT Content-Length: 2 Content-Type: text/plain; charset=utf-8 but when I try connecting it to socket wscat -c ws://localhost:7880 error: Unexpected server response: 200
wscat
expected a WebSocket handshake response (101 Switching Protocols), but instead your server replied with HTTP 200 OK.
t
It looks like the issue is happening because the LiveKit server's WebSocket endpoint isn’t accessible at
ws://localhost:7880
. While the HTTP 200 response shows the server is responding to HTTP requests, WebSocket connections actually need a specific endpoint to work properly. For LiveKit, the WebSocket connections should be made to
ws://localhost:7880/rtc
. Could you please try connecting using this command:
Copy code
wscat -c ws://localhost:7880/rtc
If it still doesn’t connect, no worries! Just take a look at the LiveKit server logs for any error messages and double-check that the server is set up to accept WebSocket connections on that correct endpoint. I’m here to help you through this!
It looks like the error
401: no permissions to access the room
is happening because the WebSocket connection doesn’t have the right authentication credentials. The LiveKit server needs a valid access token to let you in. Here’s how we can fix this together: 1. Create a valid access token using your API key and secret. Make sure the token includes the permissions needed, like joining a room. 2. Include that token in your WebSocket connection URL or headers. For example, add it as a query parameter like this:
ws://localhost:7880/rtc?access_token=YOUR_TOKEN
. 3. Double-check that the token is properly signed and contains all the necessary details, such as the room name, participant identity, and permissions. If you’d like, I’m here to help you generate the token or set up the connection—just let me know!
To make sure everything works smoothly, please update the
LIVEKIT_URL
in your environment variables to the correct WebSocket endpoint for your LiveKit server. Since your WebSocket endpoint is
ws://localhost:7880/rtc
, you’ll want to set your
LIVEKIT_URL
like this:
Copy code
LIVEKIT_URL=ws://localhost:7880/rtc
Once you’ve made this update, just restart your agent by running
python assistant.py start
. If you run into any other questions or need a hand, please don’t hesitate to reach out—I’m here to help!
Just to help you out, the
LIVEKIT_URL
should be set to the WebSocket URL of your LiveKit server. Since you’re running your server locally, the value you want to use is:
Copy code
LIVEKIT_URL=ws://localhost:7880/rtc
Make sure this matches the WebSocket endpoint of your LiveKit server. If you’re still running into issues, it might be helpful to peek at the server logs to see if there are any errors or connection attempts from the agent. Feel free to reach out if you need a hand with anything else—I’m here to help! Sources: README.md | Accepting incoming calls | LiveKit Docs | Agents Playground | LiveKit Docs
a
I am already using this
t
Since the
LIVEKIT_URL
is correctly set, it seems the issue might be related to the agent's runtime environment or configuration. To help you better, could you please share a bit more information about: • The version of the LiveKit agent framework you’re using (Python or Node.js). • Any additional logs or error messages you’ve noticed around the time the assertion error happens. • Your deployment environment (for example, are you running this on a local machine, Docker, or a cloud server?). With these details, we’ll be in a great position to pinpoint the root cause and find the best solution for you. Looking forward to your reply! Sources: README.md | livekit-plugins/livekit-plugins-hedra/livekit/plugins/hedra/avatar.py
It looks like the error
AssertionError: self._close_future is not None
happens when the worker tries to shut down before it’s fully ready. This usually means the worker’s
run()
method, which sets up
self._close_future
, didn’t finish properly or got interrupted, causing the assertion in
aclose()
to fail. Here are some steps that might help you resolve this: 1. Take a look at the logs to make sure the
run()
method finishes without errors. Check for any issues during the worker’s startup. 2. Double-check that the LiveKit server is reachable and the WebSocket connection is working smoothly. 3. Make sure the worker isn’t being closed or restarted too soon, before it has fully initialized. 4. Try enabling debug logging in the agent to get more detailed insights into the startup process. If you’re still running into problems after these steps, please don’t hesitate to reach out. I’m here to help you dig deeper and get this sorted out! Sources: Worker lifecycle | LiveKit Docs | livekit-agents/livekit/agents/voice/avatar/_runner.py
a
(venv) root@0076-kci-prxmx10118:/var/www/bot-crm-dev# python lk_server.py dev worker process is not responding.. worker crashed? Process SpawnProcess-1: Traceback (most recent call last): File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap self.run() File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/var/www/bot-crm-dev/venv/lib/python3.10/site-packages/livekit/agents/cli/_run.py", line 101, in run_worker loop.run_until_complete(worker.aclose()) File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/var/www/bot-crm-dev/venv/lib/python3.10/site-packages/livekit/agents/worker.py", line 578, in aclose assert self._close_future is not None AssertionError
t
It looks like the error is happening because the
self._close_future
attribute isn’t being set up before the shutdown process starts. This usually means the worker's
run()
method is running into trouble during startup. Let’s walk through some steps to help you troubleshoot and hopefully resolve this: 1. Check for Startup Errors: Take a look at the logs to see if there are any errors when the worker is initializing. Also, double-check that all the necessary environment variables (like
LIVEKIT_URL
,
LIVEKIT_API_KEY
, and
LIVEKIT_API_SECRET
) are properly set. 2. Verify Server Accessibility: Make sure the LiveKit server is up and running, and that it’s reachable at the
LIVEKIT_URL
you’ve specified. You can use tools like
wscat
to test the WebSocket connection. 3. Enable Debug Logging: Try setting the log level to debug (for example,
LK_LOG_LEVEL=debug
) so you can get more detailed info about what’s happening during the worker’s startup. 4. Handle Exceptions in `run()`: Check that the
run()
method isn’t stopping early because of unhandled exceptions. Adding some logging or exception handling here can really help pinpoint the root cause. If you’re still running into issues after these steps, please don’t hesitate to reach out. I’m here to help you dig deeper and get this sorted out!