Skip to content
Overview

Sandbox Service Overview

The Sandbox Service is a next-generation runtime infrastructure designed for AI Agent scenarios. It provides a secure, isolated cloud sandbox environment for executing AI-generated code. Through system-level isolation, it ensures that AI Agents cannot illegally access or tamper with system resources during task execution.

Core Features

Security

Sandboxes are isolated at the system level. Each sandbox instance runs in an independent virtualized environment, ensuring the security of data and the execution environment within the sandbox. This isolation mechanism effectively prevents malicious code from affecting the host system.

High Performance

  • Fast Startup: Sandbox startup time is less than 200 milliseconds.
  • Massive Concurrency: Supports large-scale concurrent deployment to meet high-concurrency demands.
  • Resource Optimization: Efficient resource allocation and management mechanisms.

Multi-Language Support

Supports multiple mainstream programming languages, including:

  • Python
  • JavaScript/TypeScript
  • C++
  • And other common programming languages.

Flexible Management

  • Quick Pause/Resume: Supports quick pause and resume operations for sandboxes.
  • Background Execution: Supports long-running background tasks.
  • State Persistence: File system and process states can be persisted.

Easy Integration

  • SDK Compatibility: Fully compatible with the E2B SDK; you can use the official SDK directly for development.
  • Provides a simple SDK interface.
  • Seamlessly integrates with mainstream AI frameworks.
  • Supports management via command-line tools.

Main Features

Code Execution and Isolation

Execute AI-generated code in a secure, isolated environment with real-time output and error handling.

File System Management

Provides complete file system operations, including reading, writing, uploading, and downloading files.

Process Management

Supports starting, monitoring, and managing multiple processes within a sandbox, including foreground and background processes.

Network Access

Supports sandbox instances accessing external network resources, such as making HTTP requests and establishing database connections.

Custom Templates

Supports creating custom sandbox templates with pre-installed software packages and configurations to speed up sandbox startup.

Use Cases

AI Data Analysis

AI Agents can safely execute data analysis code within a sandbox for data processing and visualization, without worrying about data leaks or system security issues.

Code Agent Runtime Environment

Provides a secure code execution environment for Code Agents, supporting dynamic code generation and execution to create a complete code generation and execution loop.

Automated Task Execution

Execute various automated tasks, such as data collection, scheduled tasks, and batch processing.

Billing

The Sandbox Service uses a pay-as-you-go model with per-second billing. Billing stops as soon as the sandbox stops running.

Compute Resources

Resource TypeUnit PriceDescription
vCPU$0.00000564/core/secondBilled linearly based on the actual number of allocated vCPU cores, ranging from 1 to 8 cores.
Memory$0.00000282/GiB/secondMemory must be configured in multiples of 512 MiB, ranging from 512 MiB to 8192 MiB.

Reference Conversion:

Resource TypeHourly CostDaily Cost (24h)
1 vCPU$0.020304$0.487296
1 GiB Memory$0.010152$0.243648

Storage Resources

Local Storage

Each sandbox is automatically allocated 20 GiB of local storage space, which is free of charge.

Persistent Storage

Persistent storage is used to save templates, sandbox snapshots, template snapshots, and other data. It is billed hourly.

ItemDescription
Free Tier10 GiB per account per month
Excess Usage$0.00002727/GiB/hour

Usage exceeding the free tier is billed based on actual consumption. Partial hours are billed as full hours.

Network

Network traffic is currently not billed separately.

Billing Example

The following is a cost estimate for a typical usage scenario:

Scenario: Running a sandbox with 2 vCPU + 2 GiB memory for 8 hours per day, using 15 GiB of persistent storage.

ItemCalculationDaily Cost
vCPU2 cores × $0.020304/core/hour × 8 hours$0.324864
Memory2 GiB × $0.010152/GiB/hour × 8 hours$0.162432
Persistent Storage(15 - 10) GiB × $0.00002727/GiB/hour × 24 hours$0.0032724
TotalApproximately $0.49/day

Important Notes

  • Billing for compute resources (vCPU and memory) stops immediately when the sandbox stops running.
  • Persistent storage continues to be billed even when the sandbox is not running, until the data is deleted.
  • If your account is in arrears, you will not be able to create new sandbox instances, and running sandboxes will be released.