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/sandboxHello 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-madecode_executiontool (js / python).createE2BBackend(config)— BYO E2B.createMandatorySandbox({ sandbox, policy }).
Recipes
Related
- Security
- For agents: sandbox
- Tools — tools to wrap.
Source
npm: @agentskit/sandbox · repo: packages/sandbox