1
Create E2B account
Every new E2B account gets $100 in credits. You can sign up here.
2
Set your environment variables
- Navigate to the E2B Dashboard.
- Copy your API key.
- Paste your E2B API key into your .env file.
.env
3
Install E2B SDK
Install the E2B SDK to your project by running the following command in your terminal.
This guide uses the Code Interpreter SDK because the next step calls
runCode() (Python: run_code()). Its Sandbox also supports shell commands and files. If your project only needs shell commands and files, the core e2b package is enough.4
Write code for starting sandbox
We’ll write the minimal code for starting Sandbox, executing Python inside it and listing all files inside the root directory.
5
Start your first E2B sandbox
Run the code with the following command: