Skip to content

feat(v1): add E2B runtime provider - #2294

Open
mattteufel-e2b wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
mattteufel-e2b:feat/e2b-runtime
Open

feat(v1): add E2B runtime provider#2294
mattteufel-e2b wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
mattteufel-e2b:feat/e2b-runtime

Conversation

@mattteufel-e2b

@mattteufel-e2b mattteufel-e2b commented Aug 7, 2026

Copy link
Copy Markdown

What

Adds an e2b remote sandbox runtime alongside prime and modal (single squashed commit, rebased on current main):

  • verifiers/v1/runtimes/e2b.py — the full Runtime contract on the E2B SDK (e2b>=2.35.0): login-shell exec with caller-PATH precedence, durable run_program with stream reconnect (rollouts are never replayed), live processes, background servers exposed via E2B's port proxy, and cancellation-shielded teardown with a sync atexit backstop. Sandboxes boot from a cached template keyed on (image, workdir, cpu, memory); resource constraints are validated up front, including task-level overrides.
  • chat.py: drop an explicit tools: null when forwarding chat bodies (some OpenAI-compatible providers reject it; omission is equivalent).
  • e2b pytest mark + pairwise e2e placement rows (local-only, like prime/modal), config validation tests, docs.

Open question for maintainers: whether to add an e2b optional extra mirroring verifiers[modal] — left out here to avoid touching pyproject.toml deps; the docs prescribe uv add "e2b>=2.35.0" instead.

Verification (all against live E2B, inference via Fireworks)

  • Runtime contract: 31 checks driving E2BRuntime directly — exec/env/cwd/quoting, binary I/O with read caps, run_program, live-process stdio + terminate/kill, run_background + expose reachable from the host, run_uv_script, template cache hit (0.6s second start), idempotent teardown. All passed.
  • Edge paths: fresh template build (~150s, then cached), bad image → clean SandboxError, network_access=false blocks egress. All passed.
  • Duration/robustness: 12-min run_program and an 8-min-idle open_process both correct; a rollout cancelled mid-program left no sandbox behind (confirmed server-side); 16 concurrent creates all succeeded, paced by the creates_per_sec limiter. All passed.
  • e2e matrix: all 7 -m e2b cases green (~48s, -n 4), re-run green after the rebase onto main's limiter + interception-server changes.
  • Real eval: gsm8k-v1, bash harness in E2B, 6 tasks x 2 rollouts → 12/12 ok, mean reward 1.0, with the math-verify reward script executing inside each sandbox.
  • Hygiene: deterministic suite, ruff, ty green; no leaked sandboxes after any run.

🤖 Generated with Claude Code

@mattteufel-e2b
mattteufel-e2b force-pushed the feat/e2b-runtime branch 3 times, most recently from f9e8e35 to 496925e Compare August 7, 2026 21:14

@mattteufel-e2b mattteufel-e2b left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add E2B as a runtime provider

Add an e2b remote sandbox runtime alongside prime and modal, implementing
the full Runtime contract on the E2B SDK (e2b>=2.35.0): login-shell exec
with caller-PATH precedence, durable run_program via file-backed
stdout/stderr/status with stream reconnect (rollouts are never replayed),
live processes with streamed stdio, background servers exposed through
E2B's built-in port proxy, and cancellation-shielded teardown with a sync
atexit backstop. Sandboxes boot from a cached E2B template keyed on
(image, workdir, cpu, memory), built once behind a cross-process file
lock; template resource constraints are validated up front, including
task-level resource overrides that bypass pydantic validation.

Also drop an explicit 'tools: null' when forwarding chat bodies - some
OpenAI-compatible providers reject the explicit null; omission means the
same thing.

Adds the e2b pytest mark and pairwise e2e placement rows (local-only,
excluded in CI like prime/modal), config validation tests, and docs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mattteufel-e2b
mattteufel-e2b marked this pull request as ready for review August 11, 2026 16:37
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