You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sandboxes/templates.mdx
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,39 @@ When you pass an `image` to `Sandbox.create()`, the server:
90
90
2. If cached, creates the sandbox from the existing checkpoint instantly
91
91
3. If not cached, boots a build sandbox, executes each step, checkpoints the result, then creates your sandbox from it
92
92
93
+
### Build memory
94
+
95
+
Images build in a **4 GB** sandbox by default. If a build runs out of memory (heavy `apt`/`pip`/`npm`, compiling a large toolchain), raise the build-phase RAM with **`.builderMemory(mb)` / `.builder_memory(mb)`**.
96
+
97
+
This only affects the build. The resulting image is unchanged — you size the actual sandbox when you create it, via `memoryMB`:
sandbox =await Sandbox.create(image=image) # size via the HTTP API's memoryMB
120
+
```
121
+
122
+
</CodeGroup>
123
+
124
+
`builderMemory` doesn't change the cache key — it's a build resource, not image content.
125
+
93
126
## Creating pre-built snapshots
94
127
95
128
Create named snapshots that persist permanently and can be shared across sandboxes. Snapshots are visible in the dashboard and don't need to be rebuilt.
@@ -285,6 +318,7 @@ The `Image` class provides a fluent, immutable API for defining sandbox environm
285
318
|`.addFile(path, content)` / `.add_file(path, content)`| Embed a file with inline content |
286
319
|`.addLocalFile(local, remote)` / `.add_local_file(local, remote)`| Read a local file into the image |
287
320
|`.addLocalDir(local, remote)` / `.add_local_dir(local, remote)`| Read a local directory into the image |
321
+
|`.builderMemory(mb)` / `.builder_memory(mb)`| RAM for the build phase (default 4 GB; doesn't affect the resulting sandbox) |
288
322
|`.toJSON()` / `.to_dict()`| Return the image manifest |
0 commit comments