Skip to main content

Module sandbox

Module sandbox 

Source
Expand description

Sandboxes: where tools run commands and code and read and write files.

Sandbox failures are the SandboxTimeoutError, SandboxAbortError, SandboxPathNotFoundError, SandboxIsADirectoryError and SandboxPermissionError variants of Error.

Structs§

ExecuteOptions
Options for command and code execution (ExecuteOptions).
ExecutionResult
The result of a command or code execution (ExecutionResult).
FileInfo
Metadata about a file or directory in a sandbox (FileInfo).
NotASandboxLocalEnvironment
Runs commands and file operations directly on the host, with no isolation (NotASandboxLocalEnvironment). The agent’s default when no sandbox is configured.
OutputFile
A file produced by code execution, such as a chart or a PDF (OutputFile).
StreamChunk
A chunk of output from a running command or code execution (StreamChunk).

Enums§

ExecutionStreamItem
An item of an execution stream: a StreamChunk or the final ExecutionResult.
StreamType
Which output stream a StreamChunk came from (StreamType).

Constants§

ENV_KEY_PATTERN
The pattern an environment variable name must match (ENV_KEY_PATTERN): a letter or underscore, then letters, digits or underscores (POSIX names).
LANGUAGE_PATTERN
The pattern a language or interpreter name must match (LANGUAGE_PATTERN): letters, digits, dots, hyphens and underscores. Path separators, spaces and shell metacharacters are rejected.

Traits§

IntoSandbox
What the builder’s sandbox(..) setter takes: a sandbox by value, an Arc of one, or an Arc<dyn Sandbox> (kept as is, so the agent’s sandbox is the same instance).
PosixShellSandbox
A sandbox where only a POSIX shell is available, such as a container, an SSH connection or a cloud runtime (PosixShellSandbox).
Sandbox
An execution environment: where tools run commands and code and read and write files (Sandbox).

Functions§

build_shell_env_prefix
Builds the export KEY='value' && prefix that applies env to a shell command, or "" when there is none.
shell_quote
Shell-escapes a value for a POSIX shell command.
validate_env_keys
Checks environment variable names against ENV_KEY_PATTERN.

Type Aliases§

ExecutionStream
The stream returned by Sandbox::execute_streaming and Sandbox::execute_code_streaming: output chunks followed by one final ExecutionResult, or an error.