Sandbox
@agent-infra/sandbox

All-in-one sandbox for agent browser, shell, and file work

AIO Sandbox combines browser, shell, file, VS Code, Jupyter, and MCP access in a single Docker container. Agents can use the shared filesystem and the built-in APIs to move between browsing, code execution, and file editing without switching environments.

5,885 starsโ€ข524 forksโ€ขPythonโ€ขUpdated 6d ago
Who it's for

Builders who want one local or containerized workspace for agent browsing, command running, file edits, and tool use.

What it delivers

You can give an agent one shared environment for browsing, coding, and file handling instead of stitching tools together.

What it does

Shared sandbox environment

Runs browser, shell, file, MCP, and VS Code Server in one container with a shared filesystem.

Browser access

Supports browser work through VNC, CDP, and MCP tools for navigation, clicking, typing, scrolling, and screenshots.

Development interfaces

Includes VS Code Server, Jupyter Notebook, a terminal, and port forwarding for web app previews.

Preconfigured MCP servers

Provides browser, file, shell, and markitdown MCP servers ready to connect to an agent.

SDKs and examples

Offers Python, JavaScript, and Go SDKs plus example integrations for browser-use, LangChain, OpenAI, and others.

How to get it

  1. 1For users in mainland China
    docker run --security-opt seccomp=unconfined --rm -it \
      -e SANDBOX_API_KEY=your-secret-key \
      -p 127.0.0.1:8080:8080 enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:1.11.0
  2. 2For reproducible deployments, pin a release tag. Replace 1.11.0 with the release you want
    docker run --security-opt seccomp=unconfined --rm -it \
      -p 127.0.0.1:8080:8080 ghcr.io/agent-infra/sandbox:1.11.0
    # or use the pinned mainland China mirror
    docker run --security-opt seccomp=unconfined --rm -it \
      -p 127.0.0.1:8080:8080 enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:1.11.0
  3. 3Python
    pip install agent-sandbox
  4. 4TypeScript/JavaScript
    npm install @agent-infra/sandbox
  5. 5Golang
    go get github.com/agent-infra/sandbox-sdk-go

README

AIO Sandbox - All-in-One Agent Sandbox Environment

logo

๐ŸŒ Browser | ๐Ÿ’ป Terminal | ๐Ÿ“ File | ๐Ÿ”ง VSCode | ๐Ÿ“Š Jupyter | ๐Ÿค– MCP

๐ŸŒ Websiteย ย  | ย ย ๐Ÿ”Œ APIย ย  | ย ย ๐Ÿ“‘ Paperย ย  | ย ย ๐ŸŒŸ Examplesย ย  | ย ย ๐Ÿ“Š Evaluation ย ย 

Release License PyPI npm

๐Ÿš€ Quick Start

Get up and running in 30 seconds:

# Recommended: Enable API Key authentication (protects all services: API, JupyterLab, VNC)
# - Supports three methods: X-AIO-API-Key header, Authorization: Bearer header, ?api_key= query parameter
# - Without SANDBOX_API_KEY, services remain open (backward compatible)
docker run --security-opt seccomp=unconfined --rm -it \
  -e SANDBOX_API_KEY=your-secret-key \
  -p 127.0.0.1:8080:8080 ghcr.io/agent-infra/sandbox:latest

For users in mainland China:

docker run --security-opt seccomp=unconfined --rm -it \
  -e SANDBOX_API_KEY=your-secret-key \
  -p 127.0.0.1:8080:8080 enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:1.11.0

For reproducible deployments, pin a release tag. Replace 1.11.0 with the release you want:

docker run --security-opt seccomp=unconfined --rm -it \
  -p 127.0.0.1:8080:8080 ghcr.io/agent-infra/sandbox:1.11.0
# or use the pinned mainland China mirror
docker run --security-opt seccomp=unconfined --rm -it \
  -p 127.0.0.1:8080:8080 enterprise-public-cn-beijing.cr.volces.com/vefaas-public/all-in-one-sandbox:1.11.0

These examples intentionally bind the host side to 127.0.0.1 because the sandbox listens on 0.0.0.0 inside the container. For cloud deployment, keep port 8080 private and publish it through a reverse proxy or Ingress: Cloud Deployment Guide.

Once running, access the environment at:

๐ŸŽฏ What is AIO Sandbox?

AIO Sandbox is an all-in-one agent sandbox environment that combines Browser, Shell, File, MCP operations, and VSCode Server in a single Docker container. Built on cloud-native lightweight sandbox technology, it provides a unified, secure execution environment for AI agents and developers.

AIO Sandbox Architecture

Why Choose AIO Sandbox?

Traditional sandboxes are single-purpose (browser, code, or shell), making file sharing and functional coordination extremely challenging. AIO Sandbox solves this by providing:

  • โœ… Unified File System - Files downloaded in browser are instantly available in Shell/File operations
  • โœ… Multiple Interfaces - VNC, VSCode, Jupyter, and Terminal in one unified environment
  • โœ… Secure Execution - Sandboxed Python and Node.js execution with safety guarantees
  • โœ… Zero Configuration - Pre-configured MCP servers and development tools ready to use
  • โœ… Agent-Ready - MCP-compatible APIs for seamless AI agent integration

๐Ÿ“ฆ Installation

SDK Installation

Python

pip install agent-sandbox

TypeScript/JavaScript

npm install @agent-infra/sandbox

Golang

go get github.com/agent-infra/sandbox-sdk-go

Basic Usage

Python Example

from agent_sandbox import Sandbox

# Initialize client
client = Sandbox(base_url="http://localhost:8080")
home_dir = client.sandbox.get_context().home_dir

# Execute shell commands
result = client.shell.exec_command(command="ls -la")
print(result.data.output)

# File operations
content = client.file.read_file(file=f"{home_dir}/.bashrc")
print(content.data.content)

# Browser automation
screenshot = client.browser.screenshot()

TypeScript Example

import { Sandbox } from '@agent-infra/sandbox';

// Initialize client
const sandbox = new Sandbox({ baseURL: 'http://localhost:8080' });

// Execute shell commands
const result = await sandbox.shell.exec({ command: 'ls -la' });
console.log(result.output);

// File operations
const content = await sandbox.file.read({ path: '/home/gem/.bashrc' });
console.log(content);

// Browser automation
const screenshot = await sandbox.browser.screenshot();

๐ŸŒŸ Key Features

๐Ÿ”— Unified Environment

All components run in the same container with a shared filesystem, enabling seamless workflows:

Unified Environment

๐ŸŒ Browser Automation

Full browser control through multiple interfaces:

  • VNC - Visual browser interaction through remote desktop
  • CDP - Chrome DevTools Protocol for programmatic control
  • MCP - High-level browser automation tools

Browser Automation

๐Ÿ’ป Development Tools

Integrated development environment with:

  • VSCode Server - Full IDE experience in browser
  • Jupyter Notebook - Interactive Python environment
  • Terminal - WebSocket-based terminal access
  • Port Forwarding - Smart preview for web applications

VSCode Server

๐Ÿค– MCP Integration

Pre-configured Model Context Protocol servers:

  • Browser - Web automation and scraping
  • File - File system operations
  • Shell - Command execution
  • Markitdown - Document processing

MCP Integration

๐Ÿ“š Complete Example

Convert a webpage to Markdown with embedded screenshot:

import asyncio
import base64
from playwright.async_api import async_playwright
from agent_sandbox import Sandbox

async def site_to_markdown():
    # Initialize sandbox client
    c = Sandbox(base_url="http://localhost:8080")
    home_dir = c.sandbox.get_context().home_dir

    # Browser: Automation to download HTML
    async with async_playwright() as p:
        browser_info = c.browser.get_info().data
        page = await (await p.chromium.connect_over_cdp(browser_info.cdp_url)).new_page()
        await page.goto("https://example.com", wait_until="networkidle")
        html = await page.content()
        screenshot_b64 = base64.b64encode(await page.screenshot()).decode('utf-8')

    # Jupyter: Convert HTML to markdown in sandbox
    c.jupyter.execute_code(code=f"""
from markdownify import markdownify
html = '''{html}'''
screenshot_b64 = "{screenshot_b64}"

md = f"{{markdownify(html)}}\\n\\n![Screenshot](data:image/png;base64,{{screenshot_b64}})"
with open('{home_dir}/site.md', 'w') as f:
    f.write(md)
print("Done!")
""")

    # Shell: List files in sandbox
    list_result = c.shell.exec_command(command=f"ls -lh {home_dir}")
    print(f"Files in sandbox: {list_result.data.output}")

    # File: Read the generated markdown
    return c.file.read_file(file=f"{home_dir}/site.md").data.content

if __name__ == "__main__":
    result = asyncio.run(site_to_markdown())
    print(f"Markdown saved successfully!")

Example Output

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐ŸŒ Browser + VNC                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐Ÿ’ป VSCode Server  โ”‚  ๐Ÿš Shell Terminal  โ”‚  ๐Ÿ“ File Ops   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚              ๐Ÿ”— MCP Hub + ๐Ÿ”’ Sandbox Fusion               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚         ๐Ÿš€ Preview Proxy + ๐Ÿ“Š Service Monitoring          โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ API Reference

Core APIs

EndpointDescription
/v1/sandboxGet sandbox environment information
/v1/shell/execExecute shell commands
/v1/file/readRead file contents
/v1/file/writeWrite file contents
/v1/browser/screenshotTake browser screenshot
/v1/jupyter/executeExecute Jupyter code

MCP Servers

ServerTools Available
browsernavigate, screenshot, click, type, scroll
fileread, write, list, search, replace
shellexec, create_session, kill
markitdownconvert, extract_text, extract_images

๐Ÿšข Deployment

Docker Compose

services:
  sandbox:
    container_name: aio-sandbox
    image: ghcr.io/agent-infra/sandbox:latest
    security_opt:
      - seccomp:unconfined
    ports:
      - "127.0.0.1:${HOST_PORT:-8080}:8080"
    volumes:
      - sandbox_data:/home/gem/workspace
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: "unless-stopped"
    shm_size: "2gb"
    environment:
      SANDBOX_API_KEY: ${SANDBOX_API_KEY:-}
      PROXY_SERVER: ${PROXY_SERVER:-}
      WORKSPACE: ${WORKSPACE:-/home/gem/workspace}
      TZ: ${TZ:-Asia/Singapore}

volumes:
  sandbox_data:

Kubernetes

apiVersion: apps/v1
kind: Deployment
metadata:
  name: aio-sandbox
spec:
  replicas: 2
  selector:
    matchLabels:
      app: aio-sandbox
  template:
    metadata:
      labels:
        app: aio-sandbox
    spec:
      containers:
      - name: aio-sandbox
        image: ghcr.io/agent-infra/sandbox:latest
        ports:
        - containerPort: 8080
        resources:
          limits:
            memory: "2Gi"
            cpu: "1000m"

๐Ÿค Integration Examples

Browser Use Integration

import asyncio

from agent_sandbox import Sandbox
from browser_use import Agent, Tools
from browser_use.browser import BrowserProfile, BrowserSession
from browser_use.llm import ChatOpenAI

sandbox = Sandbox(base_url="http://localhost:8080")
print("sandbox", sandbox.browser)
cdp_url = sandbox.browser.get_info().data.cdp_url

browser_session = BrowserSession(
    browser_profile=BrowserProfile(cdp_url=cdp_url, is_local=True)
)
tools = Tools()


async def main():
    agent = Agent(
        task='Visit https://duckduckgo.com and search for "browser-use founders"',
        llm=ChatOpenAI(model="gcp-claude4.1-opus"),
        tools=tools,
        browser_session=browser_session,
    )

    await agent.run()
    await browser_session.kill()

    input("Press Enter to close...")


if __name__ == "__main__":
    asyncio.run(main())

LangChain Integration

from langchain.tools import BaseTool
from agent_sandbox import Sandbox

class SandboxTool(BaseTool):
    name = "sandbox_execute"
    description = "Execute commands in AIO Sandbox"

    def _run(self, command: str) -> str:
        client = Sandbox(base_url="http://localhost:8080")
        result = client.shell.exec_command(command=command)
        return result.data.output

OpenAI Assistant Integration

from openai import OpenAI
from agent_sandbox import Sandbox
import json

client = OpenAI(
    api_key="your_api_key",
)
sandbox = Sandbox(base_url="http://localhost:8080")


# define a tool to run code in the sandbox
def run_code(code, lang="python"):
    if lang == "python":
        return sandbox.jupyter.execute_code(code=code).data
    return sandbox.nodejs.execute_nodejs_code(code=code).data


# Use OpenAI
response = client.chat.completions.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "calculate 1+1"}],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "run_code",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "code": {"type": "string"},
                        "lang": {"type": "string"},
                    },
                },
            },
        }
    ],
)


if response.choices[0].message.tool_calls:
    args = json.loads(response.choices[0].message.tool_calls[0].function.arguments)
    print("args", args)
    result = run_code(**args)
    print(result['outputs'][0]['text'])

MiniMax Integration

MiniMax provides an OpenAI-compatible API, so you can use the same openai SDK with a different base_url:

from openai import OpenAI
from agent_sandbox import Sandbox
import json

client = OpenAI(
    api_key="your_minimax_api_key",
    base_url="https://api.minimax.io/v1",
)
sandbox = Sandbox(base_url="http://localhost:8080")


def run_code(code, lang="python"):
    if lang == "python":
        return sandbox.jupyter.execute_code(code=code).data
    return sandbox.nodejs.execute_code(code=code).data


response = client.chat.completions.create(
    model="MiniMax-M2.7",
    messages=[{"role": "user", "content": "calculate 1+1"}],
    tools=[
        {
            "type": "function",
            "function": {
                "name": "run_code",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "code": {"type": "string"},
                        "lang": {"type": "string"},
                    },
                },
            },
        }
    ],
    temperature=0.01,  # MiniMax requires temperature > 0
)


if response.choices[0].message.tool_calls:
    args = json.loads(response.choices[0].message.tool_calls[0].function.arguments)
    result = run_code(**args)
    print(result.outputs[0].text)

See the full minimax-integration example for more details.

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

๐Ÿ“„ License

AIO Sandbox is released under the Apache License 2.0.

๐Ÿ™ Acknowledgments

Built with โค๏ธ by the Agent Infra team. Special thanks to all contributors and the open-source community.

๐Ÿ“ž Support


Ready to revolutionize your AI development workflow?
โญ Star us on GitHub โ€ข ๐Ÿ“š Read the Docs โ€ข ๐Ÿ› Report Issues

Files in the repo

Repository payloadโ€ข18 top-level entries
  • .github
  • cli
  • docker
  • evaluation
  • examples
  • sdk
  • website
  • .gitignore
  • .prettierignore
  • .prettierrc
  • biome.json
  • CONTRIBUTING.md
  • docker-compose.yaml
  • LICENSE
  • package.json
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

๐Ÿชจ why use many token when few token do trick โ€” Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k