agentskit.js
For agents

@agentskit/sandbox — for agents

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

Install

npm install @agentskit/sandbox

Primary exports

  • createSandbox(config?) — spawn a sandbox; default backend probes E2B.
  • sandboxTool() — ready-made code_execution tool (js / python).
  • createE2BBackend(config) — bring your own E2B API key.
  • Types: Sandbox, SandboxConfig, SandboxBackend, ExecuteOptions, ExecuteResult.

Policy wrapper

  • createMandatorySandbox({ sandbox, policy }) — enforce allow / deny / requireSandbox / validators across every tool. See Mandatory sandbox.

Minimal example

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))

Source

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

On this page