gifted-tomato-63690
09/08/2025, 9:28 PMtall-airline-16756
09/08/2025, 9:28 PMtall-airline-16756
09/08/2025, 9:29 PMlk agent deploy command is your friend! You can include it in your CI/CD pipeline to build and deploy your agent straight from your repo. The best part? It uses a rolling deployment strategy, so your users won’t experience any downtime — new instances take over new sessions while the old ones finish up their active sessions before shutting down.
To make this deployment automatic on a GitHub push, just plug lk agent deploy into your GitHub Actions workflow. For example, you can trigger it on pushes to your main branch, authenticate the LiveKit CLI, and then deploy. Here’s a handy example of what that workflow might look like:
name: Deploy LiveKit Agent
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js (if required for your agent)
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install LiveKit CLI
run: npm install -g @livekit/cli
- name: Authenticate with LiveKit Cloud
run: |
echo "$LIVEKIT_API_KEY" | lk cloud auth --api-key --stdin
# Link the correct project if needed
lk project set-default "<your-project-name>"
env:
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
- name: Deploy Agent
run: lk agent deploy
Just make sure your LiveKit CLI is properly authenticated and set up in your CI environment before running the deploy command. You’ll want to save your LiveKit API key and secret as GitHub secrets (LIVEKIT_API_KEY and LIVEKIT_API_SECRET) in your repo’s settings.
If you’d like, I’m here to help you with setting up those secrets or tweaking this workflow for a different kind of agent. Just let me know!
Sources: .gitlab/ci/deploy.yml | Deploying to production | LiveKit Docs | Agent deployment CLI reference | LiveKit Docsgifted-tomato-63690
09/08/2025, 9:30 PMtall-airline-16756
09/08/2025, 9:30 PMLIVEKIT_API_KEY, LIVEKIT_API_SECRET, and LIVEKIT_URL) to the CLI. The usual lk cloud auth command depends on a browser-based login, which doesn’t really work in headless CI setups like GitHub Actions.
So, here’s a friendly tip: set up the LiveKit CLI to use your project credentials directly through environment variables:
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
The LiveKit CLI automatically picks up these environment variables for authentication when you run commands like lk room list or lk token create. Just make sure to save these values as GitHub Secrets in your repo settings so they stay safe and private.
Here’s a simple example of a GitHub Actions workflow step:
- name: List LiveKit rooms
run: lk room list
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
This way, you skip the interactive browser login from lk cloud auth, making your automation smooth and hassle-free. It’s the recommended approach for using the LiveKit CLI in automated environments. If you have any questions or need a hand, just let me know!
Sources: README.md | LiveKit CLI Setup | LiveKit Docs | Accepting incoming calls | LiveKit Docs | Accepting incoming calls | LiveKit Docsgifted-tomato-63690
09/08/2025, 9:32 PMtall-airline-16756
09/08/2025, 9:32 PMexport LIVEKIT_URL=wss://your-project.livekit.cloud
export LIVEKIT_API_KEY=your-api-key
export LIVEKIT_API_SECRET=your-api-secret
These variables are picked up directly by the CLI tools and SDKs, mapping to the --url, --api-key, and --api-secret options. You'll find this approach used in several example repositories and docs, like those for setting up inbound and outbound calls with LiveKit Agents.
If you'd like, I can share some links to specific examples or help clarify anything else—just let me know!
Sources: livekit-agents/livekit/agents/cli/cli.py | rover/cam_publish.sh | web/.env.sample | .env.example | Accepting incoming calls | LiveKit Docs