General Introduction
E2B is an open source platform designed to run AI-generated code in a secure cloud sandbox. It supports multiple programming languages and frameworks, and provides an isolated virtual environment to ensure the security and reliability of code execution.E2B is suitable for a variety of AI application scenarios, including data analytics, code generation evaluation, and automated AI agents. Users can quickly launch and manage the sandbox via Python or JavaScript SDK, perform data upload and download, install custom packages, and more.
Function List
- Secure Cloud Sandbox: Provides isolated virtual environments to ensure secure code execution.
- Multi-language support: Support for Python, JavaScript, Ruby, C++ and other programming languages.
- quick start: Sandbox startup time is less than 200 milliseconds with no cold start issues.
- Customized Sandboxes: Support for installing third-party packages and system libraries, fully customized sandbox environment.
- Data Analysis and Visualization: Run AI-generated code for advanced data analysis and visualization.
- Code Generation Evaluation: An environment for code generation evaluation that supports multiple evaluation benchmarks.
- long time running: Sandboxes can run for up to 24 hours and are suitable for a variety of complex tasks.
- self-hosted: Support for self-hosting in an AWS or GCP account, running in the user's VPC.
Using Help
Installation and startup
- Installing the SDK: Choose either the Python or JavaScript SDK to install as needed.
- Python.
pip install e2b
- JavaScript.
npm install @e2b/code-interpreter
- Python.
- Launch sandbox: Start the first E2B sandbox using the SDK.
from e2b import Sandbox
sandbox = Sandbox()
sandbox.start()
const { Sandbox } = require('@e2b/code-interpreter');
const sandbox = new Sandbox();
sandbox.start();
Data upload and download
- Uploading files: Upload the file to the sandbox for processing.
sandbox.upload_file('local_path', 'sandbox_path')
sandbox.uploadFile('local_path', 'sandbox_path');
- Download file: Download processed files from the sandbox.
sandbox.download_file('sandbox_path', 'local_path')
sandbox.downloadFile('sandbox_path', 'local_path');
Installation of customized packages
- installer: Install third-party packages or system libraries in the sandbox.
sandbox.install_package('package_name')
sandbox.installPackage('package_name');
Data Analysis and Visualization
- Run the data analysis code: Run AI-generated code in a sandbox for data analysis.
result = sandbox.run_code('your_analysis_code')
sandbox.runCode('your_analysis_code').then(result => console.log(result));
- Generate visualization charts: Generate interactive charts using Python code.
sandbox.run_code('your_visualization_code')
Code Generation Evaluation
- Evaluation Code Generation: Run the code in a sandbox to generate evaluation benchmarks.
sandbox.run_code('your_codegen_eval_code')
self-hosted
- Deploying to the Cloud: Deploy E2B to an AWS or GCP account running in the user's VPC.
sandbox.deploy_to_cloud('aws_account', 'vpc_id')