Skip to content
中文

Two sandbox lifecycles

Every sandbox declares at creation which kind it is.

EphemeralPersistent
Use forOne job: a transcode, a script, a build, a testA long-lived computer that keeps its files and process state
Pause and snapshotNever pauses; no snapshot, fork or archivePauses and resumes; snapshots; mounts volumes
When it endsDeleted when it expires or ends; nothing is keptKept after it pauses for the retention time (default 1 minute, can be unlimited)
DefaultNone; you must declareNone; you must declare

Choose persistent only for long-lived computers. Everything else is ephemeral.

How to declare

The Praxis native interface (selected with the X-Praxis-Face: own-v1 header): ephemeral is required, true or false. Leaving it out returns INVALID_PARAMS.

终端窗口
curl https://api.deepraxis.com/sandbox/v1/sandboxes \
-H "X-API-Key: $PRAXIS_API_KEY" -H "X-Praxis-Face: own-v1" \
-H "content-type: application/json" \
-d '{"templateID": "base", "timeout": 600, "ephemeral": true}'

autoPause: true, onExpire: "pause", autoPauseMemory, autoResume, idleTimeout, retention and volumes belong to persistent sandboxes only and need ephemeral: false.

The E2B-compatible face declares with E2B’s own autoPause. true is persistent; false or absent is ephemeral, and as in E2B the sandbox ends at its timeout.

Sandbox.create(template="base", timeout=600, lifecycle={"on_timeout": "kill"}) # ephemeral
Sandbox.create(template="base", timeout=600, lifecycle={"on_timeout": "pause"}) # persistent

Keeping declared outputs before it ends

By default, when a sandbox’s machine ends, the files on it are gone. To keep some paths alive, declare outputs at creation: an array of at most 8 entries, each with a single path, absolute, naming either a directory or a file. A directory is packed by its contents (unpacking gives you what was inside it); a file is packed as itself.

Only the Praxis native interface (X-Praxis-Face: own-v1) accepts outputs: E2B’s SDK has no such parameter, and the E2B-compatible face answers INVALID_PARAMS when it receives one.

终端窗口
curl https://api.deepraxis.com/sandbox/v1/sandboxes \
-H "X-API-Key: $PRAXIS_API_KEY" -H "X-Praxis-Face: own-v1" \
-H "content-type: application/json" \
-d '{"templateID": "base", "timeout": 600, "ephemeral": true,
"outputs": [{"path": "/home/user/out"}, {"path": "/home/user/report.log"}]}'

Whatever ends the sandbox afterwards — its timeout, your own kill, the maximum run time, the retention window, your own delete — every declared path is packed to a .tar.gz and stored in File before the machine is released, owned by the organization that created it. One archive is capped at 500 MB, and packing and uploading everything for one ending is capped at 60 seconds in total.

Two endings do not pack: provider_lost (the provider already lost the machine) and start_failed (the machine never started), because there is no machine to read.

When outputs are declared, DELETE /sandbox/v1/sandboxes/{sandboxID} waits for that capture, up to about 60 seconds.

Paths you did not declare are not kept, and neither are temporary files — put what must last in the declaration, or upload it to File yourself.

After a sandbox ends

When a sandbox’s machine has ended (timeout, kill, retention, provider loss), reaching it again returns SANDBOX_EXPIRED (HTTP 410) with a terminationReason in the message: lease_expired, max_running, retention, provider_lost and so on. The files on that machine are gone, and the platform never quietly substitutes an empty machine. Create a new sandbox, and keep files that must last in File or on a Computer.

A sandbox you ended yourself still answers INSTANCE_NOT_FOUND.

How to know why it ended

The cause of death is written in the sandbox’s lifecycle events. GET /sandbox/v1/events/sandboxes/{sandboxID} is the one read that still answers after a sandbox has ended: the machine is gone, the ledger is not. It returns an array of events, newest first by default; on the killed event eventData.terminationReason is the platform’s own reason and eventData.kill_reason is the E2B-shaped bucket (request, timeout, admin, orphaned, unknown). When outputs were declared, the same eventData.outputs lists what became of each declared path.

终端窗口
curl -s "https://api.deepraxis.com/sandbox/v1/events/sandboxes/$SANDBOX_ID?types=sandbox.lifecycle.killed&orderAsc=false" \
-H "Authorization: Bearer $PRAXIS_API_KEY"
[
{
"id": "evt_1821",
"version": "v1",
"type": "sandbox.lifecycle.killed",
"sandboxId": "sbi0f3c…",
"sandboxTeamId": "tnt_…",
"sandboxTemplateId": "base",
"timestamp": "2026-10-05T12:00:03.000Z",
"eventData": {
"terminationReason": "lease_expired",
"kill_reason": "timeout",
"outputs": [
{ "path": "/home/user/out", "fileId": "file_9f21…", "bytes": 40960 },
{ "path": "/home/user/report.log", "error": "missing" }
]
}
}
]

outputs is in declaration order. An entry that was kept carries fileId and bytes, and that fileId downloads through File (GET /file/v1/files/{file_id}/content); an entry that was not carries error, one of a closed set of words:

errorWhat happened
missingThe path is not in the machine — neither a directory nor a file
archive_failedPacking it failed
too_largeThe archive was over 500 MB, so it was never uploaded
upload_failedStoring it in File failed, or File refused it
timeoutThat path used up its own share of the time budget

One entry failing affects neither its neighbours nor the ending itself: the machine is released either way. A sandbox that declared no outputs has no such field in its eventData.

terminationReasonWhat happenedWhat to do
lease_expiredIts timeout (or a deadline you set) passed with no renewalGive the next one a larger timeout, or renew with POST /sandbox/v1/sandboxes/{sandboxID}/timeout before it runs out
max_runningIt reached its maximum run time (the maxRunningTime set at creation, or the platform ceiling for its kind); renewing cannot extend past itSplit the work into smaller batches and keep intermediate results in File
retentionA persistent sandbox passed its retention windowKeep files that must last in File or on a Computer, not only inside the sandbox
provider_lostThe provider lost the machineRetry; that run’s result cannot be trusted
start_failedThe machine never startedRetry; if it persists, try another template or contact support
adminThe platform ended it, including when the organization ran out of balanceCheck the account balance first; contact support if it is fine
requestedYou killed it yourself (DELETE, or the SDK’s kill)Nothing to do

Reaching a sandbox that is judged never to come back on the data plane (files, commands) returns SANDBOX_EXPIRED (410), whose body carries the same terminationReason as the event.

When the egress IP changes

The default egress IP of a sandbox is not fixed, so never put it on a third party’s whitelist. The address changes when:

  • an interruptible (spot) machine is reclaimed and another machine replaces it;
  • a persistent sandbox is paused and resumed: pausing stops the machine and releases its ordinary public IP, so the address after resume can differ;
  • a machine is rebuilt or recreated.

When you need an address that stays, create a persistent sandbox with network.staticEgressIp: true; that address is the same across pause and resume. See Fixed egress IP.

Next steps

  • Fixed egress IP: an unchanging egress address for third-party whitelists.
  • Custom templates: Bake tools and dependencies into a template so even persistent sandboxes start ready.
  • Cloud phones: For work that needs a screen and taps, use a cloud Android phone.
  • Limits and errors: Lifetime, execution timeout, file and network bounds and error codes.