can I build my own livekit agent image and run tha...
# ask-ai
s
can I build my own livekit agent image and run that using LK agent cloud ?
t
Thanks for reaching out, Sameer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m replying to your question about whether you can build your own LiveKit agent image and run it using LiveKit Cloud Agents. Yes — you can build a custom LiveKit agent image and run it on LiveKit Cloud Agents. LiveKit Cloud Agents is designed to accept your custom agent code: the CLI helps create an agent project, the platform builds the container (using your Dockerfile if you provide one), and deploys it across LiveKit Cloud’s infrastructure. Quick summary of the workflow you can follow: 1. Initialize an agent project (you can start from a template or your own code): ◦
lk agent init my-custom-agent
1. Build and deploy with the CLI — it will containerize and register the agent with your LiveKit Cloud project: ◦
lk agent create
1. Provide a custom
Dockerfile
or use the one the CLI generates if you need specific build steps, dependencies, or runtime configuration. What LiveKit Cloud manages for you: • Provisioning, load balancing, health checks, transparent failover • Logging, versioning, rollbacks, and scaling • Location-aware elastic provisioning One important note: LiveKit Cloud Agents is currently in closed beta. If you want to join the beta program, you can sign up via the LiveKit Cloud Agents beta form. If you’d like, I can: • Walk you through creating an agent project step-by-step, • Review your Dockerfile or
livekit.toml
structure if you paste it here, • Explain how to handle specific dependencies or runtime needs in your custom image. Which of those would be most helpful right now? Sources: Building the all-in-one platform for voice AI agents | Examples | livekit/livekit_composite | DeepWiki | Voice AI quickstart | LiveKit Documentation | Agent deployment overview | LiveKit Documentation
s
can I build the image myself ?
t
You can build the agent image yourself. LiveKit Cloud Agents supports using a custom container image (your Dockerfile and build artifacts) instead of requiring the platform to build it for you. A few practical notes to help you: • Provide a Dockerfile: Include a standard Dockerfile in your agent project that installs your dependencies and sets the correct entrypoint for your agent process. The CLI will generate a Dockerfile if you want a starting point, but you can replace it with your own. • livekit.toml / registration: Your project should still include the agent configuration (for example
livekit.toml
) so the platform can register and deploy the image with your Cloud project. • Building & pushing: You can build and push the image to a container registry you control (e.g., Docker Hub, ECR, GCR). Ensure the registry is accessible to LiveKit Cloud or use the deployment flow that references your registry credentials. • Deploying with the CLI: You can still use
lk agent create
to register and deploy the agent; the platform will accept your custom image or Dockerfile during that process. • What LiveKit Cloud still provides: Once deployed, the Cloud handles provisioning, health checks, load balancing, logging, rollbacks, and scaling for your agent instances. If you want, I can: • Review a Dockerfile you plan to use (paste it here), • Show an example Dockerfile layout for an agent, • Walk through the steps to push an image to a registry and reference it from the LiveKit deployment. Which would you like next?
s
Walk through the steps to push an image to a registry and reference it from the LiveKit deployment.
show me the command to reference a image
t
Thanks — I’m replying to your request for the exact command to reference a custom agent image and how to push it to a registry for use with LiveKit. Short answer • To push an image to a registry: ◦ docker build -t your-registry/your-agent-image:tag . ◦ docker push your-registry/your-agent-image:tag • To run that image so it registers with a LiveKit server (self-hosted agent), run: ◦ docker run -e LIVEKIT_URL=<your-livekit-url> -e LIVEKIT_API_KEY=<your-key> -e LIVEKIT_API_SECRET=<your-secret> your-registry/your-agent-image:tag Important limitation • LiveKit Cloud’s agent creation flow builds the image for you from source; you cannot make the Cloud use an arbitrary external image during
lk agent create
. If you want to use a pre-built image you control, run the agent on your own infrastructure (Docker, Kubernetes, VMs) so the agent process can connect to LiveKit. See Self-hosted deployments: https://docs.livekit.io/agents/ops/deployment/custom/ Step-by-step examples 1) Build and push (example using Docker Hub or other registry)
Copy code
# Build
docker build -t <http://docker.io/your-username/my-agent:1.0|docker.io/your-username/my-agent:1.0> .

# Push
docker push <http://docker.io/your-username/my-agent:1.0|docker.io/your-username/my-agent:1.0>
Replace
<http://docker.io/your-username/my-agent:1.0|docker.io/your-username/my-agent:1.0>
with your registry and tag (ECR, GCR, etc. are similar). 2) Run the agent container (registers with LiveKit)
Copy code
docker run \
  -e LIVEKIT_URL="<wss://your-livekit.example>" \
  -e LIVEKIT_API_KEY="your-key" \
  -e LIVEKIT_API_SECRET="your-secret" \
  <http://docker.io/your-username/my-agent:1.0|docker.io/your-username/my-agent:1.0>
Make sure your image starts the AgentServer process as the container entrypoint and uses those env vars to connect. 3) Kubernetes deployment (example snippet)
Copy code
apiVersion: apps/v1
kind: Deployment
metadata:
  name: livekit-agent
spec:
  replicas: 2
  selector:
    matchLabels:
      app: livekit-agent
  template:
    metadata:
      labels:
        app: livekit-agent
    spec:
      containers:
      - name: agent
        image: <http://docker.io/your-username/my-agent:1.0|docker.io/your-username/my-agent:1.0>
        env:
        - name: LIVEKIT_URL
          value: "<wss://your-livekit.example>"
        - name: LIVEKIT_API_KEY
          value: "your-key"
        - name: LIVEKIT_API_SECRET
          value: "your-secret"
If you want, I can: • Review your Dockerfile to confirm the agent entrypoint and env var handling. • Show commands for authenticating and pushing to a specific registry (ECR, GCR, ACR). • Help convert your run example into a Helm/Kustomize snippet. Which of those would you like next? Sources: Self-hosted deployments | LiveKit Documentation
🤦 1