Skip to Content

Cloud Run

Create the service accounts and the key that let Sandcovery run Cloud Run sandboxes in your own Google Cloud project.

Sandcovery runs each sandbox as its own Cloud Run instance in your Google Cloud project, through a service account key you add as the credential. The instance runs the official Node.js 26 slim image, pinned by digest and pulled from Google's Docker Hub mirror, with Sandcovery's agent, which starts one Cloud Run sandbox and runs every command, file read, file write, and listing inside it. The agent answers only requests that carry the instance's own random token, and the sandbox cannot read that token, the instance's environment, or its service account's credentials.

What runs

OptionSupport
Size1x2, 2x4, 4x8, and 8x16
Egressallow_all or deny_all
LifetimeUntil the sandbox's TTL
Pause and resumeNo
RegionThe region you add with the credential

Snapshots, port previews, custom images, environment variables set at create, idle timeouts, disk sizes, and GPUs are not available on this provider. A create that asks for an egress allowlist or any other size routes to another provider.

Enable Cloud Run

In a Google Cloud project with billing, enable the Cloud Run Admin API:

gcloud services enable run.googleapis.com --project=<project>

Create the service accounts and the key

Create a service account for the sandboxes to run as, with no role, and a service account for Sandcovery that may create, read, and delete Cloud Run instances and run them as the first one. Then create a JSON key for Sandcovery's service account:

gcloud iam service-accounts create sandcovery-sandbox --project=<project> \
  --display-name="Sandcovery sandboxes"
gcloud iam roles create sandcoveryCloudRunUser --project=<project> \
  --title="Sandcovery Cloud Run User" \
  --permissions=run.instances.create,run.instances.delete,run.instances.get,run.instances.setIamPolicy,run.operations.get
gcloud iam service-accounts create sandcovery --project=<project> \
  --display-name="Sandcovery"
gcloud projects add-iam-policy-binding <project> \
  --member="serviceAccount:sandcovery@<project>.iam.gserviceaccount.com" \
  --role="projects/<project>/roles/sandcoveryCloudRunUser"
gcloud iam service-accounts add-iam-policy-binding \
  sandcovery-sandbox@<project>.iam.gserviceaccount.com --project=<project> \
  --member="serviceAccount:sandcovery@<project>.iam.gserviceaccount.com" \
  --role="roles/iam.serviceAccountUser"
gcloud iam service-accounts keys create sandcovery-key.json \
  --iam-account=sandcovery@<project>.iam.gserviceaccount.com

If your organization blocks service account key creation, override that policy on this project as Google Agent Platform Code Execution shows.

Add the credential

In Provider Credentials in the dashboard, add these three fields for Cloud Run:

  • Service account JSON key: the whole contents of sandcovery-key.json
  • Region: a region that runs Cloud Run instances, such as us-west1, which excludes us-central1, us-east1, and europe-west1
  • Sandbox service account email: sandcovery-sandbox@<project>.iam.gserviceaccount.com

Sandcovery signs a token request with the key at Google's token endpoint and sends Cloud Run only the one-hour access token Google returns. Deleting the key in Google Cloud revokes it, and an access token it already bought expires within the hour.

Costs

Google bills the vCPU and memory each instance holds to your Google Cloud billing account, from its create until Sandcovery deletes it. Sandcovery's estimates and spend limits count them at Cloud Run's list price for instances.