Skip to main content

Module spawn

Module spawn 

Source
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.

Structs§

SpawnDeps
Everything a spawn needs that is not the request itself.

Functions§

build_agent
Load the blueprint at args.blueprint_path, spawn the agent into world, register its tool state, and return the new entity. Operates on the raw ECS World so it is callable both from the host’s spawner (via PipelineWorld::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.