---
title: "Flue integration"
description: "Give a Flue agent an E2B sandbox. The E2B blueprint points Flue's read, write, edit and bash tools at an isolated sandbox instead of your host."
url: "https://e2b.dev/integrations/flue"
---

# Flue

> Point a Flue agent's file and shell tools at an E2B sandbox. The E2B blueprint adds a small adapter to your repo, so bash runs in a Firecracker microVM, not on your host.

Agent frameworks & SDKs · [All integrations](https://e2b.dev/integrations.md)

## About this integration

- **Maintained by:** Flue
- **How it works:** Blueprint from flue add
- **Package:** e2b
- **Language:** TypeScript
- **Upstream:** [withastro/flue · ★ 8.7k](https://github.com/withastro/flue)
- **Example:** [e2b-cookbook/flue-feedback-analyst-js](https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/flue-feedback-analyst-js)

## Get started

Paste the prompt into your coding agent, or follow the steps yourself.

### Paste this into your coding agent

```text
Add E2B sandboxes to this Flue project.

1. Install the e2b package using the project's package manager.
2. The E2B SDK reads the E2B_API_KEY environment variable. If it isn't set, ask me for my API key from https://console.e2b.dev/?tab=keys and put it in .env. Never hardcode it.
3. Follow the Flue guide at https://docs.e2b.dev/agents/flue. Apply the blueprint from npx flue add sandbox e2b --print, then create the sandbox inside useSandbox's createSandbox() and wrap it with e2b(sandbox).
4. Run the agent once with flue run and show me the output that came from the sandbox.
```

## Or set it up yourself

### 1. Add the E2B SDK

```bash
npx @flue/cli@latest init . --target node
npm install
npm install e2b
```

### 2. Set your API keys

```bash
E2B_API_KEY="e2b_***"
ANTHROPIC_API_KEY="sk-ant-***"
```

### 3. Add the adapter

```bash
npx flue add sandbox e2b --print | claude
```

### 4. Write and run the agent

```typescript
'use agent';
import { useModel, useSandbox } from '@flue/runtime';
import { Sandbox } from 'e2b';
import { e2b } from '../sandboxes/e2b.ts';

export function Analyst() {
  useModel('anthropic/claude-sonnet-4-6');

  useSandbox({
    async createSandbox(options) {
      const sandbox = await Sandbox.create({
        timeoutMs: 10 * 60_000,
        metadata: { framework: 'flue', agent: 'analyst' },
      });
      return e2b(sandbox).createSandbox(options);
    },
  });

  return 'You work in a Linux sandbox. Use bash for anything about the machine or its files.';
}
```

## What runs in the sandbox

The agent's file and shell tools run in an isolated sandbox, away from your host.

- **Tools:** read, write, edit, bash, grep and glob from useSandbox(), mapped to sandbox.files and sandbox.commands.
- **Isolation:** Commands run in a Firecracker microVM with a Debian toolchain, not as processes on your host.
- **State:** Key the sandbox on options.id and reconnect with Sandbox.connect() to keep one workspace per conversation.
- **Lifetime:** The default timeout is 5 minutes; set timeoutMs. Flue never kills the sandbox, so call sandbox.kill() yourself.

## More agent frameworks

Other frameworks that run their tools on E2B.

- [Vercel AI SDK](https://e2b.dev/integrations/vercel-ai-sdk.md): Give Vercel AI SDK agents sandbox tools with @e2b/ai-sdk-sandbox. Experimental for AI SDK 7.
- [Mastra](https://e2b.dev/integrations/mastra.md): Give Mastra agents an E2B workspace or a full desktop with @mastra/e2b and @mastra/e2b-desktop.
- [OpenAI Agents SDK](https://e2b.dev/integrations/openai-agents-sdk.md): Use the built-in E2B sandbox client in the OpenAI Agents SDK to give agents a real machine.

## Links

- [Get API key](https://console.e2b.dev/?tab=keys)
- [Read the docs](https://docs.e2b.dev/agents/flue)
- [E2B documentation](https://docs.e2b.dev)
