Overview
Shell commands and Python code share the same filesystem:
Return values
sandbox.commands.run(cmd)
Returns a command result:
sandbox.code.run(code)
Returns an execution result:
For commands that run long enough to bound, watch, or feed input to — timeouts, interrupts, streaming output, and stdin — see Process I/O.
Sandbox.create() parameters
snapshot
The snapshot to boot from. Defaults to alpine. See Snapshots for the full catalog.
mounts
Mount host directories into the sandbox. Paths are read-only by default; append :rw for read-write access.
env
Environment variables the guest starts with. They reach commands, anything those
commands spawn, and code.run.
$, and backticks in a value are never
interpreted by the shell. Names must be plain identifiers.
secrets
A credential the sandbox can use but never read. The guest is given a
stand-in through its environment; the value itself goes only to the network
gateway, which swaps it back in on the way out, and only for a host you named.
Set
placeholder yourself when a client library checks the shape of a key:
trace
Records what the sandbox actually did, which programs ran, which files changed and where it connected. Off unless you ask for it, and chosen at creation:
engine
Some private snapshots come with their own engine, which runs the tools
installed in them faster. With the default "auto", the sandbox uses that engine
when it is already compiled, and otherwise starts on the engine bundled with the
SDK while the snapshot’s engine is prepared in the background for next time. See
Private snapshots.
Pass "default" to always use the bundled engine:
sandbox.tier says which engine it got: "image" for the snapshot’s own,
"aot" or "base" for the bundled one.