Skip to main content
By default, a workflow’s repository agent runs its commands in a sandbox that Anthropic hosts. With the agent runtime, they run in your own Kubernetes cluster instead. Files, processes and network access stay in your network, and you decide what the sandbox can reach. Running workflows in your environment is an enterprise feature, set up with CostGraph. Contact your account team to enable it.
A self-hosted installation runs this through its own relay. Follow Run workflows in your cluster to set it up, without contacting your account team. Sandboxes then reach your relay hostname instead of agent-relay.costgraph.ai.

What runs where

The agent’s conversation still reaches Anthropic wherever its commands run: the inputs it sends to a command and the output it reads back are part of that conversation. Running in your environment keeps the command itself, its files and its network access local, not the conversation.

How a sandbox works

Each code change runs as its own Kubernetes Job in the runtime’s namespace. You own the pod it runs in. Its image, user, service account, resources, node placement and network policy all come from a pod template you control. CostGraph sets only the command that connects the agent and checks out the repository.
  • Network: egress is open by default. To restrict it, add a NetworkPolicy for pods labelled costgraph.ai/owner: dispatcher. The sandbox must still reach DNS, and agent-relay.costgraph.ai and github.com on port 443.
  • Cloud access: give the template a service account bound to a role, such as an EKS Pod Identity association, and the AWS CLI in your sandbox image uses that role.
  • Lifetime: a sandbox exists for one code change. A change that runs longer than dispatcher.sandbox.ttlSeconds is stopped, and a finished Job is removed after ten minutes.

Requirements

  • Kubernetes 1.29 or later.
  • Permission to create Jobs and Secrets in the runtime’s namespace, which the chart grants to its dispatcher.

Install

The runtime ships as the costgraph-agent-runtime Helm chart from https://charts.costgraph.ai. Install it in a namespace of its own.
  1. Create a CostGraph API key with the deployment:register and sandbox:worker scopes. The first lets your cluster pull the dispatcher image, the second lets the dispatcher take code changes.
  2. Store the key in the runtime’s namespace twice: as the dispatcher’s key, and as a pull secret for registry.costgraph.ai:
  3. Install the chart with a name for this cluster:
    workerName names this cluster in CostGraph: lowercase letters, digits and hyphens, up to 63 characters.
After the dispatcher connects, the cluster is available in a goal’s Run code changes in setting. See Choose where a goal runs. To disconnect the cluster, revoke the API key. The dispatcher stops taking code changes straight away.

Choose where a goal runs

Each goal has a Sandbox setting, where its agent runs commands and makes code changes. Anthropic is the default. You can also pick any sandbox in your workspace: a registered cluster or a managed sandbox dispatcher. When a goal names a sandbox, the workflow agent runs there too, with a shell for reading and diagnosing. It can run commands that only exist in your network, such as kubectl against a private cluster, the AWS CLI under the sandbox’s own role, internal APIs, and your scripts. Changes still go through approvals, and every command shows on the run. The sandbox’s identity and network set what those commands can do. When a goal only needs to look, give the sandbox a read-only role, such as an EKS Pod Identity role with ReadOnlyAccess or read-only Kubernetes RBAC. If the goal’s sandbox is offline, the run fails at the start. It never moves to Anthropic.

Let AutoPilot choose the provider

The Sandbox setting also lists AutoPilot options. With one of them, each code change runs on a sandbox provider you connected on Integrations. AutoPilot for sandboxes chooses the provider for each run. When a provider fails to start the sandbox, or the sandbox is not ready within the readiness limit, the run tries the next connected provider. The AutoPilot options are unavailable while AutoPilot for sandboxes is off, or when no connected sandbox provider can run code changes. A run whose AutoPilot option is unavailable fails at the start.

Customize the sandbox

Every code change runs from dispatcher.sandbox.template, a Kubernetes pod template. The default runs registry.costgraph.ai/costgraph-sandbox-worker, an Ubuntu 24.04 image with git, Python with pip and uv, Node.js 22 with npm, Go and common build tools. It runs as root, so the agent can install more with apt, pip or npm while it works. Override the template to change anything about the pod. This one runs a team image under a service account with cloud access, on dedicated nodes:
Helm merges your template into the default: lists such as containers and volumes replace the default’s, and other fields you leave out keep their default. Set a field to null to drop it, for example automountServiceAccountToken: null. The dispatcher sets the first container’s command and adds its own environment variables; your fields and environment variables are kept.

Build your own image

An image can start from ours and add what your repositories need:
To build on another base, copy the agent and the two scripts out of our image with COPY --from:
ant is a static binary, so it runs on any Linux base. Pin the same version tag for every file you copy. An image built any other way must keep the following, or code changes fail to start: The sandbox pulls its image with the dispatcher’s imagePullSecrets unless your template sets its own. To build from our image, sign in to the registry first with the same API key: docker login registry.costgraph.ai -u x.