Skip to content

Commit 4e0a878

Browse files
authored
docs: fill five sandbox lifecycle and template doc gaps (#284)
* docs: fill five sandbox lifecycle and template doc gaps Close documentation gaps surfaced by customers: - persistence: state on_timeout defaults to "kill"; expand paused-sandbox retention (indefinite, no auto-kill, explicit kill required) - base-image: document base template default resources (2 vCPU, 512 MiB) and pre-installed tooling with a link to the public Dockerfile - build: clarify disk size is tier-derived at build time, not a per-sandbox parameter - lifecycle events API: document 7-day event retention - lifecycle webhooks: document delivery retry policy and idempotency - billing: fix stale default RAM (1 GB -> 512 MiB) * docs: drop explicit-kill bullet from paused retention per review * docs: reword paused-sandbox removal bullet (free -> remove)
1 parent f9188b9 commit 4e0a878

6 files changed

Lines changed: 30 additions & 6 deletions

File tree

docs/billing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Check your usage and costs in the [dashboard usage tab](https://e2b.dev/dashboar
9696
- **Enable auto-pause** - Automatically pause sandboxes after a period of inactivity to stop billing while preserving state
9797
- **Pause sandboxes when idle** - Use `sbx.pause()` to stop billing while keeping state available for later
9898
- **Kill sandboxes you no longer need** - Use `sbx.kill()` to stop billing and release resources permanently
99-
- **Allocate only what you need** - Start with default resources (2 vCPU, 1 GB RAM) and increase only if necessary
99+
- **Allocate only what you need** - Start with default resources (2 vCPU, 512 MiB RAM) and increase only if necessary
100100
- **Monitor actively running sandboxes** - Use the [CLI](/docs/cli/list-sandboxes) or [dashboard](https://e2b.dev/dashboard?tab=usage) to track active sandboxes
101101
- **Use lifecycle events** - Set up [webhooks](/docs/sandbox/lifecycle-events-webhooks) to get notified when sandboxes are created
102102
</Accordion>

docs/sandbox/lifecycle-events-api.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ sidebarTitle: Lifecycle events API
66
The lifecycle API provides RESTful endpoints to request the latest sandbox lifecycle events. This allows you to track when sandboxes are created, paused, resumed, updated, snapshotted, or killed, along with metadata.
77
All requests require authentication using your team [API key](/docs/api-key#where-to-find-api-key).
88

9+
## Retention
10+
11+
Sandbox lifecycle events are retained for **7 days** by default. After the retention window passes, a sandbox's events are no longer available through this API.
12+
913
Query Parameters:
1014
- `offset` (optional): Number of events to skip (default: 0, min: 0)
1115
- `limit` (optional): Number of events to return (default: 10, min: 1, max: 100)

docs/sandbox/lifecycle-events-webhooks.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ When webhooks is send, we are adding headers to help you verify the authenticity
352352
- `e2b-signature-version` - Currently always `v1`, reserved for future use
353353
- `e2b-signature` - Signature for verifying the request authenticity`
354354

355+
## Delivery and retries
356+
357+
If a delivery fails, E2B retries it **up to 3 times, 10 seconds apart**. A delivery is treated as failed when your endpoint returns a 4xx or 5xx status code, the request times out, or it fails with a network error.
358+
359+
Because a delivery can be retried, the same event may be delivered more than once. Make your webhook handler idempotent and use the `e2b-delivery-id` header to deduplicate deliveries you've already processed.
360+
355361
## Available event types
356362

357363
The following event types can be subscribed to via webhooks, they are used as the `type` field in the [payload](#webhook-payload).

docs/sandbox/persistence.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ sbx = Sandbox.connect(sandbox_id, timeout=60) # 60 seconds
229229

230230
### Auto-pause
231231

232-
Auto-pause is configured in the sandbox lifecycle on create. Set `onTimeout`/`on_timeout` to `pause`.
232+
Auto-pause is configured in the sandbox lifecycle on create. `onTimeout`/`on_timeout` defaults to `"kill"`, meaning the sandbox is terminated when its timeout expires. Set it to `"pause"` to auto-pause on timeout instead.
233233

234234
<CodeGroup>
235235
```js JavaScript & TypeScript
@@ -238,7 +238,7 @@ import { Sandbox } from 'e2b'
238238
const sandbox = await Sandbox.create({
239239
timeoutMs: 10 * 60 * 1000, // Optional: change default timeout (10 minutes)
240240
lifecycle: {
241-
onTimeout: 'pause',
241+
onTimeout: 'pause', // Defaults to 'kill'; set to 'pause' to auto-pause on timeout
242242
autoResume: false, // Optional (default is false)
243243
},
244244
})
@@ -249,8 +249,8 @@ from e2b import Sandbox
249249
sandbox = Sandbox.create(
250250
timeout=10 * 60, # Optional: change default timeout (10 minutes)
251251
lifecycle={
252-
"on_timeout": "pause", # Auto-pause after the sandbox times out
253-
"auto_resume": False, # Optional (default is False)
252+
"on_timeout": "pause", # Defaults to "kill"; set to "pause" to auto-pause on timeout
253+
"auto_resume": False, # Optional (default is False)
254254
},
255255
)
256256
```
@@ -276,8 +276,10 @@ If you resume the sandbox, the service will be accessible again but you need to
276276
- Resuming a sandbox takes approximately **1 second**
277277

278278
### Paused sandbox retention
279-
- Paused sandboxes are kept **indefinitely** — there is no automatic deletion or time-to-live limit
279+
- Paused sandboxes are kept **indefinitely**; there is no automatic deletion or time-to-live limit
280+
- There is currently **no configurable "auto-kill after N days" option**; a paused sandbox will not expire on its own
280281
- You can resume a paused sandbox at any time
282+
- To remove a paused sandbox, you must kill it explicitly with an API call (`sandbox.kill()` / `Sandbox.kill(sandboxId)`), as shown in [Removing paused sandboxes](#removing-paused-sandboxes)
281283

282284
### Continuous runtime limits
283285
- A sandbox can remain running (without being paused) for:

docs/template/base-image.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ template.from_base_image() # e2bdev/base
9191

9292
</CodeGroup>
9393

94+
`base` is also the template used when you call `Sandbox.create()` without specifying one. It is Debian-based and comes with common tooling pre-installed: Python 3, Node.js, Yarn, `git`, `curl`, `build-essential`, and the GitHub CLI (`gh`). For the exact contents, see the public Dockerfile: [`templates/base/e2b.Dockerfile`](https://github.com/e2b-dev/E2B/blob/main/templates/base/e2b.Dockerfile).
95+
96+
### Default resources
97+
98+
A sandbox gets its CPU and memory from the template it's built on. A sandbox built from `base` starts with **2 vCPU and 512 MiB of RAM**.
99+
100+
You can override CPU and memory when you [build a template](/docs/template/build) (`cpuCount`/`cpu_count`, `memoryMB`/`memory_mb`). Disk size is not a default you set per sandbox; it's determined by your team's tier limit and applied at build time (see [Build limits](/docs/template/quickstart#build-limits)).
101+
94102
### Build from existing template
95103

96104
Extend an existing template from your team or organization:

docs/template/build.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ build_info = Template.build(
3939

4040
</CodeGroup>
4141

42+
<Note>
43+
**Disk size is not a per-sandbox setting.** Unlike `cpuCount`/`cpu_count` and `memoryMB`/`memory_mb`, there is no disk-size parameter, neither on the template build nor on `Sandbox.create`. A sandbox's disk size is determined by your team's tier limit and applied when the template is built (see [Build limits](/docs/template/quickstart#build-limits)). `diskSizeMB` only ever appears in API response payloads (for example on sandbox and template info), never as an input. To get a larger disk, raise your tier or contact [support@e2b.dev](mailto:support@e2b.dev).
44+
</Note>
45+
4246
## Build in background
4347

4448
The `buildInBackground` method starts the build process and returns immediately without waiting for completion. This is useful when you want to trigger a build and check its status later.

0 commit comments

Comments
 (0)