Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RLM loop

In-tree verify/act loop: castellan run --rlm.

Sandbox host (RlmSandboxHost)

Hardened process-isolated code eval ships behind the sandbox feature on castellan-rlm (enabled by default on castellan-cli via rlm-sandbox).

BackendTypeWhen
StubSandboxHostDefault without sandbox featureReturns stub message
ProcessSandboxHostpython3 -c subprocess + timeoutsandbox_backend = "process"
HardenedProcessSandboxHostTemp workspace, no network, platform hardeningDefault (sandbox_backend = "hardened")
BubblewrapSandboxHostbwrap on PATH with ro-bind + unshare-netsandbox_backend = "bubblewrap" (falls back to hardened)
WasmSandboxHostwasmtime echo guest (minimal eval scope)sandbox_backend = "wasm" with --features wasm-sandbox (experimental; not default)

Configure via CASTELLAN_SANDBOX_BACKEND=process|hardened|bubblewrap or [rlm] sandbox_backend in castellan.toml. WASM requires the optional wasm-sandbox feature — not enabled by default.

Hardened process remains the default hot path. WASM ships a minimal echo guest for REPL eval wiring only — not Python parity.

REPL eval path

When an observation includes an rlm_eval block, the RLM loop executes code through the sandbox host before verify:

{
  "rlm_eval": { "code": "print(2 + 2)", "timeout_ms": 5000 },
  "rlm_eval_result": { "stdout": "4\n", "stderr": "", "exit_code": 0 }
}

Wiring:

  • castellan-rlm: repl_eval_observation, run_until_satisfied(..., sandbox_host), select_sandbox_host()
  • castellan run --rlm: mux RLM path uses select_sandbox_host() (hardened default)

Build / test

cargo test -p castellan-rlm --features sandbox
CASTELLAN_SANDBOX_BACKEND=bubblewrap cargo test -p castellan-rlm --features sandbox
CASTELLAN_SANDBOX_BACKEND=wasm cargo test -p castellan-rlm --features sandbox,wasm-sandbox
cargo test -p castellan-cli rlm