@blaxel/eve-sandbox

中文文档
0.3.37发布于 2026/11/11MITTypeScriptES Module近 30 天下载 3926

Durable Blaxel sandbox backend for eve agents

原始使用文档
文档目录11 节
  1. Quick start
  2. 1. Install the backend
  3. 2. Authenticate with Blaxel
  4. 3. Select Blaxel in eve
  5. What works
  6. Generally available capability scope
  7. Lifecycle
  8. Network policy
  9. Options
  10. Compatibility
  11. Cleanup

@blaxel/eve-sandbox

Blaxel sandbox backend for eve.

Run eve's built-in shell and file tools in secure, durable Blaxel sandboxes. Each durable eve session reconnects to the same sandbox after an application restart without relying on preview-only Blaxel APIs.

Quick start

You need Node.js 24 or later and an existing eve project.

1. Install the backend

npm install @blaxel/eve-sandbox

The package expects the eve and ai versions already installed by your eve project.

2. Authenticate with Blaxel

For local development, sign in with the Blaxel CLI:

bl login YOUR-WORKSPACE

In CI and production, provide BL_WORKSPACE and BL_API_KEY to the application runtime. Do not copy those credentials into the sandbox.

3. Select Blaxel in eve

// agent/sandbox.ts
import { blaxel } from "@blaxel/eve-sandbox";
import { defineSandbox } from "eve/sandbox";

export default defineSandbox({
  backend: blaxel({
    image: "blaxel/ts-app:latest",
    lifecycle: {
      expirationPolicies: [{ type: "ttl-idle", value: "1d", action: "delete" }],
    },
    memory: 4096,
  }),
  async onSession({ use }) {
    const sandbox = await use({
      networkPolicy: { allow: ["github.com", "*.npmjs.org"] },
    });
    await sandbox.run({ command: "mkdir -p /workspace/project" });
  },
});

Start eve as usual:

npm run dev

The built-in bash, read_file, write_file, glob, and grep tools now operate inside the Blaxel sandbox. To smoke-test the setup in eve's terminal UI, ask the agent to create /workspace/hello.txt and read it back.

A copy-ready sandbox definition is available in examples/agent/sandbox.ts.

What works

  • All five built-in eve sandbox tools
  • Blocking commands and streaming background processes
  • Text, binary, and streaming file operations
  • Durable filesystem and process state across turns and app restarts
  • Custom Blaxel images, regions, resources, volumes, environment variables, and lifecycle policies
  • Per-session setup through onSession()
  • Domain egress policies and secret-backed header transforms
  • Deterministic reconnection through eve's captured session metadata

Generally available capability scope

The backend intentionally uses only generally available Blaxel sandbox APIs. It does not call Blaxel snapshot or fork APIs.

eve's bootstrap() hook and files under agent/sandbox/workspace require a backend to clone a build-time template. This backend does not implement template prewarming. If either feature is configured, it fails with actionable guidance before serving traffic.

Put reusable system dependencies and base files in a custom Blaxel image. Put setup that must run once for each durable eve session in onSession().

Lifecycle

  • create() reconnects a saved sandbox by name or creates a new sandbox from the configured image.
  • onSession() performs one-time setup for a new durable eve session.
  • Session names include the backend configuration identity, so a changed sandbox definition gets a new sandbox.
  • captureState() persists the Blaxel sandbox name in eve's durable session state.
  • shutdown() closes active log streams. Blaxel then moves the idle sandbox into standby while preserving memory, processes, and files.

Session discovery uses Blaxel resources and does not depend on an in-process registry.

Network policy

The backend supports:

  • "allow-all"
  • "deny-all"
  • Domain allow-lists
  • eve header transforms through Blaxel's secret-backed egress proxy

The backend rejects subnet rules, request match conditions, and forwardURL. It does not silently weaken unsupported policies.

The default is "allow-all". For production or untrusted workloads, select "deny-all" or an explicit allow-list before the first command runs.

Options

blaxel() accepts standard SandboxCreateConfiguration fields such as image, memory, region, ports, envs, volumes, ttl, lifecycle, and labels.

OptionPurposeDefault
backendNameStable eve backend identifierblaxel
namePrefixPrefix for deterministic Blaxel resourceseve
networkPolicyEgress policy applied when a session sandbox is created"allow-all"
processOutputBufferBytesMaximum unread stdout or stderr per process stream1 MiB
startupTimeoutMsMaximum cold-image readiness wait60 seconds

Compatibility

PackageeveAI SDKNode.jsDefault image
@blaxel/eve-sandbox 0.2.x0.31.3 to less than 0.327.0.38 to less than 824 or laterblaxel/ts-app:latest

Each release must pass the adapter contract suite and a live eve agent evaluation against its declared range. A new eve minor requires a tested peer-range update.

Cleanup

Blaxel sandboxes remain durable until their configured lifecycle removes them. Set lifecycle or ttl when the application requires automatic deletion of inactive sessions.

版本与发布记录

@blaxel/eve-sandbox 共发布 93 个版本,首次发布于 2026/08/11;过去 12 个月发布了 93 个版本。

版本发布日期距今
0.3.37latest2026/11/11今天
0.3.37-preview.356preview2026/11/11今天
0.3.37-preview.3532026/11/101 天前
0.3.37-preview.3542026/11/101 天前
0.3.37-preview.3552026/11/101 天前
0.3.37-preview.3522026/11/101 天前

其他发布通道:dev → 0.3.18-dev.283,preview → 0.3.37-preview.356。

关于 @blaxel/eve-sandbox 的常见问题

@blaxel/eve-sandbox 是什么?

Durable Blaxel sandbox backend for eve agents

如何安装 @blaxel/eve-sandbox?

在项目目录运行 npm install @blaxel/eve-sandbox,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:ai(^7.0.38)、eve(^0.31.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@blaxel/eve-sandbox 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@blaxel/eve-sandbox 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@blaxel/eve-sandbox 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@blaxel/eve-sandbox 可以商用吗?

@blaxel/eve-sandbox 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blaxel/eve-sandbox 的下载量有多少?

根据 npm 官方下载统计,@blaxel/eve-sandbox 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,926 次,日均约 131 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blaxel/eve-sandbox 还在维护吗?

最新版本 0.3.37 发布于 2026/11/11(今天);至今共发布 93 个版本,其中过去 12 个月发布了 93 个;首次发布于 2026/08/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。