@agentskit/sandbox
Secure code execution (E2B / WebContainer) + mandatory-sandbox policy wrapper.
@agentskit/sandbox is the package for the moment when your agent needs to execute code or touch risky tools and “please be careful” is no longer enough. It adds a policy layer between the model and dangerous capabilities.
#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).
#Best fit
- Add this before enabling shell, code execution, or broad filesystem access.
- Pair with
@agentskit/toolsto wrap risky tool surfaces. - Pair with
@agentskit/runtimewhen autonomous agents can take meaningful actions. - Pair with production security guidance before public rollout.
#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))This is one of the clearest boundaries between a capable agent demo and a production-safe agent system.
#Surface
createSandbox(config?)— default backend probes E2B.sandboxTool()— ready-madecode_executiontool (js / python).createE2BBackend(config)— BYO E2B.createMandatorySandbox({ sandbox, policy }).
#Recipes
#Stability
- Version:
0.3.1 - Tier: alpha
- Contract: evolving
- Roadmap: see packages roadmap for what this package needs to reach v1.0.
#Related
- Security
- Shipping checklist
- For agents: sandbox
- Tools — tools to wrap.
#Source
npm: @agentskit/sandbox · repo: packages/sandbox
Explore nearby
- PeerPackages overview
Every AgentsKit package at a glance — what it does, when to reach for it, where to read the deep dive.
- PeerRoadmap
Per-package stability status, current version, and what each package needs to reach v1.0.
- Peer@agentskit/core
Shared contract layer — TypeScript types, headless chat controller, stream helpers. Zero-dep, under 10 KB gzipped.