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. Connect the provider on Integrations, and CostGraph starts the sandboxes for you. You don’t run anything yourself. If you self-host CostGraph, need sandboxes on a private network, or want to keep the provider key out of CostGraph, run your own dispatcher instead.

Supported providers

Supported sandbox providers lists every provider with its workflow and CI runner support. Each provider’s page lists the fields to enter, the key to create, and the permissions that key needs. Use a provider key limited to creating and deleting sandboxes. Keep it separate from any key you connect to CostGraph for cost data.

Connect

  1. In CostGraph, go to Integrations > Sandbox, and select your provider.
  2. Enter the provider’s key and any other required fields. The provider’s page lists them.
  3. Click Connect.
CostGraph then starts sandboxes in your provider account for workflows and AutoPilot CI jobs. To change the key, connect the provider again with the new key. If the provider refuses the key when CostGraph starts a sandbox, the connection shows <Provider> refused CostGraph's key; reconnect it on Integrations. Connect it again with a key that works.

Run your own dispatcher

The dispatcher is the container that holds your provider key and starts the sandboxes. It’s the same dispatcher as in running workflows in your environment. Only where each sandbox runs changes. In a self-hosted installation, first set up the relay in Run workflows in your cluster.

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 account listed in Supported providers.
  • Somewhere to run one container that can reach agent-relay.costgraph.ai and your provider’s API over port 443.

Install

Each provider’s page names its provider value and the variables to set in the dispatcher’s environment.
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 in your own dispatcher:
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 two hours is stopped, and the provider removes its sandbox. On your own dispatcher, dispatcher.sandbox.ttlSeconds sets this timeout. Sandbox time is billed by your provider to your account. If your own dispatcher stops while a code change is running, that sandbox keeps running until the change ends or the timeout removes it. Arker, Sail and Uno sandboxes have no lifetime, so the timeout cannot remove them. Delete any that a stopped dispatcher leaves behind.