> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openhands.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox Specs

> Define the sandbox images, resources, and idle timeouts users and automations can choose from, and control which organizations can use each one.

A Sandbox Spec is a named, reusable sandbox definition: a container image, CPU, memory, and storage
requests and limits, an idle timeout, and how many warm instances to keep ready. A Super Admin
creates Sandbox Specs on `Super Admin Dashboard > Sandbox Spec`, chooses whether each one is public
or restricted to specific organizations, and can set an organization's default. Members then choose a
Sandbox Spec in an [Agent Profile](https://docs.openhands.dev/enterprise/agent-profiles.md) or through the API, and automations use
whichever spec the Agent Profile they launch with resolves to.

This page covers the Super Admin workflow. For the Kubernetes and image-registry setup a Sandbox
Spec's image depends on, see [Custom Sandbox Images](https://docs.openhands.dev/enterprise/custom-sandbox-images).

## Open Sandbox Specs

Choose `Sandbox Spec` from the Super Admin navigation. On older OpenHands Enterprise versions this
page is named `Warm Runtimes`. The table lists every Sandbox Spec with its
image, CPU and memory, idle timeout, [Org Permissions](#grant-access-with-org-permissions), and
source.

A spec's `Source` is `ConfigMap` or `Database`:

* **ConfigMap** specs come from your installation's configuration, the same warm runtime
  configurations described in [Custom Sandbox Images](https://docs.openhands.dev/enterprise/custom-sandbox-images). You can
  edit one here, which saves a database entry that takes precedence over it. You can't delete a
  ConfigMap spec from this page; remove it from the installation's configuration instead.
* **Database** specs are created and fully managed from this page.

> [!NOTE]
>
> Unless your runtime-api has `WARM_RUNTIME_CONFIG_OVERLAY` enabled, saving any Sandbox Spec here
> replaces every ConfigMap-defined spec. See
> [Enable Overlay Mode](https://docs.openhands.dev/enterprise/custom-sandbox-images/multiple-images-warm-pools.md#enable-overlay-mode-helm-installs-only).

## Create a Sandbox Spec

1. On `Sandbox Spec`, select `Add sandbox spec`.
2. Enter a `Name`. Use letters, numbers, dots, dashes, and underscores (up to 63 characters). You
   can't change the name later.
3. Enter the `Image`, such as `ghcr.io/your-org/openhands-php:8.4-v1`. See
   [Building a Custom Image](https://docs.openhands.dev/enterprise/custom-sandbox-images/building-custom-images.md) if you need
   to build one first. If the image is in a private registry, list its `Image pull secrets` (one
   Kubernetes secret name per line).
4. Optionally set the `Working directory`, `Command`, `Arguments`, and `Environment variables`
   (`KEY=value`, one per line). Leave `Command` empty to use the image's entrypoint.
5. Set [Resources](#set-resources), [timeouts and storage](#set-idle-timeout-warm-instances-and-storage),
   and the [security context](#security-context) as needed.
6. Select `Create sandbox spec`.

Saving opens the new spec's own page and [tests](#test-a-spec) it automatically. Changes apply to new
sandboxes only, and can take about a minute to appear in the sandbox spec picker.

### Set Resources

Under `Resources`, set the `CPU request`/`limit`, `Memory request`/`limit`, and `Ephemeral storage
request`/`limit`. Use Kubernetes quantities, such as `500m` or `2` for CPU and `2Gi` or `4Gi` for
memory and storage. Leave a field empty to use the runtime-api default. Two specs can share the same
image and still differ only in these resource settings, for example a smaller default next to a
larger "Monorepo" spec.

### Set Idle Timeout, Warm Instances, and Storage

Under `Timeouts and storage`:

* **Idle timeout (seconds)**: how long a sandbox from this spec can sit idle before it is paused or
  stopped. Leave it empty to use the runtime-api default.
* **Warm instances**: how many sandboxes of this spec to keep ready (the warm pool `count`). With
  `0`, a sandbox cold-starts when selected. See
  [How Sandbox Pools Work](https://docs.openhands.dev/enterprise/custom-sandbox-images#how-sandbox-pools-work).
* **Workspace volume size**: the persistent storage size for new workspaces, such as `10Gi`. This
  applies to new workspaces only; existing workspaces aren't resized.
* **S3-backed workspace**: store the workspace in S3 instead of a volume. The image must include
  `fusey`.

### Security Context

Under `Security context`, optionally set `Run as user`, `Run as group`, and `Filesystem group` as
whole numbers, matching the image's expected UID and GID.

## Test a Spec

On a saved spec's page, select `Test` to start a sandbox from it. OpenHands runs this automatically
right after you create a spec. The result shows:

| Result | Meaning |
| - | - |
| Starting | A sandbox is starting from this spec. |
| Passed | A sandbox started from this spec. |
| Image not found | Check the image name and tag. |
| Permission denied | The registry refused access to the image. The image may be private, or it may not exist. Check `Image pull secrets`. |
| Invalid resources | No node has room for the CPU, memory, or storage this spec requests. |
| Timeout | The sandbox didn't start within 2 minutes. A large image may still be downloading. |
| Unknown | The sandbox failed to start for another reason. |

`Test` is disabled while you have unsaved changes on the form; save first.

## Grant Access with Org Permissions

Every Sandbox Spec is **public** by default: every organization can use it. To restrict a spec to
specific organizations:

1. On `Sandbox Spec`, open the row menu for the spec and select `Org Permissions`.
2. Turn on `Private`.
3. Under `Allowed organizations`, select `Add organization` and choose each organization that should
   be able to use this spec. The picker lists team organizations only. Personal workspaces can't be
   granted a private spec.
4. Select `Save Changes`.

A private spec with no allowed organizations can't be used by anyone, including as an organization or
system default. Changes take effect immediately, and a sandbox already running on the spec keeps
running:

* **Removing an organization** from a private spec revokes its access. Its members no longer see or
  can select the spec.
* **Turning `Private` off** makes the spec available to every organization in the installation and
  clears its organization grants.

## Set an Organization Default

Once a Super Admin sets `ENABLE_SANDBOX_SELECTOR=true` for the deployment (see
[Environment Variables](https://docs.openhands.dev/enterprise/environment-variables.md#runtime-api)), an Admin or Owner can set
their organization's default Sandbox Spec:

1. Open `Settings > Organization`.
2. Under `Default sandbox`, choose a spec. The dropdown lists only the specs your organization can
   access: public specs, plus any private specs granted to your organization.
3. The change saves immediately.

New conversations and automations in the organization use this sandbox, unless an explicit API request
or an [Agent Profile](https://docs.openhands.dev/enterprise/agent-profiles.md)'s own `Sandbox spec` applies first. See the
resolution order below. Clear the dropdown to go back to the deployment default. Setting an
organization default to a spec the organization can't access fails.

## How Users and Automations Select a Sandbox

A new conversation that starts a new sandbox uses the first of these that applies:

1. A spec selected explicitly for the conversation, such as a `sandbox_spec_id` passed to the API.
   Not finding it is a hard error, not a fallback.
2. The `Sandbox spec` of the [Agent Profile](https://docs.openhands.dev/enterprise/agent-profiles.md) the conversation runs with.
3. The organization's default, set above.
4. The deployment's system default.

A conversation that joins a sandbox that is already running uses that sandbox's spec.

An automation uses the `Sandbox spec` of its selected Agent Profile. If that profile has no spec, the
automation uses the organization default, then the deployment default. If the automation has no
Agent Profile selected, its sandbox uses the spec of the owner's active Agent Profile, then the
organization default, then the deployment default. If the selected profile's spec is unavailable,
the run fails before creating a sandbox.

A direct `POST /api/v1/sandboxes` call uses the `sandbox_spec_id` you pass. If you leave it out, it
uses your active Agent Profile's spec, then the organization default, then the deployment default.

A member or automation can only resolve to a spec their organization can access; an explicit request
for a spec outside that access fails instead of silently falling back to another one.

* **In an Agent Profile**: each profile has its own `Sandbox spec` field, next to its other settings
  on `Settings > Agent Profiles`. Leave it on `Deployment default` to use the resolution order above;
  a profile never inherits a spec from another profile. This is the main way a member controls which
  Sandbox Spec their conversations and automations use.
* **Through the API**: pass `sandbox_spec_id` when creating a sandbox or app-conversation. See
  [Per-Conversation via the API](https://docs.openhands.dev/enterprise/custom-sandbox-images/using-custom-images.md#per-conversation-via-the-api).

> [!NOTE]
>
> OpenHands Enterprise previously let each member save a personal default Sandbox Spec in
> Application Settings, which ranked above the Agent Profile's own spec. That setting is removed: an
> Agent Profile's sandbox spec is no longer overridden by a personal preference.

## Let Org Admins Manage Their Own Specs (Beta)

A Super Admin can let organizations manage a limited set of their own Sandbox Specs, instead of
relying only on specs a Super Admin creates and grants:

1. Save at least one Sandbox Spec on `Sandbox Spec`, if you haven't already. Editing and saving a
   ConfigMap spec counts. Until a Super Admin saves one, an Org Admin who tries to add a spec sees
   `A Super Admin must save a sandbox spec before organizations can add their own.` This prevents
   an Org Admin's spec from being the first saved spec, which replaces every ConfigMap spec for
   every organization unless overlay mode is on. See the note under
   [Open Sandbox Specs](#open-sandbox-specs).
2. On `Super Admin Dashboard > Instance Settings`, turn on `Enable Sandbox Specs for Org Admins
   (beta)`.
3. Optionally set `Limits for Org Admins`: a maximum number of specs per organization, maximum warm
   instances per spec, maximum CPU, maximum memory, and a maximum idle timeout. An empty field means
   no limit. Saving a value above a limit fails, naming the field, the value, and the maximum. These
   limits don't apply to Super Admins.

With the feature on, Admins and Owners create and manage their organization's own specs from
`Settings > Sandbox Specs`. A spec an organization creates is private to it and owned by it. No other
organization can see, launch, or change it, and it doesn't count against another organization's
limit. Org Admins can set the image, working directory, command, arguments, environment variables,
CPU, memory, idle timeout, and warm instance count, within any limits you set. They can't set
ephemeral or persistent storage size, image pull secrets, the security context, or an S3-backed
workspace. Those remain Super Admin-only, set from `Sandbox Spec`.

## Permissions

| Action | Member | Admin or Owner | Super Admin |
| - | :-: | :-: | :-: |
| Select an accessible Sandbox Spec through an Agent Profile | Yes | Yes | Yes |
| Set the organization's default Sandbox Spec | No | Yes (with `ENABLE_SANDBOX_SELECTOR`) | Yes |
| Create, edit, delete, test, or grant access to Sandbox Specs | No | No | Yes |
| Manage the organization's own specs (Beta, if enabled) | No | Yes | Yes |

## Related Pages

* [Custom Sandbox Images](https://docs.openhands.dev/enterprise/custom-sandbox-images)
* [Conversations and Sandboxes](https://docs.openhands.dev/enterprise/conversations-and-sandboxes.md)
* [Personal and Organization Agent Profiles](https://docs.openhands.dev/enterprise/agent-profiles.md)
* [Super Admin Dashboard](https://docs.openhands.dev/enterprise/super-admin.md)
* [Environment Variables](https://docs.openhands.dev/enterprise/environment-variables.md#runtime-api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.