quiet robotBook a call

Sandboxes

Commands and files

Running shell commands in a sandbox, and reading, writing and listing its files.

View as Markdown

Sandboxes is in early access. It is free to try, some parts are still in testing, and details may change. Sign up free

Run a command

POST /api/v1/sandboxes/{id}/exec runs one shell command and returns when it finishes.

JSON
{ "cmd": "pip install requests && python3 fetch.py", "cwd": "/home/sandbox/app", "env": { "MODE": "test" }, "timeoutMs": 120000 }
FieldNotes
cmdRequired. Run with /bin/sh -c, so pipes, && and redirects work. Up to 100,000 characters. Wrap it in bash -c '…' if you need bash.
cwdFolder to run in, as an absolute path. Default /home/sandbox.
envExtra environment variables for this command only. Responses and the audit log show only their names. Values aren't kept after the command runs.
timeoutMsDefault 60,000 (1 minute). Allowed 1,000 to 300,000 (5 minutes). A command that runs too long is stopped and returns timedOut: true.

The response is an execution with exitCode, stdout, stderr and durationMs. It comes back as:

  • 200 when the command ran (whatever its exit code), or
  • 202 with status: "pending_approval" when an approval rule held it.

Commands run as the unprivileged user sandbox with HOME=/home/sandbox. The base template has Python 3, pip, Node.js, npm, git, curl and jq.

Output is kept up to 64 KB per stream on the execution. Write bigger output to a file and read the file.

One at a time is safest. Each exec is a separate request. There's no interactive terminal or streaming output yet. For a long job, start it in the background (nohup ./job.sh > job.log 2>&1 &) and read job.log.

Files

All file calls take a path query parameter. Relative paths are inside /home/sandbox.

CallWhat it does
PUT /api/v1/sandboxes/{id}/files?path=…Writes the request body to the file, creating folders as needed. Returns { path, bytes }.
GET /api/v1/sandboxes/{id}/files?path=…Returns the file's bytes (application/octet-stream).
DELETE /api/v1/sandboxes/{id}/files?path=…Deletes the file, or the folder and everything in it.
GET /api/v1/sandboxes/{id}/files/list?path=…Lists a folder: name, path, type, size and modified for each entry. Without path, lists the home folder.
Terminal
curl -s -X PUT "$QR_BASE_URL/api/v1/sandboxes/$SBX/files?path=data/input.csv" \
  -H "Authorization: Bearer $QR_API_KEY" --data-binary @input.csv

curl -s "$QR_BASE_URL/api/v1/sandboxes/$SBX/files?path=out/report.pdf" \
  -H "Authorization: Bearer $QR_API_KEY" -o report.pdf

Reads, writes and deletes are recorded in the audit log with the path and size.

Past commands

GET /api/v1/sandboxes/{id}/executions lists the sandbox's commands, newest first (filter with ?status=). GET /api/v1/executions/{id} gets one.