Skip to main content

anona_compute.configure

Signature
Sets the E2B_* variables of this process so the stock SDK, and the extras, talk to Anona. Missing values fall back to ANONA_* variables, then to E2B_DOMAIN=compute.anonalabs.com. wait_for_capacity and on_capacity_wait set the default capacity wait of anona_compute.Sandbox in this process.
configure.py

anona_compute.Sandbox

A subclass of e2b.Sandbox. Every E2B method works unchanged; create, connect and list default to the Anona domain. Three properties are added: create also takes size ("small", "medium", "large" or "xl"), and create and connect take wait_for_capacity and on_capacity_wait.

Waiting for capacity

From anona-compute 0.3.0. When every host is full, the API answers a create with 503 sandbox_capacity_unavailable, Should-Retry: true and Retry-After while it starts another host, which takes a few minutes. Sandbox.create and Sandbox.connect (which resumes a paused sandbox) then wait and try again instead of raising: after each Retry-After, held between 1 and 30 seconds with a little jitter, until the wait runs out. Then the last error is raised unchanged. Each wait is also logged at INFO on the anona_compute logger. Only a 503 marked Should-Retry: true is retried: no capacity yet (sandbox_capacity_unavailable), the platform starting (sandbox_engine_starting) or settling (sandbox_engine_unavailable), or a size being prepared (sandbox_size_preparing). Everything else is raised at once: a plan limit (403 or 429 plan_limit_exceeded), any 4xx, and a 503 with Should-Retry: false or without the header, which comes from something in front of the API and may mean the sandbox already started. Each try keeps your request_timeout, and the E2B SDK’s own retries still apply inside each try.
capacity_wait.py
anona_compute.desktop.Sandbox takes the same arguments; only the API call is repeated, not the desktop’s start-up. The stock e2b.Sandbox and e2b.AsyncSandbox do not wait.

sandbox.live

ViewerToken has token, expires_at (datetime), embed_url, and claims() (decodes the payload without verifying it). Its repr never shows the token.
live_tokens.py
Invalid arguments raise e2b.InvalidArgumentException before any request. Gateway errors map to the E2B exceptions: 400 InvalidArgumentException, 401/403 AuthenticationException, 404 NotFoundException, 429 RateLimitException.

sandbox.ssh

SshCertificate has cert, user, host, proxy_command, expires_at, and write(path) (writes with mode 0600). See SSH for a full example.

sandbox.idle_pause

Pauses the sandbox once nothing has used it for a while. Not the same as lifecycle={"on_timeout": "pause"}, which acts when the deadline runs out; idle pause has no deadline. See Lifecycle for what counts as use.
idle_pause_sdk.py
Resume with Sandbox.connect(sandbox_id).

anona_compute.desktop.Sandbox

A subclass of e2b_desktop.Sandbox (install anona-compute[desktop]) with the same live, ssh and capacity wait, plus: See Desktop.

Constants

anona_compute.DEFAULT_DOMAIN ("compute.anonalabs.com"), anona_compute.DEFAULT_API_URL, anona_compute.ENV_MAP, anona_compute.MAX_IDLE_PAUSE_MINUTES (10080), anona_compute.DEFAULT_WAIT_FOR_CAPACITY (600), anona_compute.__version__.