Agent-Sandbox MCP
A self-hosted agent code sandbox on Kubernetes: REST API, MCP server, E2B compatibility and skills for managing it.
- 230 ★ on the repository
- Last commit
- Apache-2.0
Broad access
Why this level
- The agent runs arbitrary generated code, a browser and a desktop in sandboxes, and `ai-deploy` publishes sites under public addresses.
- The install adds a service with access to Kubernetes objects to the cluster.
- The README shows an example key and a default admin token; do not expose the instance until you have checked them.
Install
- Works in
Manual install
kubectl create namespace agent-sandbox
kubectl apply -nagent-sandbox -f install.yamlInstall into Kubernetes 1.28 or newer. Then create an ingress or `port-forward` to the API server.
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The agent runs arbitrary generated code, a browser and a desktop in sandboxes, and `ai-deploy` publishes sites under public addresses.
- The install adds a service with access to Kubernetes objects to the cluster.
- The README shows an example key and a default admin token; do not expose the instance until you have checked them.
This is third-party code. Review the repository files before installing.
What it does
Agent-Sandbox is a self-hosted sandbox runtime for AI agents. It installs on Kubernetes 1.28 or newer with one `kubectl apply -f install.yaml` and keeps its state in Kubernetes objects: no database, no queue, no CRDs. An agent creates a sandbox for Python and JavaScript code, a browser or a desktop (VNC), lists sandboxes, gets their tool schemas and runs the tools inside. A built-in MCP server does this: `createSandbox`, `getSandbox`, `listSandbox`, `deleteSandbox` and `sandboxExecutor`. The same API is compatible with the E2B protocol, so E2B SDKs and the CLI work. It offers a pre-warmed sandbox pool, pause and resume, snapshots and scale-to-zero on idle. The `skills/` folder has `e2b`, `e2b-sandbox`, `e2b-code-interpreter` and `ai-deploy`, which deploys a generated project into sandboxes with idle auto-pause.
Who it is for. Agent builders and platform teams with a Kubernetes cluster who need isolated sandboxes for code, browser and desktop without `kubectl` on the agent side.
Good fit when
- An agent runs generated code and must do so isolated from other users.
- You want a self-hosted replacement for cloud E2B with the same SDKs.
- An agent needs a browser or a VNC desktop to check an interface.
- A generated site must be put under a public address and paused when idle (`ai-deploy`).
Not a fit when
- There is no Kubernetes 1.28 or newer cluster.
- You want a sandbox on a single laptop without a cluster.
- The instance will be reachable from outside without changing the default token.
Example request
Create a sandbox from the sandbox-base-node template, run `npx serve -l 8008` in it and return the address.MCP
- Transport
- http
- Authentication
- key is optional
Environment variables
`E2B_API_KEY`secret- Key for the E2B-compatible API; needed by the E2B SDK.
`E2B_DOMAIN`- Domain of your Agent-Sandbox instance for the E2B SDK.
`E2B_API_URL`- Address of the instance's E2B-compatible API, for example `http://host/e2b/v1`.
Limitations
A Kubernetes 1.28 or newer cluster is required, plus access to the Agent-Sandbox API server through an ingress or `port-forward`. State lives in Kubernetes objects (ConfigMap, ReplicaSet, Lease). The E2B SDK needs `E2B_API_KEY`, `E2B_DOMAIN` and `E2B_API_URL`. The README shows an example key and a default admin token for the web interface, so do not expose the instance externally before checking which tokens are active. See the project documentation for authentication details and the MCP server address.
How to disable. Delete the sandboxes, the resources from `install.yaml` and the `agent-sandbox` namespace. Remove the MCP entry in the client.
FAQ
How do I install Agent-Sandbox?
Run `kubectl create namespace agent-sandbox`, then `kubectl apply -nagent-sandbox -f install.yaml`. Kubernetes 1.28 or newer is required.
Which tools does the agent see over MCP?
`createSandbox`, `getSandbox`, `listSandbox`, `deleteSandbox` and `sandboxExecutor`. `createSandbox` and `getSandbox` return the tool schema of a specific sandbox.
Do E2B SDKs work?
Yes. The E2B protocol and SDKs are fully supported; set `E2B_API_KEY`, `E2B_DOMAIN` and `E2B_API_URL`.
Where do I manage sandboxes manually?
In the built-in web UI at `http://agent-sandbox.your-host.com/ui`, which shows sandboxes, templates and pools.
Is a separate database needed?
No. Templates, blueprints and sandbox state are stored as Kubernetes objects: ConfigMap, ReplicaSet and Lease.
Discussion
No questions or reviews yet.
Related
MCP serversA Rust sandbox for parallel coding agents: each gets its own workspace over one shared project, and changes publish as one set.
Isolated Linux microVMs for agent code: the official Vercel skill on the SDK, network rules and snapshots.
A Docker sandbox for coding agents: a Debian image with Copilot CLI, Codex and Pi, and SSH, RDP and Docker enabled by flags.
Containarium: isolated boxes for AI agents
Containarium
A platform on your own server that gives each agent its own Linux box with SSH and MCP tools for commands and files
AgentBox runs Claude Code, Codex and Open Code in separate virtual machines on your PC, a self-hosted server or a cloud.
AWS's official set of MCP servers, skills and plugins so an agent can build, deploy and operate on AWS
README in short
The project wraps the kubernetes-sigs/agent-sandbox foundation with AIO Sandbox behind a REST API and an MCP server. Two live-editable layers, Blueprint and Template, define how sandboxes deploy and which types exist, with no redeploy.