Runtime & Contracts¶
The isolation/placement seam (SandboxRuntime), the backend that drives the
stage → run → collect flow, the platform-neutral launch spec, and the two concrete
runtimes (K8sSandboxRuntime, KataNerdctlSandboxRuntime). store_env_for_pod derives the
store environment a pod needs from the host environment.
resoluto.sandbox.SandboxRuntime
¶
resoluto.sandbox.Backend
¶
Bases: ABC
Runs a program and returns a RunResult.
resoluto.sandbox.SubstrateBackend
¶
Bases: Backend
Runs a program in a sandbox via an injected runtime, conduit, image, and store env.
Source code in src/resoluto/sandbox/backends/substrate.py
resoluto.sandbox.SandboxLaunchSpec
¶
Bases: BaseModel
Platform-neutral spec the caller hands a runtime to launch one sandbox.
resoluto.sandbox.SandboxHandle
¶
Bases: BaseModel
resoluto.sandbox.SandboxStatus
¶
Bases: BaseModel
resoluto.sandbox.backends.substrate.store_env_for_pod
¶
Select the RESOLUTO_STORE_* env the sandbox may inherit; host AWS creds are never forwarded.
Source code in src/resoluto/sandbox/backends/substrate.py
resoluto.sandbox.runtime.k8s.K8sSandboxRuntime
¶
K8sSandboxRuntime(
*,
namespace="resoluto-sandboxes",
kubeconfig=None,
context=None,
image_pull_policy="IfNotPresent",
egress=None,
node_allocatable_memory=None,
runtime_class="kata",
)
Bases: SandboxRuntime
Source code in src/resoluto/sandbox/runtime/k8s.py
node_allocatable_memory
async
¶
Return minimum allocatable RAM in bytes across Ready nodes, 0 if unknown.
ensure_run_owner
async
¶
Create-or-get the per-run owner ConfigMap; return (name, uid).
Source code in src/resoluto/sandbox/runtime/k8s.py
delete_run_owner
async
¶
Delete the per-run owner ConfigMap, triggering k8s cascade GC (404-safe).
Source code in src/resoluto/sandbox/runtime/k8s.py
reap_stale_run_owners
async
¶
Delete run-owner ConfigMaps older than max_age_s and not keep_run_id; return count.
Source code in src/resoluto/sandbox/runtime/k8s.py
count_active_pods
async
¶
Count non-terminal sandbox pods in the namespace, optionally filtered by resoluto.kind.
Source code in src/resoluto/sandbox/runtime/k8s.py
resoluto.sandbox.runtime.kata_nerdctl.KataNerdctlSandboxRuntime
¶
KataNerdctlSandboxRuntime(
*,
address,
namespace,
conduit_host_dir,
conduit_mount="/conduit",
runtime="io.containerd.kata.v2",
cni_path=None,
cni_netconfpath=None,
network="bridge",
nerdctl="nerdctl",
sudo=False,
egress_domains_file=None,
net_subnet="10.222.0.0/24",
egress_proxy_port=3129,
dind_graph_dir="/var/lib/resoluto-local/dind-graph",
)
Bases: SandboxRuntime
Launches each sandbox as a Kata microVM via nerdctl against a dedicated containerd.
Source code in src/resoluto/sandbox/runtime/kata_nerdctl.py
apply_egress
async
¶
Set THIS run's egress. Deny-all (empty/None) provisions NOTHING host-side — the guest
launches --network none (no NIC, no firewall). A non-empty allowlist stands up the egress
enforcement HERE, per run: a SNI proxy + iptables scoped to the sandbox bridge subnet. No setup
script, nothing persistent — clear_egress/aclose tears it all down.
Source code in src/resoluto/sandbox/runtime/kata_nerdctl.py
clear_egress
async
¶
Tear down this run's egress enforcement (proxy + iptables + domains file). Deny-all.
aclose
async
¶
from_env
classmethod
¶
Builds an instance from the RESOLUTO_LOCAL_* environment knobs.