class LittleGhost::Runtime

Prepare the shared services that agents and workflows use across many runs. A runtime owns model resolution, loading, persistence, lookup paths, hooks, and resource factories for one Ruby setup.

configuration = LittleGhost::Configuration.new(
  root: Dir.pwd,
  models: CustomerSupportModels,
  default_model: "customer_support",
  service_name: "support-api"
)
runtime = LittleGhost::Runtime.new(configuration: configuration)

runtime.service_name # => "support-api"
runtime.root == Pathname.new(File.realpath(Dir.pwd)) # => true

Without explicit settings, construction canonicalizes the root, loads config/little_ghost.rb once through the Configuration, snapshots settings, configures instrumentation, eager-loads application constants, and builds the selected model registry and session store. Supplying settings is the lower-level path used to create a sibling runtime from an existing snapshot.

Reuse a runtime across runs. build_run creates any missing workspace and sandbox, transfers ownership only after both are built, and closes partial resources if construction fails. build creates a sibling with explicit overrides and reuses the loader only when the application root is unchanged.

Startup emits structured lifecycle instrumentation; a failed phase emits a failure event, flushes instrumentation, and re-raises the original exception. Session actor resolution must use trusted authenticated identity for tenant isolation. The default UnrestrictedSandbox is convenient application plumbing, not a security boundary for untrusted work.