We are hiring!
Run AI-generated code in your app securely
E2B is an open-source runtime for running AI-generated code in secure cloud sandboxes.
We are hiring!
Run AI-generated code in your app securely
E2B is an open-source runtime for running AI-generated code in secure cloud sandboxes.
Trusted by
Step 1: Install Code Interpreter SDK
Step 1: Install Code Interpreter SDK
JavaScript / TypeScript
npm
npm
Python
Step 2: Execute AI-generated code
Step 2: Execute AI-generated code
JavaScript / TypeScript
import { CodeInterpreter } from '@e2b/code-interpreter'
const sandbox = await CodeInterpreter.create()
await sandbox.notebook.execCell('x = 1')
const execution = await sandbox.notebook.execCell('x+=1; x')
console.log(execution.text) // outputs 2
await sandbox.close()
import {
CodeInterpreter,
} from '@e2b/code-interpreter'
const sandbox = await CodeInterpreter.create()
await sandbox.notebook.execCell('x = 1')
const execution = await sandbox
.notebook
.execCell('x+=1; x')
console.log(execution.text) // outputs 2
await sandbox.close()
Python
from e2b_code_interpreter import CodeInterpreter
with CodeInterpreter() as sandbox:
sandbox.notebook.exec_cell("x = 1")
execution = sandbox.notebook.exec_cell("x+=1; x")
print(execution.text) # outputs 2
from e2b_code_interpreter import CodeInterpreter
with CodeInterpreter() as sandbox:
sandbox.notebook.exec_cell("x = 1")
execution = sandbox.notebook.exec_cell("x+=1; x")
print(execution.text) # outputs 2
©2024 FoundryLabs, Inc. All rights reserved.
©2024 FoundryLabs, Inc. All rights reserved.
©2024 FoundryLabs, Inc. All rights reserved.