Skip to main content
Getting Started

Overview

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

ConceptDescription
TemplateThe 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.
SandboxA running instance launched from a template, with a dedicated runtime environment and network isolation. Referenced by sandboxID once created.
ImageA base image with a preinstalled runtime. Three images are available: Code Interpreter, Browser, and All-in-One.

Base Images

ImageDescriptionUse Cases
Code InterpreterLightweight code execution environment, supporting Python / Node.jsCode execution, data analysis, script running
BrowserBrowser execution environment for UI operationsWeb automation, screenshots, UI testing
All-in-OneAn image integrating multiple runtimesTasks 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.

Next Steps