A sandbox’s memory and CPU can be resized at runtime. The platform’s recommended path is Autoscaling — opt the sandbox in once and we resize it for you based on observed memory pressure. Lower-level controls are also available if you want to drive sizing yourself or freeze it. CPU scales proportionally to memory in all modes (1 vCPU per ~4 GB up to 16 GB / 4 vCPU). The permissible memory tiers are:Documentation Index
Fetch the complete documentation index at: https://docs.opencomputer.dev/llms.txt
Use this file to discover all available pages before exploring further.
| Memory | vCPU |
|---|---|
| 1 GB | 1 (best-effort) |
| 4 GB | 1 |
| 8 GB | 2 |
| 16 GB | 4 |
Autoscaling
Opt a sandbox into the per-sandbox autoscaler and the platform resizes it for you based on observed memory pressure. Autoscale is opt-in per sandbox and disabled by default. This is the recommended way to size a sandbox: turn it on once with bounds you’re comfortable with, then leave it. Manualscale and the in-VM API are escape hatches for cases where the autoscaler isn’t a good fit (e.g. you want a hard guarantee for a benchmark, or you’re scripting your own logic).
Enable
minMemoryMB and maxMemoryMB must be values from the tier table above. The autoscaler keeps the sandbox between these bounds, in tier steps.
Behavior
- Scale up: when the sandbox’s 1-minute average memory utilization exceeds 75 %, jump to the next tier. 60-second cooldown between up-events.
- Scale down: when all of the 1-min, 5-min, and 15-min utilization averages stay below 25 %, drop one tier. 5-minute cooldown between down-events. Down requires at least 15 minutes of low-utilization data, so a brief idle pause won’t shrink you.
- Manual override: any explicit
scalecall disables autoscale on that sandbox. Re-enable explicitly viasetAutoscale({ enabled: true, ... })(or the equivalent in any SDK) if you want it back.
Disable
Inspect
Manual Scaling (Control Plane)
When you want to resize once — predictable size for a benchmark, a one-off scale-up before a known-heavy task, an operator response to an alert — callscale from your application or operator tooling:
- 403
scaling_locked— the sandbox is locked. See Locking Resources. - 409
oom_floor— the requested size would force a guest OOM-kill because the current working set exceeds it. Free memory inside the guest, then retry. - 402 Payment Required — the requested size exceeds your plan cap.
In-VM Scaling
Sandboxes expose an internal metadata API athttp://169.254.169.254 that lets code inside the VM scale itself. Useful for workload-aware scripts where the workload knows its own demand better than the platform autoscaler can infer (e.g. “scale up before this build, back down after”).
This endpoint is only reachable from inside the sandbox. It is not exposed through the control plane API or SDKs.
Scale Memory
Send aPOST to /v1/scale with the desired memory in MB. CPU is adjusted proportionally.
Check Current Limits
Example: Rust Compilation
Rust builds are memory-hungry. You can aliascargo to scale up before compilation and scale back down after:
~/.bashrc or inject it via sandbox.exec.run so every cargo build, cargo test, etc. automatically gets the extra resources.
Example: Custom Scaling Loop
A simple shell script that monitors memory pressure and scales automatically. Useful when you want fine-grained control inside the sandbox itself; for the platform-managed equivalent see Autoscaling above.Locking Resources
If you want a sandbox to stay at a fixed size — predictable billing, a benchmark, a long-running pinned workload — lock it. Locking blocks both manual scaling and autoscaling on the sandbox.scalereturns 403scaling_lockedsetAutoscale({ enabled: true })returns 403scaling_locked- The autoscaler skips the sandbox