Packaging Agent as Docker Image
This page discusses how to package Agent Runner as a Docker image and how to build, run, and publish this image.
Dockerfile
Your agent is stored and run as a Docker container in Vertiesia cloud infrastructure. That's why it's important to understand how to create a Docker image using Dockerfile and how to operate the image. When you initialize the agent with NPM, we will provide you with a default implementation for the Dockerfile. However, you can update it to adjust your needs.
Base Image
Our Agent Runner SDK is built on top of Typescript. Therefore, you are expected to use Node.js as runtime to run your agent. We recommend you use node
as the base image to facilitate the setup of your Docker image since it contains most of the dependencies for running a Node.js application.
FROM node
System Packages
Your AI agent will communicate with Temporal Cloud, a workflow orchestration platform. Temporal Cloud access is secured by the mutual Transport Layer Security (mTLS) protocol, which requires a CA certificate from the agent. This is handled by Agent Runner, which downloads the certificate at runtime. However, you are expected to install system-level packages to support the connection. In the Debian image, you need to install OpenSSL (openssl
) and CA Certificates (ca-certificates
).
RUN apt-get update -y && \
apt-get install -y openssl ca-certificates
For more information, please visit Temporal Cloud’s documentation:
- Certificate management - Temporal Cloud feature guide | Temporal
- Connect to Temporal Cloud - Typescript SDK | Temporal
Build Docker Image
To build the Docker image, you can use either the vertesia
CLI or the docker
CLI. Actually, vertesia
calls docker
under the hook, but it also reads information from your package definition and provides instructions specific to the platform's requirement, so it's more convenient.
vertesia agent build
Run Docker Container
To run the Docker image as a container locally, you can use either the vertesia
CLI or the docker
CLI
vertesia agent run
Once you confirm that your image is working correctly, you can push it to our container registry.
Push Docker Image
To push your Docker image to our container registry, you can use either the vertesia
CLI or the docker
CLI. For example, for pushing the version 1.0.0
:
vertesia agent publish 1.0.0
Note that those commands are not exactly the same. The command vertesia agent publish
command also triggers a new deployment, i.e., a deployment request to Vertesia Cloud so that your image will be deployed to our infrastructure.