Use in CI
Each job starts a machine, runs commands in it and removes it at the end. It is the same flow as the Use in CI page in the Dashboard.
Set it up
Section titled “Set it up”- In the Dashboard, under API keys, create a key named after the pipeline. That way you revoke the right one later.
- In GitHub, open Settings, Secrets and variables, Actions and create the secret
ROOKBOX_API_KEYwith the key. - Save the workflow below as
.github/workflows/rookbox.ymland push.
name: Run on a Rookbox machineon: [push]
jobs: run: runs-on: ubuntu-latest env: E2B_API_KEY: ${{ secrets.ROOKBOX_API_KEY }} E2B_API_URL: https://api.rookbox.run steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm install e2b - name: Start a machine, run a command, remove it run: | cat > run.mjs <<'EOF' import { Sandbox } from "e2b"; const sandbox = await Sandbox.create({ timeoutMs: 15 * 60_000 }); try { const result = await sandbox.commands.run("echo hello from Rookbox"); console.log(result.stdout); } finally { await sandbox.kill(); } EOF node run.mjsGood to know
Section titled “Good to know”- Remove the machine at the end, like the
finallyabove. A forgotten one goes away on its own when its timeout ends, but it counts toward your limit of 3 until then. - Parallel jobs count together. With a limit of 3 machines, a fourth parallel job gets 429. See Limits.
- Never put the key in code. Only in a secret.