← All work
Infrastructure · 2026

E2B Sandbox Template & Agent Bridge for Autonomous Workspaces

An AI-cofounder / autonomous-startup-builder SaaS

Overview

The isolated execution environment for an AI-cofounder / autonomous-startup-builder SaaS: a custom e2b sandbox template plus a bridge that runs a Claude Code agent inside each per-project workspace and exposes it over a WebSocket the orchestrator can drive.

Why It Exists

Autonomous agents must run real shell, git and build commands without touching each other or the host. e2b provides per-project microVM isolation; this repo packages a reproducible template and the runtime “bridge” that turns a sandbox into a controllable agent session, so the platform can spawn, drive and tear down company workspaces on demand.

What We Built

An e2b template definition (template.ts, build.dev.ts, build.prod.ts) and a bridge/ runtime. The bridge (bridge.js, session.js, git.js, heartbeat.js, http.js, mcp.js, run.js, log.js, patch-sdk.cjs, link-vendor-clis.sh) boots the Claude Code Agent SDK inside the sandbox, git-clones the agent-base repo into the workspace, links the bundled vendor CLIs, and serves a WebSocket on :8080; the orchestrator drives sessions with init / user / prompt messages. It pins SDK defaults (project setting sources, the claude_code preset) for deterministic behavior. An extensive set of test-*.ts harnesses cover boot, browser use, dispatch races, R2 mount, prod snapshots, env parsing and prompt flows.

Technologies & Approach

TypeScript and Node/JS on the e2b platform. The bridge wraps @anthropic-ai/claude-agent-sdk rather than the bare claude CLI so sessions are programmatically controllable, heartbeated and observable; R2 is mounted for persistent workspace storage; separate dev and prod build paths plus snapshot tests keep template changes safe to ship.

Outcome / Impact

Provides the reproducible, isolated runtime every autonomous company project executes in, with a stable WebSocket control protocol between the orchestrator and the in-sandbox agent, the execution counterpart to the agent-base configuration repo.

Capabilities Demonstrated

  • Custom e2b sandbox template with dev/prod build pipeline
  • WebSocket bridge driving Claude Code Agent SDK sessions
  • R2-mounted persistent agent workspaces
  • Snapshot and integration test harnesses for sandbox boot/runtime
  • Deterministic, controllable, heartbeated agent sessions
More work See all →