Quickstart
Rookbox speaks the E2B protocol. You use the E2B SDK unmodified and point it at the Rookbox API.
-
Get a key. Rookbox is in closed beta: join the waitlist at rookbox.run. With your invite, open the Dashboard, go to API keys and create one. The key starts with
rbx_and is shown only once. Copy it right away. -
Install the SDK.
Janela do terminal pip install e2bJanela do terminal npm i e2b -
Set two variables.
Janela do terminal export E2B_API_KEY=rbx_...export E2B_API_URL=https://api.rookbox.run -
Create a machine and run a command.
from e2b import Sandboxsandbox = Sandbox.create(timeout=15 * 60) # 15 minutesprint(sandbox.commands.run("uname -a").stdout)import { Sandbox } from "e2b";const sandbox = await Sandbox.create({ timeoutMs: 15 * 60_000 }); // 15 minutesconst result = await sandbox.commands.run("uname -a");console.log(result.stdout); -
Expose a port.
sandbox.commands.run("python3 -m http.server 8000", background=True)print(sandbox.get_host(8000)) # 8000-<id>.box.rookbox.runawait sandbox.commands.run("python3 -m http.server 8000", { background: true });console.log(sandbox.getHost(8000)); // 8000-<id>.box.rookbox.runThe address requires a traffic token. See Ports and URLs.
-
Suspend and resume. In the E2B SDK,
pauseis Rookboxsuspend: memory is kept.sandbox_id = sandbox.sandbox_idsandbox.beta_pause() # suspend, memory keptsandbox = Sandbox.connect(sandbox_id) # resume, about 1 sconst id = sandbox.sandboxId;await sandbox.betaPause(); // suspend, memory keptconst back = await Sandbox.connect(id); // resume, about 1 sIn current SDK versions the method is called
beta_pause(Python) andbetaPause(TypeScript). -
Remove it.
sandbox.kill()await sandbox.kill();