Time Portal · Sandbox

Lifecycle and Limits

A sandbox boots, runs while it is live, and ends at a timeout, a terminate, or a failure.

States

A sandbox's clock and network stay bound to its creation Accept-Datetime for its entire lifetime (see How the Instant Works).

StateMeaning
creatingCreation accepted; VM is booting. Command and file requests return 409 until live.
liveRunning and accepting command and file requests. Usage metering starts at booted_at.
endedTerminated, timed out, or idle-expired. Files and command output are deleted and the sandbox cannot be restarted.
failedFailed to boot; see error for the reason. Does not count against your free sandbox allowance.

State transitions are one-way (creating → live → ended, or creating → failed). Once ended, create a new sandbox.

Wait for a sandbox

POST /v1/time-portal/sandbox returns 202 immediately with state: "creating". Long-poll with wait=55s until the state transitions:

cURL

bash

curl "https://api.epochal.com/v1/time-portal/sandbox/$SANDBOX_ID?wait=55s" -H "x-api-key: $EPOCHAL_API_KEY"

wait is capped at 55s (staying under standard 60-second HTTP timeouts). Loop while state is creating; booting usually takes a few seconds, occasionally over a minute.

Two timeouts

FieldDefaultRangeWhat it does
timeout1h1m to 24hThe sandbox ends this long after it boots, whatever it is doing. expires_at is booted_at + timeout. It cannot be extended.
idle_timeout10m, or timeout when that is shorter1m to timeoutThe sandbox ends after this long with no command running and no request that starts a command, sends input, or writes or removes files. Reads do not count: getting the sandbox, listing, stat, reading files, and reading output do not keep an idle sandbox alive.

Pick timeout for the longest the job can take and idle_timeout for the longest gap between your requests. A sandbox ends at whichever comes first. A command's own timeout (1h by default, up to 24h) is separate: it kills the command, not the sandbox.

How a sandbox ends

  • You terminate it. DELETE/v1/time-portal/sandbox/{id} terminates at once. Running commands end with reason sandbox_ended, and error stays null. Terminating an ended sandbox succeeds.
  • It times out. timeout passes. error is set to lifetime_expired.
  • It goes idle. idle_timeout passes with no run or write. error is set to idle_expired.
  • It fails or runs out of quota while live. error is set to out_of_memory (memory allocation exceeded), sandbox_lost (underlying host failed), or free_quota_exhausted (free sandbox allowance depleted).

Requests that run, read, or write in an ended sandbox return 409; get, list, and terminate still work, and get shows why it ended in error.

Idempotent creates

Send an Idempotency-Key header on create. A retried create with the same key and body returns the same sandbox instead of booting a second one. The same key with a different body is a 409 conflict.

Labels

metadata is up to 16 key-value pairs of your own, returned as given on every get and list. Use it to tag a sandbox with the run or task it belongs to; list returns the organization's sandboxes newest first, filtered by state if you pass one, and paged by cursor with a limit of 1 to 100, 50 when unset.

Sizes

SettingDefaultAllowed
vcpus11, 2, 4, 8, or 16
memory_gib21, 2, 4, 8, 16, 32, or 64, at most 8 per vCPU

Request limits

Parameter / OperationLimit
argv1,024 entries, 128 KiB total
env (sandbox or command)128 variables, 32 KiB total
metadata16 key-value pairs
Single exec/input request1 MiB decoded
Single file write (PUT .../files)8 MiB per chunk (upload larger files in chunks)
Single file read (GET .../files)64 MiB per Range request (16 MiB default without Range)
Single output poll (GET .../output)4 MiB across stdout and stderr
apps8 app names

Concurrency

Creating a sandbox above your organization's concurrency or rate limit returns 429 (rate_limit_exceeded) with Retry-After. To request higher limits, contact us.

Save sandbox time

A sandbox counts against your free hour while it is live, from booted_at to ended_at, idle time included; a sandbox waiting on idle_timeout is still reserved. It counts at its size: the free hour is 1 vCPU-hour and 2 GiB-hours, so a 2 vCPU, 4 GiB sandbox uses it up in 30 minutes, and two default sandboxes running at once use it up in 30 minutes each. creating and failed sandboxes count nothing, and requests to the sandbox endpoints themselves count nothing. See Pricing.

  • Terminate explicitly. Do not rely on timeout for a job that finishes early.
  • Size for the job. The default 1 vCPU and 2 GiB gets the whole free hour; doubling either halves it. Memory is the larger share for big sandboxes; 8 GiB per vCPU is the ceiling, not the default.
  • Set idle_timeout to the longest gap you need, and terminate sandboxes you are done with.
  • Watch the usage page in the console, which shows what you have used.

Next steps

Commands and Files

A command is a program you start in a live sandbox.

Images and Network

A sandbox boots the Ubuntu build chosen by its instant and reaches only what its network setting allows.

Sandbox

A sandbox is a Linux virtual machine whose clock and network are set to an instant.