sandboxes

Create a sandbox

Changed on

Create a new sandbox from a snapshot. Provide at most one of snapshot_id or snapshot_name; if neither is provided, the server uses the default snapshot. snapshot_name accepts a Docker-style name or name:tag reference (a bare name resolves to name:latest).

post/api/v2/sandboxes/boxes

Request

  • Base URL
    https://api.smith.langchain.com
  • URL
    https://api.smith.langchain.com/api/v2/sandboxes/boxes
  • Auth
    • API key in header X-API-Key
    • or API key in header X-Tenant-Id
    • or HTTP bearer
    • or X-Service-Key (a scheme the document does not define)

Request body

cpu_millicoresinteger

CPUMillicores optionally requests CPU at millicore granularity (e.g. 500 = 0.5 vCPU); takes precedence over VCPUs. Fractional (sub-vCPU) values are not available for every sandbox.

delete_after_stop_secondsinteger
env_varsobject
fs_capacity_bytesinteger
idle_ttl_secondsinteger
labelsSandboxesLabels
mem_bytesinteger

Memory for the sandbox, in bytes. Memory is tied to CPU at 4 GiB per vCPU: omit it and it follows that ratio; set it and it must stay within 50% of the ratio for the requested CPU, so a 1 vCPU sandbox accepts 2-6 GiB. Setting memory without CPU derives the CPU from the same ratio. Maximum 64 GiB.

mount_configSandboxesSandboxMountConfig (unresolved $ref)
namestring
persistentboolean

Persistent (private beta) keeps the sandbox's filesystem across stops (the default, true). Set it to false for a disposable sandbox: its writes are discarded whenever it stops, the next start boots it fresh from its snapshot, and it is never charged for storage. A sandbox that is not persistent cannot preserve memory on stop or have its filesystem captured as a snapshot (exporting a Docker image from it with docker_image still works), and some snapshots captured from other sandboxes cannot start one; such a create is rejected. Setting it to false requires the private beta to be enabled for your workspace.

preserve_memory_on_stopboolean

PreserveMemoryOnStop, when true, suspends the sandbox's memory on a voluntary stop (idle timeout or explicit stop) so the next start resumes from where it left off. Default false discards memory and keeps only the filesystem, so the next start is a cold boot. Restarts triggered by infrastructure maintenance always preserve memory regardless of this setting.

restore_memoryboolean

RestoreMemory selects how the sandbox handles a snapshot's captured memory:

nil → if-present: resume from memory when the snapshot has it, else cold-boot (default). true → always: resume from memory; rejected if the snapshot has none. false → never: always cold-boot.

Applies to this request only.

snapshotstring

Snapshot is a Docker-style name or name:tag reference to boot from. A bare name resolves to name:latest.

snapshot_idstring
snapshot_namestring

SnapshotName is a synonym for Snapshot, accepted for compatibility with clients that predate it. Set one or the other.

tag_value_idsstring[]
vcpusinteger

Response

Created

cpu_millicoresinteger
created_atstring
created_bystring
dataplane_urlstring
delete_after_stop_secondsinteger
fs_capacity_bytesinteger
idstring
idle_ttl_secondsinteger
labelsSandboxesLabels
mem_bytesinteger
mount_configSandboxesSandboxMountConfig (unresolved $ref)
namestring
persistentboolean

Persistent (private beta) reports whether the sandbox keeps its filesystem across stops. When false, its writes are discarded whenever it stops and it is not charged for storage.

preserve_memory_on_stopboolean
size_classstring
snapshot_idstring
statusstring
status_messagestring
stopped_atstring
updated_atstring
updated_bystring
vcpusinteger

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property ///

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property to the response with the status

    • info

      endpoint added