Hanzo AI
OpenapiSandbox

Create exec

Runs one command in a sandbox the caller holds and answers with its exit code, stdout and stderr.

POST /v1/sandbox/{id}/exec

Addresshttps://api.hanzo.ai/v1/sandbox/{id}/exec
MethodPOST
Operationpost_sandbox_by_id_exec
AuthAuthorization: Bearer $HANZO_API_KEY

Runs one command in a sandbox the caller holds and answers with its exit code, stdout and stderr.

Send argv — an argument vector cannot be word-split by accident — or command for a shell line, which is the only input here that ever reaches a shell. A non-zero exit is a SUCCESSFUL call carrying a failed command: the status is 200 and the exit code is in the answer, because "the command failed" and "the call failed" are different facts.

Request

7 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID is the sandbox to run in, from the path.
argvbodystring[]Argv is the command as an argument vector, which is the honest form: it cannot be word-split by accident.
commandbodystringCommand is a shell line, for a caller that holds one.
dirbodystringDir is the working directory to run in.
idbodystringID is the sandbox to run in, from the path.
stdinbodystringStdin is fed to the command on its standard input.
timeoutSecbodyintegerTimeoutSec bounds the run in seconds.

Response

StatusBodyMeaning
200ExecResultok

200 body — 3 fields.

FieldInTypeAlwaysDescription
exitCodebodyintegerExitCode is the command's own exit status.
stderrbodystringStderr is everything it wrote to standard error.
stdoutbodystringStdout is everything the command wrote to standard output, as text.

Failure carries the platform error shape — see Errors.

Examples

hanzo sandbox exec <id>

Sandbox API · All Hanzo APIs · Interactive reference

How is this guide?

On this page