How does Agent deployments works for develop and p...
# ask-ai
v
How does Agent deployments works for develop and production release with my app
t
Thanks for reaching out, Justin. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about how Agent deployments work for development vs production releases for your app. High-level summary • The same agent code can be used for both development and production; differences come from the runtime mode, environment variables, and deployment method. • Development focuses on fast iteration and local testing; production focuses on reliability, scaling, and observability. Development workflows (fast iteration) • Run locally in console mode to test logic and get immediate feedback (Python agents can run in
console
mode). • Use
dev
mode to connect your agent to LiveKit Cloud so it’s reachable from anywhere — useful for testing with real clients or the Agents Playground. • Alternatively run a local LiveKit server for full local control; the agent code doesn’t need changes when you later deploy to production. • Keep secrets and keys (OpenAI, Deepgram, LiveKit credentials) in local env vars or a local secrets file while developing. Production workflows (scale, reliability, observability) • Use the production runtime mode (for Python agents the typical command is `uv run agent.py start`; Node agents need build + start, e.g.,
pnpm build
then
pnpm start
). • Use
lk agent create
to generate deployment artifacts (for example
Dockerfile
and
livekit.toml
) and to deploy to LiveKit Cloud. • LiveKit Cloud runs agents in containers across global data centers, handling provisioning, load balancing, metrics, and rollbacks. • Production uses environment variables injected at deploy time for required secrets (
OPENAI_API_KEY
,
LIVEKIT_API_KEY
,
LIVEKIT_URL
, etc.). Use separate LiveKit projects for staging and production to isolate traffic. Scaling and updates • Agent instances scale elastically: when capacity approaches limits, new instances are started to serve sessions. • Updates are zero-downtime: existing sessions are drained gracefully while new sessions are routed to updated instances. • Rollbacks can be performed quickly if you need to revert a release. CI/CD and release automation • Integrate with GitHub Actions (LiveKit provides a deploy action) to automate deployments on branch pushes. • Use separate branches/environments (development, staging, production) and repository secrets to manage different LiveKit projects and env vars. • Typical flow: push to
main
or
production
branch -> CI builds the agent, injects secrets for the target environment -> deploys to LiveKit Cloud. Configuration and metadata • Manage agent metadata and routing using
livekit.toml
in your project root (subdomain, agent id, etc.). • Keep environment-specific configuration out of source control (use CI secrets, environment variables, or your secrets manager). Observability • Use agent insights and the LiveKit dashboard to monitor session analytics, latency, uptime, resource usage, and metrics like TTFT/TTFB and turn latency. • Ensure logging and metrics are enabled for production agents so you can debug and measure performance. If you’d like, I can help with one of the following next steps: • Walk you through a specific local dev run (console vs dev) for Python or Node agents. • Create a checklist for promoting an agent from staging to production (build, env vars, deploy, smoke tests). • Help set up a GitHub Actions workflow example for automated deploys. Which of these would be most useful right now? Sources: Voice AI quickstart | LiveKit Documentation | An open source stack for real-time multimodal AI | Building the all-in-one platform for voice AI agents | Deploy and scale agents on LiveKit Cloud | Self-hosted deployments | LiveKit Documentation
v
Should I have two separate agents for dev and prod so I can verify behavior
t
Great question — I’m responding to your question about whether you should run two separate agents for dev and prod so you can verify behavior. Short answer • You don’t strictly need two different agent codebases. However, you should isolate development and production environments so you can safely verify behavior before release. That isolation can be achieved either by separate agent instances (recommended) or by using the same agent code with different environment configurations. Options and tradeoffs • Separate agents (recommended) ◦ Run one agent connected to your staging/dev LiveKit project and a second agent in the production LiveKit project. ◦ Pros: full isolation of traffic, environment variables, and secrets; easier to test changes without risking production; separate observability and metrics. ◦ Cons: slightly more operational overhead (two deployments) but minimal if you automate CI/CD. • Single codebase, separate deployments (common pattern) ◦ Use the same agent source but deploy it twice (dev and prod) with different env vars,
livekit.toml
settings, and subdomains. ◦ Pros: no duplicate code, easy parity between environments; CI/CD can promote the same build through staging → prod. ◦ Cons: you must be careful to keep config/secrets separate so dev traffic never touches prod. • Single instance toggled by config (not recommended for production verification) ◦ Use runtime flags or environment settings to switch behavior. ◦ Pros: simplest to run locally. ◦ Cons: higher risk of accidental cross-talk with production, harder to simulate production scale and routing. Recommended setup 1. Keep one codebase for agents. 2. Deploy two instances (or containerized services): one to a dev/staging LiveKit project, one to production LiveKit project. 3. Use environment variables and separate LiveKit projects to isolate secrets and traffic. 4. Use CI/CD to build once and deploy the same artifact to both environments (promote the artifact from staging to production). 5. Run smoke tests and monitoring on staging that mirror production checks before promoting. If you want, I can: • Provide a short GitHub Actions example to deploy the same build to staging and production. • Suggest a checklist for staging verification (smoke tests, metrics to watch). Which would help you most?