For agents
@agentskit/sandbox — for agents
Secure code execution (E2B / WebContainer) + mandatory sandbox policy wrapper.
Install
npm install @agentskit/sandboxPrimary exports
createSandbox(config?)— spawn a sandbox; default backend probes E2B.sandboxTool()— ready-madecode_executiontool (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))Related
- @agentskit/tools — tools to wrap.
- @agentskit/core/hitl — human approvals on top.