Skip to main content
commands.run runs a shell command (/bin/bash -l -c) in the sandbox and waits for it. It returns stdout, stderr and the exit code; a non-zero exit raises an exception you can catch.
anona-compute run prints a summary on stderr when it finishes, and its cost line reads cost: unknown. Coming soon: per-run cost. Until then, see Usage and billing for what a sandbox used.
Sandbox-wide environment variables go on create: Sandbox.create("base", envs={"API_TOKEN": "…"}) or anona-compute create -e API_TOKEN=….

Install packages

Every template has sudo for user. Install what you need at runtime:
install.py
Installing packages needs internet egress, which is off by default on the free plan (see Networking). For Python and Node work, start from the python or node template so the toolchain is already there. Pause the sandbox between runs to keep what you installed.

JSON output from the CLI

--json makes exec print one JSON object per line, which suits scripts:
exec_json.sh