runner
diapason.sandbox.runner
¶
Container runner and sandboxed agent wrapper.
ContainerRunner manages Docker container lifecycle for sandboxed
agent execution. SandboxedAgent wraps any BaseAgent to run
inside a container, following the GuardrailsEngine wrapper pattern.
ContainerRunner
¶
Manages Docker container lifecycle for sandboxed execution.
Parameters¶
image:
Docker image to run. Defaults to diapason-sandbox:latest.
timeout:
Maximum execution time in seconds.
mount_allowlist_path:
Path to a JSON mount-allowlist file.
max_concurrent:
Maximum number of concurrent containers.
runtime:
Container runtime binary name (docker or podman).
cleanup_orphans()
¶
Remove orphaned sandbox containers.
run(input_data, *, workspace='', mounts=None, secrets=None, env=None)
¶
Spawn a container, send input, parse output.
Parameters¶
input_data: JSON-serializable payload sent to the container's stdin. workspace: Working directory inside the container. mounts: Host paths to bind-mount (read-only). secrets: Key-value pairs injected into input (not env vars). env: Environment variables for the container.
Returns¶
dict Parsed JSON output from the container.
stop(container_name)
¶
Force-stop a running container.