Sandbox is a secure cloud sandbox provided by Bailian. It gives AI agents an isolated environment for code execution, browser operations, and file processing, and is compatible with the E2B SDK/API protocol.
Sandbox provides isolated cloud environments for AI agents. Each instance has dedicated compute resources, a file system, and network isolation, where you can execute code, run commands, operate a browser, and read/write files. It is compatible with the E2B SDK/API protocol.
Core Concepts
| Concept | Description |
|---|---|
| Template | The runtime configuration of a sandbox, including base image, resource specification, file mounts, network policy, environment variables, and lifecycle. Referenced by templateCode once created; a template can create multiple instances. |
| Sandbox | A running instance launched from a template, with a dedicated runtime environment and network isolation. Referenced by sandboxID once created. |
| Image | A base image with a preinstalled runtime. Three images are available: Code Interpreter, Browser, and All-in-One. |
Base Images
| Image | Description | Use Cases |
|---|---|---|
| Code Interpreter | Lightweight code execution environment, supporting Python / Node.js | Code execution, data analysis, script running |
| Browser | Browser execution environment for UI operations | Web automation, screenshots, UI testing |
| All-in-One | An image integrating multiple runtimes | Tasks requiring multiple languages or combined capabilities |
Instance Lifecycle
- Create: Launch an instance from a template; it enters the running state.
- Pause: Pause an idle instance, preserving the file system and memory state.
- Resume: Connect to a paused instance and continue from where it was paused.
- Release: Release an instance and reclaim resources when no longer needed.
The idle timeout and maximum lifetime of an instance are set in the template's lifecycle configuration, up to 7 days.
Access Methods
- Console: Create a template and generate an API Key on the Quick Start page to go from creation to invocation within minutes.
- E2B SDK: Use the official E2B SDK with the Bailian sandbox endpoint and API Key. See Manage and Use Instances.
- API: Manage instances and templates through the E2B-compatible REST API. See Sandbox API.