"local_unsafe"β subprocess in the current Python env, no policy applied."local"β subprocess in the current Python env, policy declared and partially enforced."docker_unsafe"β Docker-isolated execution via llm-sandbox, no policy applied."docker"β Docker-isolated execution via llm-sandbox, policy declared and partially enforced.
CapabilityPolicy declares what a code execution environment is allowed to do.
Enforcement is honest: each capability has a companion ENFORCED_* class attribute
indicating whether the declared value is actively enforced at runtime or is informational
only.
Artifact represents a file produced by execution and exported from the environment.
COMPATIBILITY_MATRIX records which capabilities each tier supports.
Classes
CLASS Artifact
A file produced by code execution and exported from the execution environment.
Args:
path: Absolute path on the host where the artifact was written.size_bytes: File size in bytes, orNoneif unknown.content_type: MIME type or informal label (e.g."text/csv","image/png"), orNoneif undetermined.
CLASS CapabilityPolicy
Declared capabilities and resource limits for a code execution environment.
The enforcement gap β the difference between what is declared and what is
actively enforced at runtime β is made explicit through per-field
ENFORCED_* class attributes. Callers and UX layers can read these to
decide whether to prompt the user (βallow once / allow alwaysβ) or display
a warning.
Args:
filesystem_read_roots: Host paths the environment may read.Nonemeans unrestricted. Declared only β not enforced.filesystem_write_roots: Host paths the environment may write.Nonemeans unrestricted. Declared only β not enforced.network_access: Whether outbound network connections are allowed. Defaults toFalse. Declared only β not enforced.package_installation: Whether the environment may install packages. Declared only β not enforced.subprocess_execution: Whether spawning child processes is allowed. Declared only β not enforced.env_var_access: Whether environment variables are readable. Declared only β not enforced.timeout: Wall-clock seconds before execution is killed. Enforced.stdout_max_bytes: Truncate stdout to this byte count;Nonedisables truncation. Enforced.stderr_max_bytes: Truncate stderr to this byte count;Nonedisables truncation. Enforced.artifact_export_paths: Paths inside the container/environment to copy out after execution asArtifactobjects. Enforced.packages: Python packages to install (viapip install) before execution. Enforced β the runtime installs packages prior to executing user code and aborts with a skippedExecutionResultif installation fails. Failed packages are not retried on subsequent calls (clear_failed_packageson the environment to force a retry). Local tiers useuv pip install/python -m pip; Docker tiers runpip installinside the container. Defaults to[].
FUNC unenforced_capabilities
- list[str]: Field names whose declared values are informational only.
FUNC enforced_capabilities
- list[str]: Field names whose declared values are honoured by the runtime.