feat(e2b): run Android and web targets in E2B sandboxes
Merged
TO
21d ago+2712+2712+0123456789012345678901234567890123456789-7-7-0123456789
What and why
- New package
@e2e-dev/e2b: run targets in E2B sandboxes, as agreed in #1414.e2b(): a device provider for the mobile engine. Android 16 on E2B's publicandroid-16template, one sandbox per worker slot. The.apkis installed through agent-device, likedevice.installApp().e2bBrowsers()from@e2e-dev/e2b/web: a browser provider for the web engine. Chromium in a sandbox per worker slot, or per attempt.
- Sandboxes refuse public traffic. A loopback tunnel on the runner (
packages/e2b/src/tunnel.ts) adds E2B's traffic token, because the web engine connects with a CDP URL alone and agent-device's client sends no custom header. A lease holds only127.0.0.1:<port>, so the token never reaches a lease, log, or report. - The browser template is built once per E2B team from the Playwright image
@e2e-dev/webpins. The docs page has the 8-line script.
flowchart LR
R[e2e runner] -->|127.0.0.1| T[loopback tunnel]
T -->|HTTPS + traffic token| E[E2B edge]
E --> A[agent-device proxy<br/>Android sandbox]
E --> C[Chromium DevTools<br/>browser sandbox]
engine: mobile({ platform: 'android', device: e2b() })
engine: web({ browser: e2bBrowsers() })
Issue
Fixes #1414
Verified
Ran it locally: yes
- Live E2B sandboxes,
e2e runagainst the built packages: Android 16 installs Privacy Friendly 2048 from an.apk, launches it, and swipes; Chromium browses Wikipedia in worker and attempt scope, and reads a download back. No sandbox is left running after a run. - The video is the live demo: a chat page where each message is an
agent.actstep on the same sandbox, Android first, then Chromium.
https://github.com/user-attachments/assets/dc294a02-f8f9-4bc2-a9b7-b94fba571f00
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.