Skip to content

Configure

Sandboxes

Build and verify remote Function images for Python, Shell, and imported JavaScript

Configure a remote provider and a dedicated Function base image to run Python, Shell, JavaScript imports, or custom workspace sandboxes. Plain JavaScript can run in a local isolated-vm Node worker inside the app container.

The remote provider is E2B, Daytona, or your own Kubernetes cluster. E2B and Daytona need an account and an image you build there. The Kubernetes provider runs sandboxes as pods next to Sim, from images Sim publishes and each Sim version names exactly.

Choose the execution path

Code or block settingRuntime requirement
JavaScript without import or require, no selected sandbox or sandbox file-path referenceLocal worker; no remote provider required
Python, Shell, JavaScript importsRemote provider credentials and immutable Function image
Selected workspace sandboxRemote provider, Function base, and sandbox access
File path from another block or sandbox output pathRemote sandbox filesystem

Selecting a sandbox without a configured provider is refused with 503. File-path cases that cannot use the sandbox filesystem are refused with 422. Failing user code can also return 422; inspect the error message to distinguish the cause. A saved Python block is never silently executed as JavaScript.

Build and verify the Function base

Run these repository scripts from a checkout with dependencies installed (bun install at the repository root). Supply provider credentials to the build environment. Custom workspace sandboxes layer their packages on this base.

The Kubernetes provider skips this section: Sim publishes its Function image, and each Sim version names the exact one it runs. See Kubernetes (no third party).

Code
E2B_API_KEY=... \
  bun run apps/sim/scripts/build-function-e2b-template.ts \
  --name sim-function

The builder uses E2B's maintained code-interpreter-v1 base and assigns a release generation. It prints the immutable template/build reference and generation. --generation supports release automation; --base-template accepts an immutable base override.

Set the exact values printed by that build, then verify and capture its package/runtime manifest:

Code
SANDBOX_PROVIDER=e2b \
E2B_ENABLED=true \
E2B_API_KEY=... \
E2B_FUNCTION_TEMPLATE_ID='<template>:<build-id>' \
E2B_FUNCTION_TEMPLATE_GENERATION='<release-epoch-ms>' \
SANDBOX_PARITY_MANIFEST_OUT=/tmp/function-sandbox-manifest.json \
  bun run apps/sim/scripts/verify-sandbox-parity.ts

Replace the placeholders before running. Setting SANDBOX_PROVIDER=e2b explicitly prevents an exported Daytona selection from changing this verification step.

Configure the deployment

Apply the verified runtime values through the deployment's environment or secret mechanism. For the Kubernetes provider, see Install with Helm instead.

Code
SANDBOX_PROVIDER=e2b
E2B_ENABLED=true
E2B_API_KEY=...
E2B_FUNCTION_TEMPLATE_ID=<template>:<build-id>
E2B_FUNCTION_TEMPLATE_GENERATION=<release-epoch-ms>

Enable sandbox access and controls

VariableEffect
SANDBOXES_ENABLED=trueGrants the server-side sandbox entitlement on a billing-disabled self-hosted deployment

On a billing-disabled deployment, ENTERPRISE_ENABLED=true also grants the entitlement when SANDBOXES_ENABLED is unset. The server must verify provider credentials and the immutable Function base before offering Shell, the Function block's Sandbox selector, and the sandbox list. Settings → Sandboxes remains in the sidebar but shows an upgrade notice until access/readiness resolves. Python remains selectable; execution still requires the remote configuration.

Promote or roll back a build

Use the accepted E2B manifest as the release baseline. Verify the exact E2B build and any Daytona reconstruction before updating the deployment variables above.

Configure other code images

Chat's public run_function and run_code tools use a separate shell image, including plain JavaScript. The workflow-internal function_execute path uses the Function image.

Code
# E2B shell image
MOTHERSHIP_E2B_TEMPLATE_ID=<shell-template-ref>

# Daytona shell image
DAYTONA_SHELL_SNAPSHOT_ID=<shell-snapshot-ref>

These values do not replace E2B_FUNCTION_TEMPLATE_ID or DAYTONA_FUNCTION_SNAPSHOT_ID. Shell, Function, document, and Pi images have separate package contracts and release cadences. Pi also needs E2B_PI_TEMPLATE_ID or DAYTONA_PI_SNAPSHOT_ID. The Pi cloud modes appear when the selected provider is enabled and has its Pi image configured: on Daytona that means DAYTONA_API_KEY and DAYTONA_PI_SNAPSHOT_ID; on E2B, E2B_ENABLED alone still reveals them, but runs fail closed until E2B_PI_TEMPLATE_ID is set.

Kubernetes (no third party)

On a Helm install, Sim can run sandboxes as pods in your own cluster. User code and its files stay on your nodes instead of a third-party service, and there is no per-sandbox charge beyond those nodes.

Quick start

Two values turn it on: sandbox.kubernetes.enabled and the runtimeClass.preset for your platform. Everything else has a safe default. Leave SANDBOX_PROVIDER, the E2B_* and DAYTONA_* variables, and TRIGGER_DEV_ENABLED unset in app.env.

Kubernetes 1.36 or later. Turn on NetworkPolicy enforcement first (Amazon EKS Auto Mode).

Code
sandbox:
  kubernetes:
    enabled: true
    runtimeClass:
      preset: isolated-sandbox

Then verify your install. Without a preset, the chart refuses to render and names the preset for each platform. The sections below cover what the chart creates and every knob past these defaults.

How it works

The app creates one pod per sandbox in a dedicated namespace (sim-sandboxes by default), through the Kubernetes API with its own ServiceAccount.

  • An init container copies Sim's sandbox agent into the pod. The agent then runs as the main process of the sandbox image and listens on port 49983.
  • The app talks to the agent directly at the pod IP, with a bearer token generated per sandbox. The pod carries only the token's hash.
  • A one-off run deletes its pod when it finishes. Chat workbench and Pi sessions keep their pod and reconnect to it from any app replica until the session's lifetime ends.
  • Every pod has a hard 24-hour limit (activeDeadlineSeconds), and the cleanup-session-sandboxes cron job deletes finished or expired pods.

Sandbox images are content-addressed: each Sim version names the exact image tags it runs. They are built and published to GHCR from Sim's staging and main branches when their inputs change, and every release is checked to have its images published and signed. There is nothing to build, unlike E2B and Daytona. The Function, Pi, and agent images have defaults. Chat's code tools and document generation use private images with no default, so those two kinds stay off until you set them (see Images).

Isolation requirement

User code runs as root inside the sandbox, because dependency installs and Pi need it. The pod is therefore only safe under a runtime that gives it its own kernel or a user-space kernel: a microVM or gVisor. Sim refuses to start a sandbox when the configured RuntimeClass is missing, or when its handler is runc, crun, or empty, since those share the node's kernel.

PlatformruntimeClass.presetRuntimeClassWhat the cluster needs
Amazon EKSisolated-sandboxisolated-sandbox (Nitro Sandboxes, a Firecracker microVM per pod)Kubernetes 1.36 or later. EKS Auto Mode provisions compatible nodes with no extra setup; managed node groups need a custom AMI with the Nitro Sandbox runtime and Nitro Enclaves enabled. Nodes must be a supported instance type; flex instances are not.
Google GKEgvisorgvisor (GKE Sandbox)On Standard, a node pool created with --sandbox type=gvisor. It cannot be the default node pool, and gVisor nodes use the Container-Optimized OS image. GKE Sandbox is enabled by default on Autopilot.
Azure AKSkatakata-vm-isolation (Pod Sandboxing, a Kata VM per pod)Kubernetes 1.27 or later and a node pool with --workload-runtime KataVmIsolation --os-sku AzureLinux, on a generation 2 VM size that supports nested virtualization. Arm64 node pools are not supported.
Self-managed gVisorgvisor with runtimeClass.create: truegvisor, handler runscgVisor installed as a containerd runtime on the sandbox nodes.
Self-managed Kata or othercustom with runtimeClass.namethe name your installation registersSet runtimeClass.create: true and handler only if the installation did not create the RuntimeClass.

The chart never creates a runc or crun RuntimeClass. For a throwaway cluster or a fully trusted set of workflow authors, sandbox.kubernetes.allowUnisolated: true (SANDBOX_K8S_ALLOW_UNISOLATED=true) lets sandboxes run without an isolating runtime.

Install with Helm

Enable the provider in your values file and choose the preset for your platform:

Code
sandbox:
  kubernetes:
    enabled: true
    runtimeClass:
      preset: isolated-sandbox  # or gvisor, kata, custom
    # Optional: keep sandboxes on a dedicated node pool
    nodeSelector:
      sim.ai/sandbox: "true"
    tolerations:
      - key: sim.ai/sandbox
        operator: Exists
        effect: NoSchedule

Leave SANDBOX_PROVIDER and the E2B_* and DAYTONA_* variables unset in app.env: the chart sets SANDBOX_PROVIDER=kubernetes itself. Leave TRIGGER_DEV_ENABLED unset too. Sandboxes are created by the app, which reaches each pod's agent directly, and Trigger.dev workers cannot; with it set, Sim reports the provider as misconfigured and keeps sandbox features off. On a billing-disabled deployment, also set SANDBOXES_ENABLED=true (Enable sandbox access and controls).

With the provider enabled, the chart renders:

  • The sandbox namespace, labeled pod-security.kubernetes.io/enforce=baseline. It must not be the release namespace. With namespace.create: false, create it yourself and label it pod-security.kubernetes.io/enforce=baseline; the chart then refuses to render with admissionPolicy.enabled: false, because nothing it renders would hold that namespace's pods to the sandbox shape.
  • A Role in the sandbox namespace allowing pods create, get, list, watch, delete, and patch, plus events list (read while a pod starts, to fail fast on a node with no runtime for the RuntimeClass). There is no pods/exec and no access to Secrets. It is bound to the app's ServiceAccount, which then must not be default.
  • A ClusterRole allowing get on the configured RuntimeClass only, so the app can check its handler.
  • A NetworkPolicy that selects every pod in the sandbox namespace (see Network access).
  • A ResourceQuota and LimitRange (see Capacity and cost).
  • A ValidatingAdmissionPolicy and its binding, scoped to the sandbox namespace. It admits only pods shaped like the app's own: under the configured RuntimeClass, with automountServiceAccountToken: false, only emptyDir volumes, no host network, PID, or IPC namespace, and no sysctls; and in every init, regular, and ephemeral container, no privilege or privilege escalation, no capabilities beyond the six listed below, no hostPort, the Default procMount, and the RuntimeDefault seccomp profile (set on the container or the pod; an unset profile runs Unconfined on most clusters, so it is refused). It does not rely on Pod Security, so it holds in a namespace nobody labeled. It needs Kubernetes 1.30 or later. On an older cluster, set sandbox.kubernetes.admissionPolicy.enabled: false (which needs namespace.create: true), or the install fails on the unknown kind.
  • With runtimeClass.create: true, or a runtimeClass.handler named for an existing class, that handler is passed to the app as SANDBOX_K8S_TRUSTED_RUNTIME_HANDLERS, so a VM runtime whose handler Sim does not recognise is accepted. The app still compares it with the RuntimeClass's real handler, and the chart refuses runc and crun.

The app pod mounts its ServiceAccount token only when the provider is enabled; every other chart pod keeps it unmounted. With networkPolicy.enabled: true, the app's own policy also allows egress to the sandbox namespace on port 49983, and to the Kubernetes API on ports 443 and 6443. Narrow that to your API server addresses with sandbox.kubernetes.apiServerEgress.cidrs.

Pod Security is baseline rather than restricted because the agent runs as root and adds the CHOWN, DAC_OVERRIDE, FOWNER, SETUID, SETGID, and KILL capabilities to run user code as an unprivileged user. restricted forbids both. baseline still refuses privileged pods, host namespaces, and hostPath, and the sandbox runtime is the boundary that contains root.

Without the chart, set the same variables on the app and create the equivalent objects yourself. The app reads them from its in-cluster ServiceAccount, or from KUBECONFIG when it runs outside the cluster:

Code
SANDBOX_PROVIDER=kubernetes
SANDBOX_K8S_NAMESPACE=sim-sandboxes
SANDBOX_K8S_RUNTIME_CLASS=isolated-sandbox

Network access

Ingress to sandbox pods is denied except from the Sim app pods to the agent port, TCP 49983. Egress follows sandbox.kubernetes.egress.profile:

ProfileAllows
internet (default)DNS, and any public IPv4 or IPv6 address on any port, as E2B sandboxes have. It excludes RFC 1918 ranges, 100.64.0.0/10, link-local, Azure's WireServer 168.63.129.16 (Azure: IP address 168.63.129.16), IPv6 unique-local and link-local ranges, and the NAT64 prefixes 64:ff9b::/96 (RFC 6052) and 64:ff9b:1::/48 (RFC 8215), which a NAT64 gateway would translate to any IPv4 address. Those cover the cloud metadata endpoints 169.254.169.254 and fd00:ec2::254. Add pod, Service, and node CIDRs outside those ranges to egress.clusterCidrs.
restrictedDNS, plus only the CIDRs in egress.allowedCidrs. Package installs and outbound requests from user code fail unless you allow their destinations.

DNS is TCP and UDP port 53, to egress.dns when it names resolvers. When it is empty, the default depends on the profile:

  • internet allows port 53 to any address. A cluster's resolver is often a node-local address or the DNS Service IP in a private range, which no pod selector matches (EKS Auto Mode and NodeLocal DNSCache both work this way), so this is the setting that works everywhere. It adds only port 53 on private and cluster addresses.
  • restricted allows port 53 only to the kube-system pods labeled k8s-app: kube-dns, so port 53 never reaches an outside server. That matches CoreDNS on EKS managed node groups, GKE, AKS, and k3s. Where the resolver is node-local, DNS then fails until you set egress.dns to an ipBlock for the nameserver in a sandbox pod's /etc/resolv.conf: the .10 address of the Service CIDR on EKS Auto Mode, or 169.254.20.10 with NodeLocal DNSCache.
Code
sandbox:
  kubernetes:
    egress:
      profile: restricted
      dns:
        - namespaceSelector:
            matchLabels:
              kubernetes.io/metadata.name: kube-system
          podSelector:
            matchLabels:
              k8s-app: kube-dns
        # The nameserver in a sandbox pod's /etc/resolv.conf, when it is node-local
        - ipBlock:
            cidr: 169.254.20.10/32

Narrowing the resolvers stops direct DNS to outside servers, not DNS tunneling through your own resolver, which forwards names it cannot answer.

egress.extraRules appends raw NetworkPolicy egress rules in either profile. The sandbox CLI calls Sim back at NEXT_PUBLIC_APP_URL, or at MOTHERSHIP_SANDBOX_CLI_ENDPOINT when set. If that address is private, allow it with extraRules.

What the policies cannot do:

  • The node itself. Traffic between a pod and the node it runs on is always allowed, whatever the policy says (Kubernetes: Network Policies). A sandbox can reach anything listening on its node's addresses, such as the kubelet, node exporters, or a hostNetwork pod. Keep sandboxes on dedicated nodes (nodeSelector and tolerations) so nothing else listens there.
  • IPv6 and dual-stack clusters. Pod and node IPv6 addresses are usually global unicast, which internet allows like any public address. Add your pod, Service, and node IPv6 CIDRs to egress.clusterCidrs, or sandboxes can reach other pods and nodes over IPv6.

Images

Leave sandbox.kubernetes.images.* empty to use the images your Sim version names. global.imageRegistry applies to them as it does to the app images, and the chart passes it to the app as SANDBOX_K8S_IMAGE_REGISTRY. Set a tag or digest to pin an image; an image's own registry and repository apply once it has one, as for the app images.

The agent, Function, and Pi images are public on GHCR, so pulling them needs no credentials. The exact tags your version runs are in apps/sim/lib/execution/remote-sandbox/kubernetes/images.generated.json at its release tag: https://github.com/simstudioai/sim/blob/<release-tag>/apps/sim/lib/execution/remote-sandbox/kubernetes/images.generated.json, for example v0.9.73, the first release that includes them. The chart's images.yaml does not list them, because the app, not the chart, creates sandbox pods. For an air-gapped install, mirror each of those three references under the same path (ghcr.io/simstudioai/sandbox-agent:<tag> to <registry>/simstudioai/sandbox-agent:<tag>), and mirror again on every upgrade: a new Sim version may name new tags.

Each image is signed with Sigstore keyless signing and carries a build-provenance attestation (and an SBOM per architecture), from a staging or main run of the sandbox workflow. Verify one before you mirror or run it:

Code
IMAGE=ghcr.io/simstudioai/sandbox-function:<tag>

cosign verify "$IMAGE" \
  --certificate-identity-regexp '^https://github\.com/simstudioai/sim/\.github/workflows/sandbox\.yml@refs/heads/(main|staging)$' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

gh attestation verify "oci://$IMAGE" --repo simstudioai/sim \
  --signer-workflow simstudioai/sim/.github/workflows/sandbox.yml

To enforce this at admission, give the same identity and issuer to a keyless policy in the Sigstore policy-controller (ClusterImagePolicy) or Kyverno verifyImages, matching ghcr.io/simstudioai/sandbox-* in the sandbox namespace. When you mirror, copy the signatures and attestations with the images (for example cosign copy), or verification against the mirror fails.

KindValues keyVariableDefault
Agent (init container)images.agentSANDBOX_K8S_AGENT_IMAGENamed by your Sim version
Function, Shellimages.functionSANDBOX_K8S_FUNCTION_IMAGENamed by your Sim version
Piimages.piSANDBOX_K8S_PI_IMAGENamed by your Sim version
Chat code toolsimages.mothershipSANDBOX_K8S_MOTHERSHIP_IMAGENone: private image
Document generationimages.docSANDBOX_K8S_DOC_IMAGENone: private image

A kind with no image fails closed with a configuration error. The Chat code-tool and document images are private: create a docker-registry Secret in the sandbox namespace and name it in sandbox.kubernetes.imagePullSecret (SANDBOX_K8S_IMAGE_PULL_SECRET). The chart does not copy Secrets across namespaces.

Capacity and cost

Each sandbox gets the limits in sandbox.kubernetes.resources (1 CPU, 2 GiB memory, and 4 GiB ephemeral storage by default), and requests at half of each. The same values become the sandbox namespace's LimitRange maximum, so no container there can ask for more.

The ResourceQuota caps concurrent sandboxes at quota.pods (20 by default) and their total limits at quota.cpu, quota.memory, and quota.ephemeralStorage. It counts each sandbox's limits, not its requests, so the defaults admit exactly 20 sandboxes on every dimension (20 × 1 CPU, 2 GiB, and 4 GiB). Raising sandbox.kubernetes.resources without raising the matching quota lowers that count: with resources.cpu: "2", the CPU quota stops at 10 sandboxes. Set each quota to quota.pods times the matching resource. A RuntimeClass overhead (VM runtimes have one) counts against the quota too, so add it to each sandbox's share. Session sandboxes (chat workbenches and Pi) hold their share until they expire. A sandbox started past the quota fails at once with a "Sandbox limit reached" error instead of waiting. Size the quota and the sandbox nodes together: nodes that cannot fit the quota leave sandboxes pending until their start times out.

Sim records no sandbox cost for this provider: you pay for the nodes. Set the kubelet's podPidsLimit on sandbox nodes (for example 4096): the memory limit does not bound processes, so a fork bomb in user code otherwise exhausts the node's PIDs for every pod on it (Kubernetes: Process ID limits). Per-platform density:

  • EKS Nitro Sandboxes cap a node in two ways: total sandbox vCPUs, and the number of sandboxes, can each be at most 5 times the node's vCPU count. A 4-vCPU node fits 20 one-vCPU sandboxes. On instance types with two threads per core, sandboxes get roughly half the advertised vCPUs, because two sandboxes never share a core's sibling threads.
  • AKS Pod Sandboxing sizes each pod VM from the pod's limits.
  • GKE Sandbox with gVisor adds a dynamic overhead with a low base memory for its user-space kernel, rather than a fixed per-pod reservation.

Cold start and pre-pull

A sandbox's start time is dominated by the first image pull on its node. sandbox.kubernetes.prePull.enabled: true renders a DaemonSet that keeps the Function image on every node a sandbox can land on, under the same RuntimeClass, node selector, and tolerations. The RuntimeClass is deliberate: it carries the scheduling that places pods on sandbox nodes (GKE Sandbox's, or runtimeClass.scheduling), and the holder then pulls the image the way a sandbox does. It needs images.function.tag or digest, so it holds exactly the image the app runs. Each node then runs one idle pod; under a VM runtime that pod is a small VM, which counts against the node's sandbox density.

On VM runtimes the image is loaded into each pod's VM at start (an EKS Nitro Sandbox runs its own containerd inside the guest), so measure how much pre-pulling helps on your platform before relying on it.

Each sandbox that starts logs one Kubernetes sandbox pod ready line with, in milliseconds from the create request, when each step was reached: the request accepted (acceptedMs), the pod scheduled to a node (scheduledMs), its agent copied in (initializedMs), the container running (runningMs), and the agent answering (agentMs). A sandbox that does not start logs Kubernetes sandbox pod did not start with the steps it reached. Use them to see where your start time goes before tuning anything.

Warm capacity

When no sandbox node has room, a sandbox waits for your node autoscaler to add one, about 2 minutes on EKS Auto Mode, and may run into its 3-minute start deadline. sandbox.kubernetes.warmCapacity.sandboxes: N keeps room for N sandboxes free. The chart runs N placeholder pods in the release namespace at priority -10. Each one has a sandbox pod's requests and limits, and runs under the sandbox RuntimeClass (so its overhead is reserved too) with the same node selector and tolerations. When a sandbox needs the room, the scheduler evicts a placeholder and the sandbox starts on a running node. The evicted placeholder goes pending, and your autoscaler adds the next node in the background. This is the standard cluster-autoscaler overprovisioning pattern, and it works with cluster-autoscaler, Karpenter, EKS Auto Mode, and GKE.

  • You pay for N idle sandbox slots. Under a VM runtime each placeholder is an idle VM, and on GKE Autopilot the placeholders are billed.
  • The placeholders run outside the sandbox namespace, so they never count against quota. The chart refuses more room than quota.pods, which could never be used.
  • Sandbox pods set no priority class, so they run at 0 and preempt the placeholders. A cluster whose default PriorityClass (globalDefault: true) is -10 or lower defeats this.
  • Any pod at default priority can take the room. Give sandboxes dedicated nodes (nodeSelector and tolerations) so the room stays theirs.
  • A placeholder holds room, not the image. The first sandbox on a newly added node still pulls the Function image unless prePull is on, and on VM runtimes the image also loads into each pod's VM at start, so measure the gain on your platform.

Amazon EKS Auto Mode

What Sim's sandboxes need on EKS Auto Mode with Nitro Sandboxes (runtimeClass.preset: isolated-sandbox), beyond the chart:

  • Enable NetworkPolicy enforcement. Auto Mode accepts NetworkPolicies but does not enforce them until you turn on its Network Policy Controller with this ConfigMap (AWS: network policies with EKS Auto Mode):

    Code
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: amazon-vpc-cni
      namespace: kube-system
    data:
      enable-network-policy-controller: "true"

    Then confirm enforcement before running untrusted code, as above.

  • DNS. Auto Mode runs CoreDNS on each node at the .10 address of the cluster's Service CIDR (10.100.0.10 or 172.20.0.10 with EKS's default Service CIDRs) and creates no kube-dns Service or pods. The internet profile's default egress.dns already allows it. Under restricted, the default kube-dns selector matches nothing here, so set egress.dns to an ipBlock for that address, for example - ipBlock: {cidr: 172.20.0.10/32}.

  • Policy at pod start. The VPC CNI programs a new pod's policies while the pod starts, and until they are in place the pod's traffic is allowed: user code that runs in those first seconds may reach what the policy would deny. On the self-managed VPC CNI, strict mode (NETWORK_POLICY_ENFORCING_MODE=strict) starts pods denied instead (AWS: network policy at pod startup). AWS does not document that setting for Auto Mode, so treat the window as present there.

  • Instance metadata. A Nitro Sandbox serves its own IMDSv2-only metadata at 169.254.169.254 from inside the guest, where NetworkPolicy does not apply. It answers only region, Availability Zone, and partition paths; instance ID, user data, and IAM credentials return 404 (AWS: Pod Identity and credentials). EKS Pod Identity's endpoint is also served in the guest; sandbox pods mount no service account token, so it gives them no credentials as long as you do not inject one (for example with a Pod Identity association on the sandbox namespace). AWS lets a pod turn the metadata surrogate off with a Cedar policy generated with eks-nitro-sandbox-genpolicy --deny-imds and attached as the sandbox.amazonaws.com/policy annotation; Sim does not set pod annotations yet, so sandboxes keep the surrogate.

  • Capacity. The scheduler counts each sandbox's requests plus the RuntimeClass overhead (check yours with kubectl get runtimeclass isolated-sandbox -o yaml; it was 256Mi on our test cluster). With resources.memory: 1Gi (a 512Mi request), a c8a.large node (about 2.3 GiB allocatable) fits three sandboxes.

  • Start times. Measured on Kubernetes 1.37 with c8a.large nodes: about 6 seconds from create to first command on a node that already has the image, and about 2 minutes when Auto Mode must launch a node first. Pre-pulling helps less than on gVisor: after a 31-second pull, loading the 840 MB Function image into the microVM took another 53 seconds.

Verify your install

Run the live suite against your cluster from a checkout with dependencies installed (bun install). It starts real sandboxes through the provider, as the app's ServiceAccount, and checks isolation, network policy, and cleanup. It makes no cloud calls; it uses whatever your kubectl context grants and writes a JSON report:

Code
kubectl config use-context <context>
SANDBOX_K8S_RUNTIME_CLASS=gvisor \
SANDBOX_K8S_E2E_REPORT_PATH=/tmp/sandbox-k8s-report.json \
  bun run apps/sim/scripts/test-sandbox-kubernetes-e2e.ts --context <context>

Set SANDBOX_K8S_RUNTIME_CLASS to your RuntimeClass (isolated-sandbox is the default). Run it from inside the cluster network, since it reaches each sandbox at its pod IP, and point SANDBOX_K8S_E2E_DENIED_TARGETS at the app Service and database (host:port,...) so it proves user code cannot reach them. The header of test-sandbox-kubernetes-e2e.ts lists every option. Then run a Function block with Python in a workflow: it runs in a pod in the sandbox namespace (kubectl get pods -n sim-sandboxes -w).

Limitations

  • No pause or resume. The provider cannot pause a sandbox, so an idle Chat workbench or Pi session keeps its pod running, and counting against the quota, until its idle deadline or the 24-hour limit ends it.
  • Process cleanup. Stopping a command kills its process group. A process that starts its own session with setsid escapes that kill, and runs until the sandbox's lifetime ends or its pod is deleted.
  • Managed CLIs are not yet available on this provider.
  • Docker Compose has no Kubernetes API, so this provider is Helm or Kubernetes only. On Compose, use E2B or Daytona.
Was this helpful?
Suggest an edit