Expand description
The daemon spawner: turns a SpawnArgs request into a live agent in the
shared world - the CLI-side policy the runtime host calls for a Spawn
control op.
It loads the blueprint, resolves each stage’s provider/model (against the
world’s registered providers) and effective tool set, spawns the agent via
leviath_runtime::pipeline::spawn_agent, attaches its run metadata /
token totals / compaction settings, and registers its per-agent tool state
with the CliToolService. The heavy MCP connections are shared (built once
at daemon startup), so this whole path is synchronous - which lets it run
straight from the host’s control loop.
Functions§
- build_
agent - Load the blueprint at
args.blueprint_path, spawn the agent intoworld, register its tool state, and return the new entity. Operates on the raw ECSWorldso it is callable both from the host’s spawner (viaPipelineWorld::world_mut) and from a fan-out world-system. - build_
agent_ for_ reload - Like
build_agent, but skips the required-at-spawn region gate - used by restart recovery, which reloads a run that already passed the gate when first spawned and whose context window is restored from a snapshot after this call. - filter_
tools_ by_ available - Filter
alltool defs down to those a stage’savailable_toolsnames (alias-resolved). Shared by spawn-time stage resolution and the mid-run tool-service refresh so both apply Layer-1 identically. - resolve_
stage_ model - Resolve a stage’s
ModelConfigto a concrete(provider, model)against the registered providers. Honors a--modeloverride (provider/modelor a baremodel), otherwise picks the first listed model whose provider is registered, then falls back to the user default (whenallow_user_default), and finally to the config’s first listed entry. (Ported from the executor’s inline resolution.)