Sign in

Moving from E2B

Move E2B sandboxes to Prized sandboxes: the Prized command for each E2B SDK call, a short ported script, and what is not on Prized yet.

On this page5

1. Export an API key

An E2B sandbox becomes a Prized sandbox: a Firecracker microVM that boots in seconds, pauses with its processes running, and forks into live copies. Make a key with Sandboxes: Write on the API keys page, then export it in place of E2B_API_KEY:

export PRIZED_API_KEY=dcp_…

2. Swap each call

E2BPrized
Sandbox.create(timeout=3600)prized sandbox create --max-runtime 1h
cpu_count, memory_mb on a template buildprized sandbox create --vcpu 2 --memory 4, per sandbox
envs={...} on the createprized sandbox create --env NAME=value
sbx.commands.run(cmd)prized sandbox exec ID -- CMD
sbx.files.write(), files.read()prized sandbox cp ./app.py ID:app.py, and the reverse
sbx.pause(), Sandbox.connect(id)prized sandbox pause ID --wait, prized sandbox resume ID; any command resumes it too
sbx.fork(count=3)prized sandbox fork ID --count 3
Sandbox.list()prized sandbox ls
sbx.kill()prized sandbox rm ID
User user in /home/userUser prized in /home/prized; commands start in /home/prized/work

Each command has an HTTP route that takes the same key (Sandbox API).

3. Port a script

There is no SDK to install: save the standard-library helper, which wraps the Sandbox API in E2B-shaped calls.

curl -fsSLO https://prized.dev/skills/prized-sandboxes/scripts/prized_sandbox.py
job.py
from prized_sandbox import Sandbox  # was: from e2b import Sandbox

sbx = Sandbox.create(max_runtime_min=60)  # was: Sandbox.create(timeout=3600)
copies = []
try:
    sbx.write("/home/prized/work/main.py", b"print(6 * 7)")  # was: sbx.files.write()
    r = sbx.exec("python3 main.py")  # was: sbx.commands.run("python3 main.py")
    print(r["exitCode"], r["stdout"], end="")  # 0 42
    sbx.pause()
    print(sbx.exec("python3 main.py")["stdout"], end="")  # resumes it; was: sbx.connect()
    copies = sbx.fork(2)  # was: sbx.fork(count=2)
    print([c.exec("python3 main.py")["stdout"] for c in copies])
finally:
    for s in [*copies, sbx]:  # copies before their parent
        try:
            s.delete()  # was: sbx.kill()
        except Exception as e:  # keep going: one failed delete must not skip the rest
            print("delete failed:", s.id, e)

A failed command does not raise as in E2B: read exitCode. exec takes cwd, env, and timeout in seconds (300 by default, 3,600 at most).

Not on Prized yet

  • Docker, custom templates, and root. Sandboxes start from two fixed templates as prized, without sudo, so a template build, apt, and Docker need a box.
  • Lives past 24 hours. A sandbox is deleted 24 hours after its create, paused or not, and maxRuntimeMin is set only at the create; E2B keeps a paused sandbox until you kill it.
  • Regions. Sandboxes run in US West (Oregon), us-west-2, only.
  • Streaming, stdin, and a code interpreter. A command answers when it ends, and each one is a new process, so keep state between commands in files.
  • Public URLs to ports, SSH, snapshots, volumes, network allow and deny lists, and webhooks.

Getting help moving

Email with what you run on E2B, and we will help you map it.