Skip to content

Commit bbd9bf4

Browse files
mlejvacursoragentberan-t
authored
Document timeout behavior after sandbox auto-resume (#174)
* Document timeout behavior after sandbox auto-resume - Add new 'Timeout after auto-resume' section to auto-resume.mdx explaining that the original timeout resets from the moment the sandbox resumes - Include a step-by-step example of the pause/resume/timeout cycle - Note that setTimeout/set_timeout can override the timeout after resume - Update cleanup section to reinforce the timeout reset behavior - Update persistence.mdx timeout section to mention auto-resume resets Co-authored-by: Vasek Mlejnsky <vasek.mlejnsky@gmail.com> * Fix auto-resume timeout docs: sandbox gets default 5min, not creation timeout * Fix auto-resume timeout: use max(5min, original timeout), not flat 5min * Improve auto-resume timeout wording for clarity * Trigger Mintlify preview rebuild * Trigger Mintlify preview rebuild --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Tomas Beran <tomas.beran@e2b.dev>
1 parent 638e4e7 commit bbd9bf4

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

docs/sandbox/auto-resume.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,26 @@ sandbox = Sandbox.create(
5454

5555
If you use `autoResume: false`, resume explicitly with [`Sandbox.connect()`](/docs/sandbox/connect).
5656

57+
## Timeout after auto-resume
58+
59+
When a sandbox auto-resumes, it restarts with a **5-minute minimum timeout**. If you originally created the sandbox with a longer timeout, that value carries over.
60+
The countdown begins from the moment the sandbox resumes, not from when it was first created.
61+
62+
For example, if you create a sandbox with a 2-minute timeout:
63+
64+
1. The sandbox runs for 2 minutes, then pauses.
65+
2. Activity arrives and the sandbox auto-resumes.
66+
3. A 5-minute timeout starts (the 5-minute minimum applies because the original timeout was shorter).
67+
4. If no further activity resets the timeout, the sandbox pauses again after 5 minutes.
68+
69+
If you create a sandbox with a 1-hour timeout, the auto-resume timeout will also be 1 hour, since it exceeds the 5-minute minimum.
70+
71+
This cycle repeats every time the sandbox auto-resumes — the lifecycle configuration (`onTimeout: "pause"` + `autoResume: true`) is persistent across pause/resume cycles.
72+
73+
<Note>
74+
You can change the timeout after the sandbox resumes by calling `setTimeout`/`set_timeout`. See [Change sandbox timeout during runtime](/docs/sandbox#change-sandbox-timeout-during-runtime).
75+
</Note>
76+
5777
## What counts as activity
5878

5979
Auto-resume is triggered by the sandbox activity - that's both HTTP traffic and controlling the sandbox from the SDK.
@@ -304,5 +324,5 @@ print(result.stdout)
304324

305325
## Cleanup
306326
Auto-resume is persistent, meaning if your sandbox resumes and later times out again, it will pause again.
307-
327+
Each time the sandbox resumes, it gets a fresh timeout (at least 5 minutes, or longer if the original creation timeout exceeds that) — so the sandbox keeps cycling between running and paused as long as activity arrives.
308328
If you call `.kill()`, the sandbox is permanently deleted and cannot be resumed.

docs/sandbox/persistence.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Sandbox.kill(sbx.sandbox_id)
209209
</CodeGroup>
210210

211211
## Sandbox's timeout
212-
When you connect to a sandbox, the inactivity timeout resets. The default is 5 minutes, but you can pass a custom timeout to the `Sandbox.connect()` method:
212+
When you connect to a sandbox, the timeout resets. The default is 5 minutes, but you can pass a custom timeout to the `Sandbox.connect()` method:
213213

214214
<CodeGroup>
215215
```js JavaScript & TypeScript

0 commit comments

Comments
 (0)