SandboxRun on E2B, Daytona and more

Run the same agent on E2B, Daytona and more

An AgentEnvironmentProvider creates sandboxes on one cloud and runs agent turns in them. Each provider package wraps one cloud. providerAsSandboxClient from @tangle-network/agent-runtime turns any of them into a client with the same create() and streamPrompt() calls, so your agent code stays the same when you change clouds.

PackageCloudCredentials
@tangle-network/agent-provider-tangleTangle SandboxTANGLE_API_KEY
@tangle-network/agent-provider-e2bE2BE2B_API_KEY, plus TANGLE_API_KEY for models
@tangle-network/agent-provider-daytonaDaytonaDAYTONA_API_KEY, plus TANGLE_API_KEY for models
@tangle-network/agent-provider-computesdkAny ComputeSDK cloudThat cloud’s key, plus TANGLE_API_KEY for models
@tangle-network/agent-provider-boatBoatBOAT_API_KEY, plus TANGLE_API_KEY for models

On every cloud other than Tangle, the coding agent runs in the sandbox and its model calls go through the Tangle Router on the key you pass as router.key. The Boat provider has not completed a live run; treat it as a preview.

agent-runtime needs Node.js 22.19 or later.

Run one agent on any cloud

Create the provider for your cloud:

import { createTangleProvider } from "@tangle-network/agent-provider-tangle";
import { Sandbox } from "@tangle-network/sandbox";
 
const provider = createTangleProvider({
  client: new Sandbox({ apiKey: process.env.TANGLE_API_KEY!, baseUrl: "https://sandbox.tangle.tools" }),
});

Then run the same code on any of them:

import { providerAsSandboxClient } from "@tangle-network/agent-runtime/kernel";
 
const client = providerAsSandboxClient(provider, {
  defaults: { profile: { name: "repo-reader", harness: "claude-code" } },
});
 
const box = await client.create({
  git: { url: "https://github.com/tangle-network/sandbox-demo" },
});
try {
  for await (const event of box.streamPrompt("Read this repository. In two sentences, say what it does.")) {
    if (event.type === "result") console.log(event.data.finalText);
  }
} finally {
  await box.delete();
}

The profile runs Claude Code here; Codex, OpenCode and Pi are set the same way. On Daytona, name a Router model in the profile: model: { default: "<model-id>" }. The complete program for each cloud is in eval and runtime examples.

Router model ids come from GET /v1/router-models with your Sandbox key, or the model list.

The same client works anywhere agent-runtime takes a sandboxClient, such as supervise workers and runAgentRounds. See agent-runtime.

What each cloud honors

A provider refuses any create field it cannot honor, before it calls the cloud, with an EnvironmentProviderError that names the field. Nothing is dropped silently. provider.capabilities() reports what a provider supports.

CloudHonorsRefuses
E2BProfile, repository checkout, workspace.environment (another template)Custom images, resources, every egress mode, keyed create, secrets, snapshots and checkpoints
DaytonaProfile, repository checkout, workspace.environment (snapshot name), env, metadata and name; egress open, strict (domain allow list plus the Router host) and blocked; checkpoints and forksCustom images, resources, secrets, idempotency keys
BoatProfile, repository checkout, workspace.environment (snapshot or sandbox id), env, metadata and name; checkpoints and forksCustom images, resources, egress, secrets
ComputeSDKProfile, repository checkout, workspace.environment, workspace.image when the image is built from the box image; checkpoints when you pass the snapshot managerResources, egress

On Tangle Sandbox, every create option is available. See create options.

Build the box image for E2B, Daytona and ComputeSDK

Sandboxes on other clouds boot an image that carries the coding agents and the bridge that runs them. Build it once from the agent-sdk repository:

E2B_API_KEY=... pnpm build:sandbox-image --target e2b
DAYTONA_API_KEY=... pnpm build:sandbox-image --target daytona
pnpm build:sandbox-image --target docker

The script prints the name it published, such as DAYTONA_SNAPSHOT=<name>. That name is each provider’s default, so the providers find it without configuration. --base-image <image> builds the same box on another base layer. Boat takes no custom images; a fresh Boat sandbox installs the same tools with a setup script, and a saved snapshot skips that install.

Prove a provider with the conformance suite

@tangle-network/agent-provider-testkit checks a provider against a real cloud with a real profile: a coding agent, a model, a system prompt, an MCP server, a hook, a denied tool, a subagent and mounted files.

import { formatLiveReport, runLiveProfileConformance } from "@tangle-network/agent-provider-testkit";
import { createE2BProvider } from "@tangle-network/agent-provider-e2b";
 
const report = await runLiveProfileConformance({
  name: "e2b",
  credentials: ["E2B_API_KEY", "TANGLE_API_KEY"],
  harness: "claude-code",
  model: process.env.TANGLE_MODEL!,
  createProvider: () => createE2BProvider({ router: { key: process.env.TANGLE_API_KEY! } }),
});
console.log(formatLiveReport(report));

Each requirement reports pass, fail, skip or unproven. A missing credential skips the run with no credential: <NAME> and never reports a pass. The suite spends real model tokens, creates real sandboxes, and fails on any sandbox it tagged that survives teardown. runAgentEnvironmentProviderConformance runs the contract checks without a model.

Next