Quick start
Create a sandbox and run a command in it, with E2B's Python or JavaScript SDK.
1. Open the service
Sign up for a Lumi account, then open https://console.lumicloud.ai/sandbox/ and verify a card: $1 is charged and given back at once. New customers get $20 of credit after verifying a card, to use within 30 days.
2. Create an API key
On the console's API keys page, create a key. It is shown once; keep it.
3. Install the SDK and set the domain and the key
shpip install e2b
# or: npm install e2bshexport E2B_DOMAIN=lumicloud.dev
export E2B_API_KEY=<your LumiCloud key>4. Create a sandbox
pythonfrom e2b import Sandbox
sandbox = Sandbox.create("base", timeout=300) # seconds before it ends by itself
result = sandbox.commands.run("python3 -c 'print(6 * 7)'")
print(result.stdout) # 42
sandbox.kill()javascriptimport { Sandbox } from "e2b"
const sandbox = await Sandbox.create("base", { timeoutMs: 300_000 })
const result = await sandbox.commands.run("python3 -c 'print(6 * 7)'")
console.log(result.stdout) // 42
await sandbox.kill()Pause and resume
A paused sandbox keeps its memory, files and processes until you delete it, and is not charged for running. Resume it by its ID.
pythonsandbox_id = sandbox.sandbox_id
sandbox.pause()
sandbox = Sandbox.connect(sandbox_id) # resumes it
print(sandbox.commands.run("uptime").stdout)Code interpreter
E2B's code interpreter SDK works too; it uses the public template code-interpreter-v1.
shpip install e2b-code-interpreterpythonfrom e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
print(sandbox.run_code("sum(range(10))").text) # 45A sandbox's ports
A server listening on a port of a sandbox is reachable at https://<port>-<sandbox id>.lumicloud.dev.
pythonsandbox.commands.run("python3 -m http.server 8000", background=True)
print("https://" + sandbox.get_host(8000))More examples
lumibox-examples has runnable examples in Python and JavaScript: Claude and OpenAI tool calling with a code interpreter, Claude Code in a sandbox, a browser driven with Playwright, a desktop for computer use, and a parallel evaluation. They run against LumiCloud every day.