AI agents need environments to execute in – places to run code, browse the web, edit files, and interact with tools. Building these environments from scratch for each agent platform is tedious and error-prone. Agent Sandbox solves this by providing a complete, pre-configured Docker sandbox that combines a browser, shell, file system, MCP server, and VSCode Server in a single containerized workspace.
Developed by agent-infra, Agent Sandbox is designed as the execution environment for AI agents that need to perform real-world tasks. Instead of cobbling together separate tools for browser automation, code execution, and file management, developers get a unified sandbox with all of these capabilities pre-integrated and ready to use.
The sandbox runs as a Docker container with strong isolation guarantees. Agents interact with it through a clean REST API or through official SDKs for Python and TypeScript, making it easy to integrate into existing agent platforms like Claude Code, OpenAI Operators, or custom agent frameworks.
What Components Does Agent Sandbox Include?
The sandbox combines multiple tools in a single container, each serving a different aspect of an agent’s task execution needs.
graph TD
A[Agent Sandbox Container] --> B[Chromium Browser]
A --> C[Shell Environment]
A --> D[File System]
A --> E[MCP Server]
A --> F[VSCode Server]
B --> G[Web browsing / Automation]
B --> H[Screenshots / DOM access]
C --> I[Command execution]
C --> J[Script running]
D --> K[Read / Write files]
D --> K[Project workspace]
E --> L[Tool access via MCP]
F --> M[Web-based code editing]
| Component | Purpose | How Agents Use It |
|---|---|---|
| Chromium Browser | Web browsing and automation | Navigate, click, screenshot, extract DOM |
| Shell Environment | Command execution | Run scripts, install packages, execute tools |
| File System | Persistent storage | Read/write project files, store outputs |
| MCP Server | Tool protocol | Expose sandbox tools via Model Context Protocol |
| VSCode Server | Web IDE | Human-in-the-loop code review and editing |
What SDKs Does Agent Sandbox Provide?
The sandbox offers multiple integration paths depending on your agent platform and programming language preferences.
| SDK / Interface | Language | Key Methods | Use Case |
|---|---|---|---|
| Python SDK | Python | Sandbox(), .run(), .browse(), .write() | Python-based agent frameworks |
| TypeScript SDK | TypeScript | Sandbox.create(), .execute(), .screenshot() | Node.js agent platforms |
| MCP Interface | Any MCP client | Tool discovery via MCP | Anthropic Claude, OpenAI, custom agents |
| REST API | Any HTTP client | POST /sandbox, GET /status | Direct HTTP integration |
The Python SDK is the most mature, offering methods for all sandbox operations including browser interaction, shell commands, file operations, and VSCode Server management.
How Do You Start Using Agent Sandbox?
Getting started requires Docker and a single SDK installation.
graph LR
A[Install Docker] --> B[pip install agent-sandbox]
B --> C[from agent_sandbox import Sandbox]
C --> D[sandbox = Sandbox.create()]
D --> E[sandbox.run('python script.py')]
D --> F[screenshot = sandbox.browser.screenshot()]
D --> G[sandbox.mcp.connect()]
| Step | Action | Command |
|---|---|---|
| 1 | Install Docker | Follow Docker installation guide |
| 2 | Install SDK | pip install agent-sandbox or npm install agent-sandbox |
| 3 | Create sandbox | sandbox = Sandbox.create() |
| 4 | Execute tasks | result = sandbox.run("curl https://api.example.com") |
| 5 | Browse web | screenshot = sandbox.browser.screenshot("https://example.com") |
| 6 | Clean up | sandbox.close() |
FAQ
What is Agent Sandbox? Agent Sandbox is an all-in-one Docker sandbox developed by agent-infra that provides a complete execution environment for AI agents, combining a browser, shell, file system, MCP server, and VSCode Server in a single containerized workspace.
What features does Agent Sandbox include? Agent Sandbox includes a Chromium browser with remote debugging, a shell environment, persistent file system, MCP server integration for tool access, VSCode Server for web-based code editing, and network controls. All components are pre-configured to work together in a secure, isolated Docker environment.
What SDKs are available for Agent Sandbox? Agent Sandbox provides official SDKs for Python and TypeScript, plus an MCP interface for agent platforms that support the Model Context Protocol. The SDKs handle container lifecycle management, tool calls through the sandbox API, and result collection.
How do I get started with Agent Sandbox?
Quick start: clone the repository, run pip install agent-sandbox or npm install agent-sandbox, then create a sandbox instance with a single API call. The Docker image is automatically pulled on first use, and the sandbox starts in seconds.
How secure is Agent Sandbox? Agent Sandbox provides strong security isolation through Docker containerization. Each sandbox runs in an isolated container with no network access by default, no access to the host file system, limited resource allocation, and an ephemeral file system that is destroyed when the sandbox is closed.
Further Reading
- Agent Sandbox GitHub Repository – Source code, documentation, and examples
- Agent Sandbox Documentation – Full API reference and deployment guide
- Docker Container Security Best Practices – Official Docker security documentation
- Model Context Protocol Specification – MCP standard for agent-tool communication
- Building AI Agent Execution Environments – Research on secure agent execution
無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分!