Skip to content

feat: pause idle E2B sandboxes#57

Open
MohamedAkbarally wants to merge 3 commits into
mainfrom
feat/e2b-pause-between-calls
Open

feat: pause idle E2B sandboxes#57
MohamedAkbarally wants to merge 3 commits into
mainfrom
feat/e2b-pause-between-calls

Conversation

@MohamedAkbarally

@MohamedAkbarally MohamedAkbarally commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Add an opt-in pause/resume mode so E2B sandboxes can avoid idle runtime between tool calls while preserving sandbox state.

Why

Agents often spend more time waiting for the model to think than actively running code. Pausing the sandbox between tool calls avoids paying for an idle running container while keeping the sandbox ready for the next operation.

Benefits

  • Saves cost because idle sandboxes can be paused, and paused sandboxes do not consume running runtime.
  • Gives the agent precise control over when sandbox time is spent: resume for a command or file operation, then pause again when idle.
  • Preserves filesystem state, running processes, and in-memory process state across tool calls.
  • Paused time does not count against the sandbox running timeout; reconnecting resumes the sandbox with a fresh timeout window.

Limitation

Pausing freezes the whole sandbox. Background work, downloads, and web servers do not make progress or receive traffic while paused. For example, a background download will continue only after the next tool call resumes the sandbox, and the remote connection may need retry/resume support.

Foreground commands that complete within a single tool call are unaffected.

Validation

Empirically verified with live E2B sandboxes:

  • A non-paused sandbox with a short timeout expired while waiting.
  • A paused sandbox resumed after waiting longer than that timeout and retained file state.
  • A background Python process retained PID, memory state, and counter state across pause/resume.

MohamedAkbarally and others added 3 commits June 16, 2026 13:10
Add an opt-in pause/resume mode so E2B sandboxes can avoid idle runtime between tool calls while preserving sandbox state.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the runtime pause/resume behavior while narrowing type-check ignores around optional and SDK-version-specific APIs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant