I have my production deployed, but then how do I r...
# ask-ai
c
I have my production deployed, but then how do I run my agent locally without serving production traffic? Does the room server automatically know not to route production requests to my local machine?
t
Thanks for reaching out, Nathan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help you run your agent locally without affecting your production traffic, it’s best to use separate environments for development and production. Here’s a simple way to approach it: • If you’re using LiveKit Cloud, try creating separate projects for each environment since each one has its own unique credentials. • If you’re working with a self-hosted LiveKit, consider setting up a separate deployment for staging or production, and use a local server specifically for development. When you run your agent locally, just make sure it connects to your development environment by setting environment variables like these:
Copy code
LIVEKIT_URL=ws://localhost:7880
LIVEKIT_API_KEY=your-dev-api-key
LIVEKIT_API_SECRET=your-dev-api-secret
This way, your agents in development mode will only handle jobs from your development server, keeping everything nicely separated from production traffic. If you have any questions or need more details, I’m here to help! Sources: README.md | Deploying to custom environments | LiveKit Docs | Running LiveKit locally | LiveKit Docs | README.md | README.md
c
oh so the only thing that needs to change is the LIVEKIT_URL?
t
Absolutely! The main update you'll want to make is changing the
LIVEKIT_URL
to your development server address (like
ws://localhost:7880
if you're testing locally). Also, it's important to use the right API key and secret for your development setup to keep everything nicely separated from your production environment. If you'd like, I'm here to help you get this set up smoothly—just let me know!
c
but will my worker process connect to the hosted livekit room server, and will begin to serve production traffic from other people?
t
Hi there! Just to reassure you, your worker process won’t connect to the hosted LiveKit room server or handle any production traffic as long as you set it up to use your development environment. By configuring the
LIVEKIT_URL
to point to your development server (like `ws://localhost:7880`) and using the matching development API key and secret, your worker will only take care of jobs from that development server. This way, everything stays nicely separated from your production traffic. If you have any more questions or need a hand with anything else, please don’t hesitate to reach out—I’m here to help!
c
so how do I run the room server locally
t
I'd be happy to help you get the LiveKit room server running locally! Just follow these simple steps: 1. First, download the latest LiveKit server release from the GitHub releases page. 2. Next, start the server in development mode by running this command:
Copy code
livekit-server --dev
This will use the default API key and secret for you:
Copy code
API Key: devkey
API Secret: secret
By default, the server listens on
127.0.0.1:7880
. If you'd like to access it from other devices on your network, just add the
--bind 0.0.0.0
flag. If you have any questions or need a hand with testing or setting things up further, please don’t hesitate to reach out. I’m here to help! Sources: Running LiveKit locally | LiveKit Docs | README.md
c
how will the livekit-server cli tool know what my API key and API secret are
t
When you run the LiveKit server in development mode using
livekit-server --dev
, it kindly defaults to using the standard API key and secret for you:
Copy code
API Key: devkey
API Secret: secret
If you'd prefer to use your own custom API keys and secrets, no worries at all! You can easily set them up in a configuration file or by using environment variables. Just let me know if you'd like a hand with setting that up—I’m here to help!
c
I need to set that up
t
Setting up custom API keys and secrets for your LiveKit server is pretty straightforward, and using environment variables is the best way to go. Here’s how you can do it:
Copy code
LIVEKIT_API_KEY=your_api_key_here
LIVEKIT_API_SECRET=your_api_secret_here
LIVEKIT_URL=wss://your-livekit-url
Make sure to keep these variables safe by storing them securely in your environment or in a
.env
file if you're working locally. If you’re using LiveKit Cloud, you can easily generate API keys right from the project settings. For self-hosted servers, just follow the server documentation to create your keys. If you run into any questions or want me to walk you through any part of this, just let me know—I’m here to help! Sources: complex-agents/role-playing/role_playing_frontend/.env.example | Mini tutorial: setting up a LiveKit Cloud project | frontend/.env.example | livekit-api/livekit/api/livekit_api.py | examples/nextjs/.env.example