Skip to main content

Module sandbox_manager

Module sandbox_manager 

Source
Expand description

Per-agent sandbox lifecycle and shell-command routing.

A SandboxManager owns every sandbox an agent needs: it creates the containers its stages call for eagerly at spawn (blocking docker run, keyed and deduplicated by config signature so identical configs across stages share one warm container), routes each shell call to the current stage’s sandbox, and tears every container down at reap. namespace and none kinds need no persistent state - they are pure per-exec command wrapping.

It implements leviath_tools::ShellExecutor, so the built-in shell tool runs its command inside the sandbox transparently; file tools stay on the host over the bind-mounted workdir. The create/dedup/error logic is factored behind an injected command-runner (build_with) so it is unit-testable with no container runtime installed.

Structs§

SandboxManager
Owns an agent’s sandboxes for its whole lifetime. Created at spawn, updated per stage via Self::set_stage, torn down at reap via Self::destroy_all.