agentskit.js
Packages

@agentskit/sandbox

Secure code execution (E2B / WebContainer) + mandatory-sandbox policy wrapper.

When to reach for it

  • You want the model to run code safely.
  • You want a policy layer over every tool (allow / deny / require-sandbox / validators).

Install

npm install @agentskit/sandbox

Hello world

import { sandboxTool, createMandatorySandbox } from '@agentskit/sandbox'
import { shell, filesystem, webSearch } from '@agentskit/tools'

const policy = createMandatorySandbox({
  sandbox: sandboxTool(),
  policy: { requireSandbox: ['shell'], deny: ['filesystem'] },
})
const safeTools = [shell(), filesystem({ basePath }), webSearch()].map(t => policy.wrap(t))

Surface

  • createSandbox(config?) — default backend probes E2B.
  • sandboxTool() — ready-made code_execution tool (js / python).
  • createE2BBackend(config) — BYO E2B.
  • createMandatorySandbox({ sandbox, policy }).

Recipes

Source

npm: @agentskit/sandbox · repo: packages/sandbox

✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page