Skip to main content
A workflow’s repository agent can run its commands in sandboxes from a managed sandbox provider you already pay for, instead of a Kubernetes cluster. Each code change gets a fresh sandbox in your provider account, and the sandbox is deleted when the change ends. This uses the same dispatcher as running workflows in your environment. Only where each sandbox runs changes.

Supported providers

Set provider to the value in the following table, and give the dispatcher that provider’s credential variables. CostGraph tests each provider live; contact your account team before relying on one in production. Cloudflare and Google Cloud Run need a sandbox gateway that you deploy in your account first. Their URL variable points at that gateway. Microsandbox sandboxes start from the buildpack-deps:bookworm-scm image unless providerTemplate names another image. Set MSB_API_URL only when your team runs its own Microsandbox control plane. Give the dispatcher its own provider key, limited to creating and deleting sandboxes. Keep it separate from any key you connect to CostGraph for cost data.

Before you begin

  • A CostGraph API key with the deployment:register and sandbox:worker scopes. The first pulls the dispatcher image from registry.costgraph.ai, the second lets the dispatcher take code changes.
  • Credentials for one provider account, listed in the preceding table.
  • Somewhere to run one container that can reach agent-relay.costgraph.ai and your provider’s API over port 443.

Connect

Store the provider credentials in a Secret whose keys are the variable names, then install the chart with your provider:
Create costgraph-sandbox-key and costgraph-registry as described in Install. With a managed sandbox provider the dispatcher needs no permissions in the cluster.
WORKER_NAME names this dispatcher in CostGraph: lowercase letters, digits and hyphens, up to 63 characters. After it connects, it is available in a goal’s Sandbox setting. See Choose where a goal runs.

Sandbox image

By default each sandbox starts from the provider’s default image, and the dispatcher installs the agent into it before the code change starts. The image must have curl, sha256sum, base64 and git, and either run as root or allow sudo. The install adds a few seconds to every code change. To skip the install and add your own tools, build a template in your provider. It must already contain the agent and our two scripts. Then name it:
Build the template from our worker image, registry.costgraph.ai/costgraph-sandbox-worker, with your provider’s own template tooling. The requirements are the same as for your own sandbox image.

Network

Each provider controls egress in its own settings. The sandbox must reach agent-relay.costgraph.ai and github.com on port 443. Everything else is your choice.

Lifetime and cost

A code change that runs longer than dispatcher.sandbox.ttlSeconds (two hours by default) is stopped, and the provider removes its sandbox. Sandbox time is billed by your provider to your account. If the dispatcher stops while a code change is running, that sandbox keeps running until the change ends or the timeout removes it.