@agentskit/sandbox
v0.3.5
Published
Secure code execution for AgentsKit agents.
Downloads
680
Maintainers
Readme
@agentskit/sandbox
Let agents write and run code safely — in isolated cloud VMs, not on your machine.
Tags: ai · agents · llm · agentskit · ai-agents · sandbox · code-execution · e2b · secure-execution · code-interpreter
Why sandbox
- Code generation that actually executes — agents can write, run, and iterate on code without you worrying about what they'll do to your filesystem or OS
- E2B cloud VMs out of the box — each execution runs in an isolated environment with configurable timeouts, no network by default, and a 50MB memory cap
- Bring your own backend — the
SandboxBackendinterface is 2 methods; plug in Docker, Firecracker, or any custom isolation layer - Works alongside any other tools — add
sandboxToolto the sametoolsarray aswebSearchorfilesystem; no special wiring needed
Install
npm install @agentskit/sandbox @e2b/code-interpreterQuick example
import { createRuntime } from '@agentskit/runtime'
import { anthropic } from '@agentskit/adapters'
import { sandboxTool } from '@agentskit/sandbox'
const runtime = createRuntime({
adapter: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, model: 'claude-sonnet-4-6' }),
tools: [sandboxTool({ apiKey: process.env.E2B_API_KEY })],
})
const result = await runtime.run('Write and run a Python script that generates a Fibonacci sequence up to 100')
console.log(result.content)Features
sandboxTool({ apiKey })— drop-in tool for code execution via E2B cloud VMs- Configurable timeouts and resource limits
- No network by default — agents cannot exfiltrate data
SandboxBackendinterface — 2 methods to bring Docker, Firecracker, or any custom backend- Follows
ToolDefinitioncontract — works inruntime,useChat, or any custom loop
Ecosystem
| Package | Role |
|---------|------|
| @agentskit/runtime | createRuntime({ tools }) |
| @agentskit/tools | code tool can delegate to sandbox |
| @agentskit/adapters | LLM for codegen tasks |
| @agentskit/core | Tool contract |
Contributors
License
MIT — see LICENSE.
