Skip to content

Add the E2B extension for Pi (@e2b/pi) - #1

Merged
OndrejDrapalik merged 1 commit into
mainfrom
feat/e2b-extension
Oct 15, 2026
Merged

OndrejDrapalik merged 1 commit into
mainfrom
feat/e2b-extension

Conversation

@tomasvarga

Copy link
Copy Markdown
Collaborator

Adds @e2b/pi, the E2B extension for Pi. With pi --e2b, Pi stays on your machine and its tools run in an E2B sandbox that belongs to the Pi session.

What it does

  • Tools in the sandbox. bash, read, write, edit and ! commands run in the sandbox through Pi's pluggable tool operations. grep, find and ls are off in E2B mode. If there is no sandbox, tools fail and never run on the host.
  • Lazy start. Pi opens at once. The sandbox starts with the first prompt and gets the git working tree (tracked and new files, with uncommitted changes). Ignored files such as .env stay local.
  • Pull. /e2b pull diffs the sandbox against an upload baseline and runs git apply locally. /e2b pull --branch commits to pi/<session> instead.
  • Resume and fork. pi --e2b -c reconnects to the same sandbox (paused with memory). A forked session gets its own copy via Sandbox.fork.
  • Preview. preview_url gives a public link for a port.
  • Cleanup. Sandboxes that no Pi session refers to are killed on the next start (same machine, Pi's own session folder only). --no-session offers a pull, then kills on exit.
  • No credentials in the sandbox. No clone, no push, no host env forwarded.

Layout

index.ts          flags, session lifecycle, /e2b command, cleanup
src/tools.ts      sandbox-backed bash, read, write and edit; preview_url
src/workspace.ts  upload the working tree, diff and pull changes back

Tests

  • npm run check: typecheck, oxlint (anti-slop rules, curly), oxfmt, offline smoke test
  • npm run test:live: real sandbox, 10/10 steps pass (tools, background processes, abort, pause and resume, upload and pull, lazy start, fork)

Linear: INT-149

With pi --e2b, Pi runs on your machine and its tools (bash, read, write, edit)
run in an E2B sandbox that belongs to the Pi session.

- Your git working tree is uploaded when the sandbox starts (ignored files such
  as .env stay local). /e2b pull applies the agent's changes to your checkout,
  or commits them on a local pi/<session> branch with --branch.
- The sandbox starts with the first prompt, pauses with its memory when idle,
  and comes back on resume. A forked session gets its own copy.
- preview_url shares a public link to a server running in the sandbox.
- No credentials go into the sandbox, and host environment variables are not
  forwarded. Sandboxes of deleted sessions are cleaned up on the next start.

Checks: typecheck, oxlint with vendored anti-slop rules, oxfmt, an offline smoke
test, and a live test against real E2B sandboxes.
@cla-bot cla-bot Bot added the cla-signed label Oct 13, 2026
@OndrejDrapalik
OndrejDrapalik merged commit b8abb49 into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants