Skip to main content
A sandbox inherits its vCPU count and memory from its template or snapshot. When the template is built with a range, you can instead choose a size for each sandbox when you create it: one template can then serve a small sandbox for a quick script and a large one for a build, without building a template per size. Sandboxes created from a snapshot can choose a size too; see Snapshot copies. Requires SDK 0.14.0+ (@superserve/sdk and superserve), CLI 2.5.0+ and MCP 0.6.0+ (@superserve/mcp).

Build a template with a range

The range comes from the template. Set vcpuMax above vcpu for a CPU range, and memoryMaxMib above memoryMib for a memory range. See Growing CPU and Growing memory for the rules.

Choose a size

Pass vcpu and memoryMib / memory_mib with fromTemplate / from_template. You can pass either one or both.
With the MCP server, pass vcpu and memory_mib to sandbox_create.
  • vcpu is a whole number of vCPUs from the template’s vcpu to its vcpuMax, both included.
  • memoryMib is a size in MiB from the template’s memoryMib to its memoryMaxMib, both included, in 2 MiB steps from the minimum. For a 2048–8192 MiB template, 6144 works and 6145 doesn’t.
  • Both must also be within your plan’s limits, or the request fails with a 402. See Resource limits.

Fixed and growable

A size you choose is fixed for the life of the sandbox, including after pause and resume. The dimension you don’t choose keeps the template’s range, so it can still grow under load with live CPU resizing or live memory resizing. In the example above both are chosen, so the sandbox has a fixed 3 vCPU and 6144 MiB. Its info shows no ceiling for a fixed dimension:
Had you passed only vcpu: 3, memory would still range from 2048 to 8192 MiB.

Snapshot copies

A sandbox created from a snapshot keeps the size of the sandbox it was taken from, including any range it could grow in. You can also pass vcpu and memoryMib / memory_mib with fromSnapshot / from_snapshot, either or both:
  • vcpu works when the original sandbox came from a template with a CPU range. The snapshot records that range, and the copy can take any count in it, above or below the original’s. For a snapshot of a 2 vCPU sandbox from a 1–4 vCPU template, 1, 3 and 4 all work.
  • memoryMib works when the original sandbox was created with a chosen memory size. The copy can take any size in the snapshot’s memory range, in 2 MiB steps from the minimum.
The chosen size is fixed for the copy’s life, as above. A snapshot of a copy records the same range, so a copy of a copy can choose again within it.

Errors

Choosing a size applies to sandboxes placed on GCP. For an AWS placement (placement.cloud set to aws in POST /sandboxes), omit vcpu and memoryMib.

Billing

A sandbox with a fixed size is billed for that size while it’s active. A dimension left growable is billed as described in live CPU resizing and live memory resizing.