All Products
Search
Document Center

Function Compute:E2B compatibility

Last Updated:Sep 16, 2026

This document defines the FC Agent Sandbox compatibility scope for the E2B SDK and E2B CLI. Other getting started documents keep only the minimum integration steps. API boundaries are maintained here.

For usage constraints, see Usage constraints.

Compatibility overview

Capability Status Notes
Sandbox Compatible (pause and resume requires allowlist access) Supports create, connect, inspect, timeout updates, pause, kill, upload and download URLs, and port access URLs.
Commands Compatible Supports command execution, process management, standard input, and PTY.
Filesystem Partially compatible Supports file read and write, directory management, rename, delete, existence checks, and directory watching. FC Agent Sandbox does not currently support custom file metadata.
Code Interpreter Compatible Supports code execution, context management, execution outputs, streaming output, and state persistence across runs. Charts can only be retrieved as files through Filesystem or download URLs.
Template Compatible Supports template management, template builds, tags, and aliases.
CLI Partially compatible Supports the commonly used sandbox and template commands.
Metrics Compatible Supports viewing CPU and memory metrics. Disk and page-cache fields return placeholder values and are not currently usable.
Logs / Network Config Update Limited The APIs are callable, but returned results or actual effects are limited.
Snapshots Compatible (requires allowlist access) Supports creating, listing, and deleting snapshots, and restoring a sandbox from a Snapshot ID or qualified name. Available only on the second-generation runtime (micro-sandbox); retained for 7 days by default from creation.
Volume / Access Token Not currently compatible These capabilities are not recommended as part of the FC Agent Sandbox integration path. Manage teams in the console.

Compatible APIs

Sandbox

Pause and resume is currently available only to allowlisted accounts. Complete allowlist enablement before calling sandbox.pause() or connecting to a paused Sandbox.

Snapshots are also available only to allowlisted accounts, and only on the second-generation runtime (micro-sandbox). Complete allowlist enablement before calling Snapshot-related APIs.

The following sandbox lifecycle and access capabilities are supported:

  • Sandbox.create()

  • Sandbox.connect(sandboxId)

  • Sandbox.list()

  • Sandbox.getInfo(sandboxId)

  • Sandbox.kill(sandboxId)

  • Sandbox.setTimeout(sandboxId, ms)

  • sandbox.getInfo()

  • sandbox.isRunning()

  • sandbox.setTimeout(ms)

  • sandbox.pause()

  • sandbox.kill()

  • sandbox.downloadUrl(path)

  • sandbox.uploadUrl(path)

  • sandbox.getHost(port)

  • sandbox.createSnapshot({ name? }) / Sandbox.createSnapshot(sandboxId, { name? })

  • Sandbox.listSnapshots({ sandboxId?, name?, limit?, nextToken? })

  • Sandbox.deleteSnapshot(snapshotId | qualifiedName)

  • Python: sandbox.create_snapshot(name=...) / Sandbox.create_snapshot(sandbox_id, name=...), Sandbox.list_snapshots(...), Sandbox.delete_snapshot(snapshot_id | qualified_name)

Sandbox.connect(sandboxId) can attach to an existing sandbox. If the target sandbox is paused, it is automatically resumed when you connect.

The template parameter of Sandbox.create() can be a Snapshot ID or the qualified name of a named Snapshot, in addition to a template name or template ID.

Commands

The following command execution and process management capabilities are supported:

  • sandbox.commands.run()

  • sandbox.commands.list()

  • sandbox.commands.connect()

  • sandbox.commands.sendStdin()

  • sandbox.commands.kill()

Use the sandbox.pty API for interactive terminals and tasks that depend on TTY.

Filesystem

The following filesystem capabilities are supported:

  • sandbox.files.list()

  • sandbox.files.exists()

  • sandbox.files.getInfo() / sandbox.files.get_info()

  • sandbox.files.read()

  • sandbox.files.write()

  • sandbox.files.makeDir() / sandbox.files.make_dir()

  • sandbox.files.remove()

  • sandbox.files.rename()

  • sandbox.files.watchDir() / sandbox.files.watch_dir()

sandbox.files.write() supports text, binary, and streaming content. Directory watching is useful for waiting for agent output files or syncing task artifacts.

FC Agent Sandbox does not currently support attaching custom file metadata through the metadata parameter. For example, the files.write() signature in Python SDK e2b==2.31.0 accepts metadata, but the SDK detects envd 0.5.2 in the sandbox and raises TemplateException: File metadata requires envd 0.6.2 or later. before sending the write request. Regular file reads and writes are unaffected. Do not confuse sandbox control-plane metadata, which remains available for labeling and querying sandboxes, with custom file metadata.

Code Interpreter

The core Code Interpreter capabilities are supported:

  • sandbox.runCode() / sandbox.run_code()

  • sandbox.createCodeContext() / sandbox.create_code_context()

  • sandbox.listCodeContexts() / sandbox.list_code_contexts()

  • sandbox.restartCodeContext() / sandbox.restart_code_context()

  • sandbox.removeCodeContext() / sandbox.remove_code_context()

  • Execution outputs, including stdout, stderr, execution count, bare expression results, and rich results in execution.results.

  • In streaming scenarios, stdout, stderr, and result callbacks.

  • Variable and context state persistence across multiple code executions.

  • Execution of Python, JavaScript, TypeScript, and Bash through the language parameter. Java and R are not supported.

For charts and visualizations, FC Agent Sandbox currently supports the file-based fallback path only: generate image files inside the sandbox and retrieve them through Filesystem or download URLs.

Template

The following template capabilities are supported:

  • Template CRUD.

  • Template build.

  • Template tags.

  • Template alias.

FC Agent Sandbox currently supports building templates from images. For details, see Build Custom Image Templates.

CLI

FC Agent Sandbox is compatible with the commonly used E2B CLI sandbox commands and extends part of the template management workflow:

Command FC Agent Sandbox status Notes
sandbox create <template> Supported Creates a sandbox and connects to an interactive terminal. The sandbox is automatically terminated after you exit the terminal.
sandbox list Supported Returns running sandboxes by default. Supports --state, --metadata, --limit, and --format.
sandbox kill Supported Supports killing by ID and bulk killing with --all.
sandbox connect Supported Connects to an existing sandbox and opens an interactive terminal. Exiting the terminal does not terminate the sandbox.
sandbox exec Supported Executes a command inside a running sandbox and returns the output to the local terminal.
sandbox metrics Supported Shows CPU and memory metrics for a running sandbox. Metrics currently return at 1-minute granularity.
template list FC Agent Sandbox extension The official E2B CLI documentation does not keep a dedicated page for this command. Use local CLI help as the source of truth.

New E2B CLI versions authenticate with E2B_API_KEY. For configuration details, see Use FC Agent Sandbox with the CLI.

Metrics

FC Agent Sandbox supports sandbox metrics:

e2b sandbox metrics <sandbox-id>

Currently supports CPU and memory metrics. Disk and page-cache fields return placeholder values and should not be used for capacity decisions. Metrics currently return at 1-minute granularity. They are suitable for debugging, resource trend observation, and task troubleshooting. Use the Function Compute console, CloudMonitor, or Simple Log Service as the source of truth for billing, alerting, and capacity governance.

Limited capabilities

  • Sandbox Logs currently return empty arrays.

  • Network Config Update currently returns success without applying an actual network change.

These interfaces can preserve SDK invocation compatibility, but they are not suitable as production dependencies for log collection or network change control planes.

Capabilities not currently supported

The following capabilities are not part of the primary E2B-compatible integration path for FC Agent Sandbox:

  • Volume API.

  • Team management (manage teams in the Function Compute console).

  • API key and access token management.

  • Custom file metadata.

If you need persistent storage or cloud data access, use Alibaba Cloud storage services such as NAS or OSS first. Create and manage API keys in the Function Compute console, not through the E2B SDK. For details, see Create an API Key.

Capabilities such as VPC access, OSS integration, log collection, and monitoring alerts belong to FC Extensions and are not native E2B SDK-compatible interfaces. For details, see FC Extensions Overview.

FC Extensions capabilities

Beyond E2B compatibility, FC Agent Sandbox also provides FC Extensions that connect to Function Compute and Alibaba Cloud infrastructure. These extensions do not change the basic usage of the E2B SDK or CLI:

  • FC Extensions overview: an overview of the extension capabilities and the entry point to each sub-capability.

  • VPC network configuration: allows Sandbox to access resources in your VPC, such as RDS, Redis, NAS, and internal APIs.

  • Custom Domains for FC Agent Sandbox: access services in Sandbox through your own fixed domain name and certificate.

  • Dynamic OSS Mounts: mount an OSS bucket or subdirectory to a local directory inside Sandbox when a Sandbox is created.

  • Monitoring and logs: view the running status and resource usage of Sandbox, and collect stdout / stderr logs to Simple Log Service.

  • Team Quota Management: set CPU and memory quotas per team for resource isolation and cost control.

  • Create an OSS Volume: save the mount configuration of an existing OSS bucket so that Sandboxes can mount it by volume name.

  • Create an AgenticFS Volume: save the mount configuration of an existing AgenticSpace access point so that Sandboxes can mount it by volume name.

Migration recommendations

  • If you already have an E2B-based application, keep the SDK call pattern unchanged first and only replace the API key, API URL, and domain.

  • Start with code-interpreter-v1 and a minimal sandbox example to verify sandbox creation, command execution, file I/O, and cleanup.

  • If your application depends on high-frequency metrics, logs, Network Config Update, volume, or custom file metadata, adjust the design before migration instead of assuming the original E2B path will work unchanged.

  • In production code, always call sandbox.kill() explicitly to avoid leaving sandboxes running longer than intended.

Further reading