Version: v2.0 | Last Updated: 2026-10-16
This document serves as the entry point and index for all Agent Sandbox design documentation. Detailed designs live in the specialized topic documents under
design/.
Agent Sandbox (agent-sandbox-client on PyPI) is a Python SDK for the Alibaba Cloud FC Agent Sandbox service. It is the runtime client: create, use and kill sandboxes. Templates are built and deployed with abx template build|deploy. Method names are E2B-shaped to ease migration; the standard public API follows the pinned Alibaba E2B contract (see Migrate from E2B).
This repository holds the Python SDK as two lock-step PyPI distributions — agent-sandbox-client (client-sdk/, import agent_sandbox) and agent-sandbox-server (server-sdk/, import agent_sandbox.server, the container-side runtime). The abx CLI is a Node.js/TypeScript project in the cli repository, which holds the CLI's own design and guide documents (see Related: the abx CLI).
- Pinned standard behavior and explicit provider extensions — Root
Sandboxis synchronous;AsyncSandboxis asynchronous. Standard and interpreter clients follow the Alibaba-supported E2B baseline through an owned MIT source port.agent_sandbox.compatre-exports the standard clients. Provider/server/declarative extensions useProviderSandbox;ABX_PROVIDERdoes not switch the standard clients' protocol. - AI-First — MCP Server as a first-class citizen, coding agents hosted through the Agents API
- Explicit connection settings — Reuse the existing Alibaba API key, API URL and sandbox domain; backend-dependent capabilities remain conditional.
pip install agent-sandbox-client
export ABX_SANDBOX_API_KEY=your-api-keyfrom agent_sandbox import ProviderSandbox as Sandbox
async with await Sandbox.create(template="base") as sb:
result = await sb.run_code("print('Hello, Agent Sandbox!')")
print(result.text)Current builtin runtime: direct HTTP and migration.
The native provider extensions follow the layers below. Standard clients use their separate source-ported protocol implementation:
graph TB
subgraph Upper["Upper Layers"]
Agent["Agent/MCP — MCP server, tool defs"]
Decl["Declarative — @sandbox decorator"]
Compat["compat — standard client aliases"]
STD["Sandbox / AsyncSandbox / code_interpreter"]
end
subgraph Core["Core Layers"]
L3["ProviderSandbox — files, code, commands, network, server client"]
PORT["_standard / interpreter — maintained MIT source port"]
L2["Protocol — Sandbox lifecycle, filesystem, process, terminal, port"]
L1["Transport — HTTP, WebSocket, auth, codec, streaming"]
L0["Models + Utils — Pydantic models, errors, config, async bridge"]
end
Agent --> L3
Decl --> L3
Compat --> STD --> PORT
L3 --> L2 --> L1 --> L0
For the full architecture breakdown, see Architecture Design.
Each topic below has its own dedicated design document with complete specifications.
| Topic | Document | Summary |
|---|---|---|
| System Architecture | architecture.md | Standard client source port, native provider extension layers, and their separate protocol paths |
| SDK API Design | sdk-api-design.md | Sandbox class, file operations, code execution, commands, network, session management |
| Sandbox Type System | sandbox-types.md | Ephemeral sandboxes (implemented), persistent sandboxes (future), sandbox lifecycle |
| Providers and Credentials | providers-and-credentials.md | One environment variable per configuration key, precedence, provider plugins (abx provider ...), install/trust model, EPP/1 protocol, E8xxx errors; review log in providers-and-credentials-review.md |
| Topic | Document | Summary |
|---|---|---|
| Template System | template-system.md | Template tiers, GitHub tarball distribution, template.yaml specification, versioning, marketplace architecture |
| Topic | Document | Summary |
|---|---|---|
| MCP Server | mcp-server.md | 7 P0 MCP tools, STDIO + Streamable HTTP transports, FC deployment artifact, session binding |
| Agents API | guide/agents-api.md | The one way to run an agent in a sandbox: /v1/agents/**. The base image does not preinstall a CLI |
| Topic | Document | Summary |
|---|---|---|
| Server API | server-api.md | Sandbox Server SDK routes, capability groups, browser instance architecture |
Chinese copies of these pages live under docs/zh/. repository-layout.md is English only.
| Topic | Document | Summary |
|---|---|---|
| Agents API | agents-api.md, review | Hosting coding agents in Agent Sandbox |
| Fine-grained capabilities | fine-grained-capabilities.md, review | Capability scoping and permissions in agent-sandbox-server and template.yaml |
| Client / server alignment | client-server-alignment.md | Gap matrix of every server route against the client |
| Base image and server SDK | base-image-and-server-sdk.md, CLI follow-ups | The official FC Agent Sandbox base image and the server SDK; the exact abx CLI changes it needs |
| Server SDK v2 | server-sdk-v2/ | Target operation-model design for the server SDK (status and not-implemented list on the first page) |
| OpenSandbox provider | provider-opensandbox-mapping.md | Current node catalog provider and the live capability table |
| Container edition | provider-alicloud-container.md | ACS/ACK sandbox-manager, E2B-shaped HTTP, not Express |
| CubeSandbox | provider-cubesandbox.md | CubeAPI control plane |
| E2B | provider-e2b.md | E2B cloud API at api.e2b.app |
| Provider readiness | provider-readiness.md | Logical review of CubeSandbox, E2B, and the container edition before a live backend exists |
| Repository layout | repository-layout.md | Layout review of the python-sdk and cli repositories |
| Feature | Status | Notes |
|---|---|---|
| SDK core (Sandbox, files, commands, code) | Implemented | |
| MCP Server (STDIO) | Implemented | 7 P0 tools |
| MCP Server (Streamable HTTP) | Implemented | mcp_http.py |
| FC deployment artifact application | Implemented | agent_sandbox.agent.mcp_http:asgi_app; the artifact is generated by abx mcp deploy in the CLI. See mcp-server.md |
| Template build/push/deploy | In the CLI | abx template build and abx template deploy; the SDK does not build templates |
| E2B migration helper | Implemented (partial) | agent_sandbox.compat |
| One environment variable per configuration key (SDK) | Implemented | See Configuration; CLI spec in cli/docs/design/providers-and-credentials-cli.md |
Provider plugins (SDK, python -m agent_sandbox.providers) |
Implemented | See Providers. The CLI loads installed node, exec and rest plugins (abx provider, abx --provider) |
| Persistent sandbox | Future | Requires underlying platform support |
| SandboxPool (warm pool) | Future | Requires underlying platform support |
| Resource | Location |
|---|---|
| Architecture Decision Records (ADR) | .agents/notes/ |
| User guides | docs/en/guide/ |
| API reference | docs/en/reference/ |
| Chinese (中文) design index | docs/zh/DESIGN.md |
The abx CLI (Node.js / TypeScript, npm @agent-sandbox/cli) is documented in the cli repository; its design index is DESIGN.md. Most relevant to SDK readers: CLI Architecture, CLI Command System and Templates Catalog.