@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-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.
#Source
- npm: https://www.npmjs.com/package/@agentskit/sandbox
- repo: https://github.com/AgentsKit-io/agentskit/tree/main/packages/sandbox
Explore nearby
- PeerFor agents — overview
Dense, LLM-friendly reference for every AgentsKit package. Designed to paste into an agent's context window.
- Peer@agentskit/core — for agents
Zero-dependency foundation. Contracts, chat controller, primitives, and a dozen feature subpaths.
- Peer@agentskit/adapters — for agents
Provider adapters (OpenAI-compatible + native) + router + ensemble + fallback + generic factory.