Overview
Allternit Cloud Sandboxes run untrusted code in isolated virtual machines instead of the host process. Organization admins define sandbox templates that describe the runtime, source code, environment, and resource limits. A template can then be launched as a sandbox instance. A separate lower-level/sandbox/* execution API is also available for ad-hoc code execution. It can stage uploads in and return files out; see Sandbox API.
run_code in chat
The Gizzi agent has a built-inrun_code tool that analyzes attached files with Python. It does not use these VM sandboxes. It runs on the computer where the agent runs, inside the operating system sandbox (bubblewrap on Linux, sandbox-exec on macOS), with the network off and a clean environment. The script can read only its input files and the Python environment (not the home folder, other users, mounted volumes or Keychains) and can write only its run folder. Windows, Linux without bubblewrap, and computers where the sandbox can’t start (Allternit cloud computers today) refuse to run it; it never runs unsandboxed.
- Attachments are staged only from
data:URLs or allternit-api upload paths (/api/v1/uploads/<id>).file:paths and other URLs are refused. - Python 3.12 with pandas, numpy, openpyxl and matplotlib, set up once with a pinned uv (0.11.19, checksum verified).
- 60 seconds by default, 120 at most. Output is capped at 64 KB each for stdout and stderr, and files it saves at 20 files and 20 MB.
- The permission is
run_code: Auto runs it, Ask shows an approval card with the script (up to 4 KB of it), Read-only hides it. - Files it saves are stored as uploads and listed on the result. Clients draw the result from
filesandrun. Do not parse the tool’s textresult.
tool_result event and the reloaded transcript carry the same payload. When a chat is loaded with GET /api/v1/agent-sessions/:id/messages, the run_code tool part in metadata.parts has the same files and run as the live event, plus its callID:
run.skipped[].reason values:
The API reads only regular files with one link inside
<gizzi data>/runs/<session>/<call>/out/. It does not follow symlinks at any level, and it checks the size before it reads a file. The first time it sees a finished call, it stores the files and writes one record for the call. Every later read, live or reloaded, uses that record and never stores the files again. The files stay available after Gizzi deletes run folders older than 7 days.
For the user view, see Analyze files.
Base URLs
Templates and instances are managed under the organization-scoped admin prefix:Commands run sandboxed first
Shell commands run inside the session sandbox first. The assistant leaves the sandbox only on clear evidence that the sandbox caused the failure. It does not retry outside on its own. It tells you and asks you to switch off/sandbox, the per-session switch, or to set the GIZZI_SANDBOX_DISABLE environment variable. There is no per-command bypass. The assistant never retargets sensitive paths to get around a block.
Sandbox templates
Sandbox templates are scoped to an organization and can only be managed by organization owners or admins.Endpoints
Template schema
Create a template
List templates
Sandbox instances
Launching an instance runs the template source inside the sandbox runtime and records the result.Endpoints
Launch an instance
Instance schema
Stop an instance
Sandbox execution API
For ad-hoc execution, the/sandbox/* routes run code directly without creating a template or instance.
Endpoints
Execute code
Streaming execution
done event: