Skip to content

Find a component

Loading the directory…

↑ ↓ to select · Enter to open · Esc to closeBrowse all →
Contributor login

E2B Sandboxes

E2B sandboxes for Bijection agent applications

Bijection source
git clone https://github.com/bijectionhq/e2b.git
cd e2b
git checkout 2024f8d7d5fdb7eeb855eb92d57829b05f39a6b2

Bijection repository access is required. Request access.

Description

E2B sandboxes for Bijection agent applications

Explore the package README for API concepts, configuration, and examples. Check the Bijection source for adaptation-specific setup.

Available to evaluate

Review the source and its dependencies before adopting this package. Source availability does not establish npm publication or runtime qualification.

Getting started

  1. Get the source at the revision above and read its package documentation.
  2. Check the required Bijection SDK version, dependencies, and external service credentials.
  3. Follow the package setup instructions and the guide to using components.
  4. Exercise the component in your deployment according to your project’s verification rules.

Open source

Maintained source: bijectionhq/e2b. Based on e2b-dev/e2b-convex. License: MIT. Consult the repository for license terms, notices, and contributor attribution.

Compute runs with the external sandbox provider. Bijection connects application state and operations to that provider.

From the upstream publisher

E2B sandboxes for Convex agent applications

Explore the demo ↗

Upstream overview

From the upstream package documentation.

A tableless Convex component that provides a V8-compatible E2B client for managing persistent cloud sandboxes inside Convex actions. It handles sandbox lifecycle (create, pause, resume), shell command execution, file operations, and preview hosts without requiring the full Node-oriented E2B SDK. Includes first-class integrations for Convex Agent and the Vercel AI SDK via optional subpackage imports.

Use cases

From the upstream package documentation.

  • Running isolated shell commands per user session in an AI coding agent, where each session maps to a persistent sandbox identified by scope and key
  • Building an agentic workflow with Convex Agent that needs safe, sandboxed code execution with per-thread tool access and optional approval rules
  • Serving preview hosts from within a sandbox for live app previews generated by an AI agent during a Convex action
  • Reading and writing files inside a sandboxed environment as part of a multi-step AI pipeline, with path restrictions enforced to /home/user and /tmp
  • Integrating AI SDK tool calls into a Convex action that require sandboxed execution, without importing Node-only dependencies into the Convex runtime

How it works

From the upstream package documentation.

Install the package and set your E2B API key with npx convex env set E2B_API_KEY. Register the component in convex/convex.config.ts using app.use(e2b, ...) and bind the secret through the app environment. The component is tableless and stores no data in Convex; sandbox identity is tracked via namespaced E2B metadata using hashed scope and key values you provide.

Inside a Convex action, instantiate new E2B(components.e2b, { template, timeoutMs }) and call sandboxes.getOrCreate(ctx, { scope, key }) to retrieve or create a sandbox. Subsequent operations like runCommand accept the returned sandboxId directly to skip redundant resolution. Sandboxes automatically pause on timeout and resume on the next operation, which restarts billing.

For AI integrations, createAgentTools from @e2b/convex/agent produces thread-aware tools compatible with Convex Agent, while createAiSdkTools from @e2b/convex/ai produces standard AI SDK tools usable in any action. Both subpackages are optional and have no effect on the core bundle. Command output is bounded to 32 KiB per stream by default, file reads cap at 1 MiB, and writes at 4 MiB, with file tool access restricted to safe paths unless explicitly reconfigured.

Upstream package FAQ

Does @e2b/convex require the full E2B Node.js SDK?

No. @e2b/convex ships its own V8-compatible E2B client that includes only the Process and Filesystem protocol descriptors the component needs. The full Node-oriented E2B SDK is not imported into the Convex runtime. The pinned e2b package is a development-only dependency used as a protocol source.

How does sandbox persistence work across multiple Convex action invocations?

Sandboxes in @e2b/convex are identified by a scope and key pair you provide. If a sandbox with that identity is already running or paused, getOrCreate returns it instead of creating a new one. Paused sandboxes resume automatically when any operation targets them, which also restarts E2B billing for that session.

What are the file operation limits in @e2b/convex?

File reads in @e2b/convex default to 64 KiB and are capped at 1 MiB. File writes are capped at 4 MiB. File tools are restricted to /home/user and /tmp unless the configuration is explicitly changed. These limits apply to both direct action usage and agent tool integrations.

Can I use @e2b/convex with Convex Agent and the Vercel AI SDK?

Yes. @e2b/convex provides separate integration entry points: createAgentTools from @e2b/convex/agent for Convex Agent, and createAiSdkTools from @e2b/convex/ai for standard AI SDK usage inside any Convex action. Each integration requires its own peer dependency (ai, and optionally @convex-dev/agent), but the core package has no runtime dependency on either.

Is @e2b/convex ready for production use?

The package is pre-1.0 and the authors recommend validating it against your E2B template and network policy before deploying to production. The component uses E2B's public APIs and CI rejects Node built-ins or full-SDK imports in the emitted Convex runtime. A scheduled real-service test monitors for protocol drift.

Use with agents and CLI

Give your coding agent the component’s source identity and setup guidance.

agent-prompt.md
Help me integrate E2B Sandboxes with Bijection.

Read: https://bijection.com/components/e2b/SKILL.md

Check SDK compatibility and dependency availability.
Follow this project's execution and verification rules.

Upstream README.md

View repository ↗

Documentation from e2b-dev/e2b-convex, recorded October 23, 2026. APIs and setup may differ in the Bijection adaptation.

@e2b/convex

Persistent E2B sandboxes for Convex applications and AI agents.

@e2b/convex is a tableless Convex component with a small V8-compatible E2B client. It gives Convex actions sandbox lifecycle, commands, bounded file operations, preview hosts, Convex Agent tools, and plain AI SDK tools without shipping the full Node-oriented E2B SDK into the Convex runtime.

Pre-1.0: validate the package against your E2B template and network policy before production use.

Install

npm install @e2b/convex
npx convex env set E2B_API_KEY e2b_your_key

Register the component and bind the secret in your Convex app:

// convex/convex.config.ts
import e2b from "@e2b/convex/convex.config.js";
import { defineApp } from "convex/server";
import { v } from "convex/values";

const app = defineApp({ env: { E2B_API_KEY: v.string() } });
app.use(e2b, { env: { E2B_API_KEY: app.env.E2B_API_KEY } });

export default app;

Run a command

Create the client in a Convex action and identify the sandbox with an application-owned scope and key:

// convex/sandbox.ts
import { E2B } from "@e2b/convex";
import { v } from "convex/values";
import { components } from "./_generated/api";
import { action } from "./_generated/server";

const sandboxes = new E2B(components.e2b, {
  template: "base",
  timeoutMs: 10 * 60_000,
});

export const run = action({
  args: { userId: v.string(), sessionId: v.string(), command: v.string() },
  handler: async (ctx, args) => {
    const identity = { scope: args.userId, key: args.sessionId };
    const sandbox = await sandboxes.getOrCreate(ctx, identity);

    return sandboxes.runCommand(ctx, {
      ...identity,
      sandboxId: sandbox.sandboxId,
      command: args.command,
    });
  },
});

Calls with the same scope and key reuse the same running or paused sandbox. Resolve it once before parallel work and pass sandboxId to subsequent operations.

Integrations

  • Minimal API: lifecycle, shell commands, files, directories, and preview hosts.
  • Convex Agent: createAgentTools(sandboxes, ...) from @e2b/convex/agent creates thread-aware tools with optional approval rules. Requires @convex-dev/agent and ai.
  • AI SDK: createAiSdkTools(sandboxes, ctx, ...) from @e2b/convex/ai creates standard AI SDK tools inside any Convex action. Requires ai.

The core package has no runtime dependency on either; install them only for the integration you use.

Start with the getting-started guide, then use the copy-paste cookbook. The complete local app in example includes an xterm.js terminal and a realtime agent chat with visible tool calls.

Defaults and limits

  • Sandboxes pause on timeout and are rediscovered through namespaced E2B metadata. Any operation on a paused sandbox resumes it, which restarts billing.
  • Every operation resolves the sandbox first (getInfo + connect, or a metadata list when sandboxId is absent), adding roughly a second per call.
  • Scope and key values are hashed before entering E2B metadata.
  • Command output is bounded to 32 KiB per stream by default.
  • Command output and individual file reads are capped at 1 MiB.
  • File reads default to 64 KiB; writes are capped at 4 MiB.
  • File tools are restricted to /home/user and /tmp unless configured otherwise.
  • getHost is not exposed to an agent unless explicitly enabled.
  • Every E2B request is tagged with e2b-convex/<version> for integration attribution.

See security, operations, and architecture before deploying an agent that executes untrusted instructions.

Status

The package uses E2B's public APIs and includes only the Process and Filesystem protocol descriptors required by the component. The pinned e2b package is a development-only protocol source. CI rejects Node built-ins or full-SDK imports in the emitted Convex runtime and a scheduled real-service test watches for protocol drift.

MIT

Keywords