Installation

Updated at:

The E2B CLI can be used to create, view, connect to, and terminate FC Agent Sandbox instances from the command line. FC Agent Sandbox is compatible with the commonly used E2B CLI sandbox commands and extends part of the template management workflow.

Install the CLI

On macOS, you can install it with Homebrew:

brew install e2b

You can also install it with npm:

npm i -g @e2b/cli

After installation, verify the version:

e2b --version

Configure connection parameters

The E2B CLI authenticates with E2B_API_KEY. Create and manage the API key as described in Create an API Key.

export E2B_API_KEY="<your-api-key>"
export E2B_API_URL="https://api.cn-beijing.e2b.fc.aliyuncs.com"
export E2B_DOMAIN="cn-beijing.e2b.fc.aliyuncs.com"

E2B_ACCESS_TOKEN is a deprecated legacy E2B authentication variable. New CLI flows should use E2B_API_KEY instead of depending on E2B_ACCESS_TOKEN.

Check the configuration

After configuration, list sandboxes to verify that the CLI can reach FC Agent Sandbox:

e2b sandbox list

If authentication fails, check the following:

  • The API key was created as described in Create an API Key.

  • The API key is enabled and not expired.

  • E2B_API_URL is https://api.cn-beijing.e2b.fc.aliyuncs.com.

  • E2B_DOMAIN is cn-beijing.e2b.fc.aliyuncs.com.

  • The installed E2B CLI version supports E2B_API_KEY authentication.

  • The current account has the required Function Compute permissions.