Hanzo
OpenapiSandbox

Run a command in a sandbox you hold and read its output

Runs one command inside the caller's sandbox and answers its exit code, stdout and stderr.

POST /v1/sandbox/run

Addresshttps://api.hanzo.ai/v1/sandbox/run
MethodPOST
Operationrun_in_sandbox
AuthAuthorization: Bearer $HANZO_API_KEY

Runs one command inside the caller's sandbox and answers its exit code, stdout and stderr. A non-zero exit is a successful call carrying a failed program, so it comes back as data and not as an error.

Name a session and the command NARRATES INTO IT: its output is appended to that session's live log as the program produces it, so anything watching the session — GET /v1/agents/sessions/stream, scoped to one run with ?root= — watches the work happen rather than waiting for the verdict. Without it the call is what it always was: silent until it returns, which for an agentic run is twenty-five minutes of blank screen.

The session is named; the TENANT is not. It is the org the caller already proved, so a session belonging to somebody else is absent from the org this call acts for and the append is refused there.

Request

8 fields, body application/json (required).

FieldInTypeRequiredDescription
argvbodystring[]Argv is the program and its arguments, already split — the form no shell can misread.
blindbodystring[]Blind is the set of secrets this command must never publish. It exists because output is redacted where it is PRODUCED or not at all.
commandbodystringCommand is a shell line, run by sh -c.
dirbodystringDir runs the command somewhere other than the sandbox's working directory, which Leased.Workdir names.
idbodystringID is the sandbox to run in, from an earlier lease.
sessionbodystringSession is the live agent session this command narrates into: its output is appended there AS IT IS PRODUCED, so every surface watching that session watches…
stdinbodystringStdin is fed to the program on standard input.
timeoutSecbodyintegerTimeoutSec bounds this ONE command, so a wedged program holds the caller for its own timeout rather than for the whole lease.

Response

StatusBodyMeaning
200Ranok

200 body — 3 fields.

FieldInTypeAlwaysDescription
exitCodebodyintegerExitCode is the PROGRAM's own status — 0 succeeded, anything else is what it returned, and a Command runs under sh -c so its shell's conventions apply.
stderrbodystringStderr is standard error, kept apart from Stdout so a caller reading a program's OUTPUT is not reading its diagnostics as data. Same 1 MiB cap, same redaction.
stdoutbodystringStdout is what the program wrote to standard output, collected whole rather than streamed — to watch it arrive instead, name a RunIn.Session and read that…

Failure carries the platform error shape — see Errors.

Examples

hanzo sandboxes run

Sandbox API · All Hanzo APIs · Interactive reference

How is this guide?

On this page