Learning resourcesReviewed · E2B

Flue: E2B sandbox integration guide

This guide shows TypeScript developers how to give Flue AI agents a cloud Linux workspace, but they must manage workspace reuse and cleanup themselves. It uses E2B's SDK through a generated adapter and explains setup, persistence, templates and documented failure cases.

Researched 23 Nov 2026

In short.

This guide teaches TypeScript developers to give Flue AI agents cloud Linux workspaces, but application code must manage sandbox creation, reuse, timeouts and cleanup. Flue's useSandbox() hook connects file and shell tools to E2B through an adapter generated into the project. The guide explains reconnecting conversations to existing workspaces and identifies adapter limitations involving command errors, file removal and standalone TypeScript execution. Prices and licence terms are unknown from the page, and runtime behavior has not been independently verified.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete documentation page at [https://docs.e2b.dev/agents/flue.md], including its adapter ownership notice, environment comparison, setup, examples, persistence, templates, lifecycle and troubleshooting. Linked pages and the documentation index are excluded. Generated files and dependencies were not acquired or executed. Runtime results, security properties, current compatibility, prices and redistribution rights remain unverified.

The overview

identity

This is E2B's integration guide for Flue, a TypeScript agent framework described as coming from the Astro team. The source is [https://docs.e2b.dev/agents/flue.md]. It teaches developers to attach an E2B sandbox, a remote Linux workspace, to a Flue agent.

The integration is supplied as a blueprint: instructions that a coding agent or developer applies to create src/sandboxes/e2b.ts. There is no separate @e2b/flue package; the E2B dependency is the e2b SDK.

assessment

The guide is useful when an agent needs real Linux processes, installed development tools or a workspace that can survive between conversation turns. It explains both the initial connection and the application responsibilities that determine whether the workspace remains available.

The integration requires engineering work beyond following the first example. The application owns lifecycle management, and the page documents an adapter error path that can hide command diagnostics. Its examples establish intended usage; successful operation, performance and security strength remain unverified.

users

The main audience is developers building Flue agents that inspect files, edit projects or run commands. It particularly suits applications that need a separate workspace for each conversation and want agent commands to run away from the application's host machine.

Beginners receive project-creation commands and complete agent examples, but still need familiarity with TypeScript, environment variables and asynchronous code. Experienced developers get SDK mappings, lifecycle behavior and troubleshooting details needed to adapt the integration.

capabilities

Attaching useSandbox() supplies the agent with read, write, edit, bash, grep and glob tools. The E2B adapter directs those operations to a cloud sandbox. Without the sandbox hook, the agent has no filesystem or shell tools.

The page describes E2B workspaces as Firecracker microVMs running Debian 12, with apt and installable runtimes. Custom templates can include required packages and a repository checkout. Reconnection can preserve a conversation's files across separate application processes, including after a sandbox has been paused.

Using it

requirements

The stated prerequisites are Node.js 22.19 or later, an E2B API key and a model-provider key. The examples use Anthropic and select anthropic/claude-sonnet-4-6 through useModel(); the page does not establish the requirements of other providers.

A project needs Flue, the e2b SDK and the generated adapter source. flue run loads the project's .env automatically. Other execution environments, such as a server or CI process, must receive the E2B key through their environment or an explicit SDK option.

mechanism

A Flue agent is a function marked with 'use agent'. useModel() selects its model, while useSandbox() attaches its workspace. The application's createSandbox(options) function creates or reconnects an E2B sandbox and passes its handle to e2b(sandbox).createSandbox(options). The adapter's workspace root is /home/user.

The adapter implements Flue's SandboxDriver using E2B's files and commands APIs. File operations map directly to SDK methods, and command execution uses sandbox.commands.run(). createSandbox() runs once per agent initialization, rather than on each re-render.

For reuse across invocations, the durable example stores options.id, the agent instance identifier, in sandbox metadata. It searches running and paused sandboxes for that identifier, then connects to an existing sandbox or creates a new one.

setup

For a new project, the guide uses npx @flue/cli@latest init . --target node, followed by npm install and npm install e2b. Initialization writes configuration, starter code and supporting files but does not install dependencies. E2B_API_KEY and the example's ANTHROPIC_API_KEY go in .env.

The command npx flue add sandbox e2b --print prints the blueprint; it does not install an adapter package. A developer can inspect the instructions or pass them to a coding agent to create src/sandboxes/e2b.ts. The resulting file carries the marker flue-blueprint: sandbox/e2b@1.

The application then adds an agent using useSandbox() and chooses its timeout and lifecycle behavior. The documented update route is npx flue update sandbox e2b --print, with the resulting instructions applied to the existing adapter.

example

The basic Analyst example creates a sandbox with a ten-minute timeout and asks the agent to inspect the Linux kernel and free disk space. Its transcript illustrates tool activity going to stderr and the final response going to stdout. The displayed machine details are example output, not a hardware specification or benchmark.

The Durable example uses the same conversation identifier, demo-1, for two separate flue run invocations. The first writes /home/user/note.txt; the second reconnects and reads it. This illustrates the intended persistence pattern, but the commands were not executed and the result was not independently reproduced.

Assessment & evidence

limitations

Conversation persistence does not automatically preserve a sandbox. The initial factory creates a fresh workspace on every agent initialization. The default E2B timeout is five minutes, and Flue does not extend it automatically. Reconnection can extend a shorter remaining window but does not shorten a longer one. Cleanup and pausing belong to the application.

The documented adapter lets CommandExitError escape when a command exits unsuccessfully. Flue can then expose only the exit status to the model, hiding stderr. The guide supplies a catch block that returns stdout, stderr and exitCode while rethrowing other errors.

The direct file-removal adapter rejects recursive and force options; the guide suggests using shell commands when those behaviors are needed. The generated class also uses a TypeScript parameter property that Node's built-in type stripping rejects, including on Node 24. flue run handles compilation; a standalone import requires the documented --experimental-transform-types option.

The page provides no independent isolation assessment, throughput measurements, latency results or service reliability evidence.

reasoning

The main tradeoff is access to a real remote toolchain in exchange for infrastructure ownership. E2B fits workflows that need actual processes, installed runtimes and reusable files. The developer must decide how workspaces are identified, how long they live and when they are paused or destroyed.

The generated adapter remains in the application's repository, allowing its behavior to be inspected and changed. That also leaves the developer responsible for reviewing updates and handling the documented error cases. This is a better fit when a team is prepared to maintain integration code.

alternatives

The page compares E2B with Flue's built-in bash() virtual sandbox, based on just-bash. That environment emulates a Unix command subset inside the Node.js process, has no host access or real processes, and starts with an empty filesystem whenever the agent initializes. It may suit tasks that need only the supported virtual commands.

Flue's local() environment runs real processes on the host and uses its existing tools and disk. The page explicitly describes it as having no isolation, with conversations sharing the host. These are documented architectural comparisons; comparative performance and costs were not assessed.

evidence

The evidence consists of the complete E2B Flue documentation page at [https://docs.e2b.dev/agents/flue.md]. It includes project setup, adapter mappings, agent examples, persistence logic, lifecycle guidance and troubleshooting.

The command transcripts and fixes are supplied by the documentation. No code was executed. The generated adapter source, package contents and linked Flue, SDK, template and persistence references were not independently examined, so their current behavior and terms remain unassessed.

Access & freshness

costs

Exact costs are unknown. The page requires E2B access and a model-provider key but supplies no sandbox rates, model prices, free allowances or billing examples. It does not establish charges for paused storage, templates or idle workspaces.

Ending flue run does not terminate the sandbox. Applications therefore need to account for workspaces that remain running until timeout or explicit cleanup. The stated running limits of one hour on Base and up to 24 hours describe workspace lifetime, not pricing.

rights

The supplied page does not state a licence for the guide, its code examples or the generated adapter. Permission to redistribute a captured copy or package its code is not established.

Flue and E2B SDK licence terms, E2B service terms, model-provider terms and rights concerning agent outputs are unknown from this page. Its linked references do not supply licence evidence within the available text.

freshness

The page was captured at 2026-11-23T12:42:16.281Z with source revision sha256:e9c88d3024f91cc17b36fd641c6044c6aa7a239e6ed6dcd6f28ade03bbb844b3. A publication date and last-updated date are not provided.

The blueprint marker identifies sandbox/e2b@1, but the setup uses @latest and leaves dependency versions unpinned. The page does not establish which Flue and e2b releases were used for its transcripts or whether later releases retain the documented limitations.

actions

Before adopting the integration, inspect the printed blueprint and generated adapter, record dependency versions, and check whether unsuccessful commands preserve stderr. Confirm whether any standalone scripts need TypeScript transformation support.

Define sandbox ownership before building conversation persistence: use a stable agent identifier, decide whether idle workspaces should pause or terminate, and provide explicit cleanup. Include timeout expiry and reconnection among the behaviors to verify.

Evaluate the documented file-write and reconnect example in your own environment, then check command failures and required file-removal operations. Obtain current service prices and applicable licence terms separately; this page does not establish them.

Evidence for this report

selected-page.txtselected · checked 2026-11-23