CrowNest
Concepts

Sandboxes

How sandbox lifecycle, TTL, templates, metadata, and injected environment context work in CrowNest.

A sandbox is an isolated live execution environment. You create one from a template, run commands and manage files inside it, and it's destroyed when you kill it or its TTL expires. Sandboxes are the unit of isolation, billing, and lifecycle in CrowNest.

Lifecycle and statuses

Every sandbox moves through a fixed set of statuses. The status field on the sandbox object always reflects the current state.

StatusMeaning
creatingCrowNest is provisioning the sandbox.
startingThe environment is booting.
readyThe sandbox is available for work.
runningReady, with a command actively executing.
idleReady, with no active work.
expiringCleanup has begun; new operations are rejected.
destroyedThe sandbox is gone. The record remains queryable.
failedThe sandbox could not start or stopped abnormally.

running and idle are derived from ready: a sandbox is running while it has an active command and idle otherwise.

Destroyed sandboxes carry a destroyedReason:

destroyedReasonMeaning
user_killedYou deleted the sandbox via the API, SDK, or CLI.
ttl_expiredThe sandbox reached its expiresAt time.
idle_expiredThe sandbox was reclaimed after sitting idle.
platform_cleanupCrowNest removed the sandbox during maintenance.

List endpoints return live sandboxes by default. Pass include=historical to also get destroyed and failed records.

TTL

Every sandbox has a time-to-live. You request it as ttlMs (milliseconds) when creating the sandbox, and responses surface the resolved deadline as expiresAt (ISO 8601). The current API default and maximum is 3600000 ms (1 hour) on the common plan; requesting more returns sandbox_ttl_exceeded.

Plan ceilings are configurable beta defaults and may change: Free 30 minutes, Developer 60 minutes, Team 2 hours. Check your plan for the limits that apply to you. There is no TTL extension in the current release.

When a sandbox expires:

  • Running commands move to status killed with killedReason sandbox_destroyed.
  • The filesystem is gone unless you exported files as artifacts first.
  • The sandbox record remains with status destroyed.
  • Billing stops at expiresAt.

[!IMPORTANT] Export anything you need to keep as an artifact before the sandbox expires. The workspace is not preserved.

Templates

A template is the user-facing slug that selects the sandbox environment. Four templates are available:

TemplateContents
baseMinimal Linux environment.
pythonPython runtime.
nodeNode.js runtime.
python-nodeBoth Python and Node.js.

Custom templates aren't available yet. Each template resolves to a TemplateVersion, an immutable resolved environment. The sandbox stores the templateVersionId that was resolved at creation, so the environment never changes underneath a running sandbox. You can also pass a templateVersionId directly when creating a sandbox to pin a specific version.

Metadata

Metadata is a flat string map you set at creation to label sandboxes for correlation, filtering, and display. It's never used for authorization, and you must not store secrets in it.

Limits:

  • Maximum 16 keys.
  • Keys up to 64 characters; values up to 512 characters.
  • Total size up to 4 KB.
  • Allowed characters: a-z A-Z 0-9 _ - . :.

Injected environment context

CrowNest injects a small set of non-secret environment variables into every sandbox so processes can discover their own context:

VariableValue
CROWNEST1
CROWNEST_SANDBOX_IDThe sandbox ID.
CROWNEST_PROJECT_IDThe project ID.
CROWNEST_ORG_IDThe organization ID.
CROWNEST_TEMPLATE_IDThe template ID.
CROWNEST_TEMPLATE_VERSION_IDThe resolved TemplateVersion ID.
CROWNEST_WORKSPACE/workspace

The CROWNEST prefix is reserved: setting any CROWNEST* key in command env is rejected with reserved_env_key. Environment values you pass to commands are ephemeral and never persisted.

Next steps

On this page