|
| 1 | +<div align="center"> |
| 2 | +<a href="https://voltagent.dev/"> |
| 3 | +<img width="1500" height="276" alt="voltagent" src="https://github.com/user-attachments/assets/d9ad69bd-b905-42a3-81af-99a0581348c0" /> |
| 4 | +</a> |
| 5 | + |
| 6 | +<h3 align="center"> |
| 7 | +AI Agent Engineering Platform |
| 8 | +</h3> |
| 9 | + |
| 10 | +<div align="center"> |
| 11 | + <a href="https://voltagent.dev">Home Page</a> | |
| 12 | + <a href="https://voltagent.dev/docs/">Documentation</a> | |
| 13 | + <a href="https://github.com/voltagent/voltagent/tree/main/examples">Examples</a> |
| 14 | +</div> |
| 15 | +</div> |
| 16 | + |
| 17 | +<br/> |
| 18 | + |
| 19 | +<div align="center"> |
| 20 | + |
| 21 | +[](https://github.com/voltagent/voltagent/issues) |
| 22 | +[](https://github.com/voltagent/voltagent/pulls) |
| 23 | +[](https://opensource.org/licenses/MIT) |
| 24 | +[](https://www.npmjs.com/package/@voltagent/sandbox-blaxel) |
| 25 | +[](https://www.npmjs.com/package/@voltagent/sandbox-blaxel) |
| 26 | +[](https://s.voltagent.dev/discord) |
| 27 | + |
| 28 | +</div> |
| 29 | + |
| 30 | +## @voltagent/sandbox-blaxel |
| 31 | + |
| 32 | +A [Blaxel](https://www.blaxel.ai/) sandbox provider for VoltAgent's [Workspace](https://voltagent.dev/docs/) sandbox feature. `BlaxelSandbox` implements VoltAgent's `WorkspaceSandbox` contract, letting agents execute shell commands inside an isolated Blaxel sandbox instead of the local machine. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Install |
| 37 | + |
| 38 | +```bash |
| 39 | +npm install @voltagent/sandbox-blaxel |
| 40 | +# or |
| 41 | +yarn add @voltagent/sandbox-blaxel |
| 42 | +# or |
| 43 | +pnpm add @voltagent/sandbox-blaxel |
| 44 | +``` |
| 45 | + |
| 46 | +## Usage |
| 47 | + |
| 48 | +```typescript |
| 49 | +import { Agent, Workspace } from "@voltagent/core"; |
| 50 | +import { BlaxelSandbox } from "@voltagent/sandbox-blaxel"; |
| 51 | +import { openai } from "@ai-sdk/openai"; |
| 52 | + |
| 53 | +const sandbox = new BlaxelSandbox({ |
| 54 | + apiKey: process.env.BL_API_KEY, |
| 55 | + workspace: process.env.BL_WORKSPACE, |
| 56 | +}); |
| 57 | + |
| 58 | +const agent = new Agent({ |
| 59 | + name: "my-agent", |
| 60 | + instructions: "A helpful assistant with sandboxed shell access", |
| 61 | + model: openai("gpt-4o-mini"), |
| 62 | + workspace: new Workspace({ sandbox }), |
| 63 | +}); |
| 64 | +``` |
| 65 | + |
| 66 | +## Configuration |
| 67 | + |
| 68 | +`BlaxelSandboxOptions`: |
| 69 | + |
| 70 | +| Option | Type | Description | |
| 71 | +| ----------- | ----------------------- | ------------------------------------------------------------------------------------------------ | |
| 72 | +| `apiKey` | `string` | Blaxel API key. Written to `process.env.BL_API_KEY` (the only auth path the Blaxel SDK supports) | |
| 73 | +| `workspace` | `string` | Blaxel workspace ID. Written to `process.env.BL_WORKSPACE` | |
| 74 | +| `config` | `BlaxelSandboxConfig` | Sandbox provisioning options plus VoltAgent `execute()` defaults (see below) | |
| 75 | +| `sandbox` | `BlaxelSandboxInstance` | Pre-resolved Blaxel SDK sandbox instance to reuse instead of provisioning a new one | |
| 76 | + |
| 77 | +`BlaxelSandboxConfig` (extends Blaxel's `SandboxCreateConfiguration`) adds: |
| 78 | + |
| 79 | +| Option | Type | Default | Description | |
| 80 | +| ------------------ | -------- | ------------------------- | -------------------------------------------------------------------------------- | |
| 81 | +| `cwd` | `string` | — | Default working directory for `execute()`; per-call `cwd` overrides it | |
| 82 | +| `defaultTimeoutMs` | `number` | `60000` | Default command timeout; per-call `timeoutMs` overrides it; `0` disables it | |
| 83 | +| `maxOutputBytes` | `number` | `5 * 1024 * 1024` (5 MiB) | Max stdout/stderr bytes kept per stream before truncation; `0` skips log fetches | |
| 84 | +| `pollIntervalMs` | `number` | `250` | Polling interval for waiting on command completion | |
| 85 | + |
| 86 | +> **Auth note:** credentials resolve through a module-level singleton in the Blaxel SDK — constructing multiple `BlaxelSandbox` instances with different credentials in the same process will last-write-win. See the [Blaxel sandbox authentication docs](https://docs.blaxel.ai/Sandboxes/Overview#learn-more-about-authentication-on-blaxel). |
| 87 | +
|
| 88 | +## Documentation |
| 89 | + |
| 90 | +- [VoltAgent Documentation](https://voltagent.dev/docs/) |
| 91 | +- [Blaxel Documentation](https://docs.blaxel.ai/) |
| 92 | + |
| 93 | +## License |
| 94 | + |
| 95 | +Licensed under the MIT License, Copyright © 2026-present VoltAgent. |
0 commit comments