Skip to main content

ensure_runtime_initialized

Function ensure_runtime_initialized 

Source
pub fn ensure_runtime_initialized(runtime: &RuntimeContext) -> Result<()>
Expand description

Pre-build the per-sidecar snapshot for an agent-SDK userland_code bundle into the process-wide cache, so the FIRST session that uses it is already warm. Uses the shared embedded runtime directly (no per-call host lifecycle). Blocks until built; idempotent (cache hit returns immediately); no-op for empty input. Eagerly initialize the process-wide embedded V8 runtime (and its process-lifetime platform owner) before accepting VM work. Calling this at sidecar startup keeps initialization failures on the entrypoint, although correctness no longer depends on the first caller itself being a long-lived thread.