pub fn build_agent(
world: &mut World,
tool_service: &CliToolService,
config: &Config,
shared_mcp: Arc<Mutex<ToolExecutor>>,
mcp_tool_defs: &[Tool],
hub: &InteractionHub,
args: &SpawnArgs,
now_secs: i64,
subagent_tx: UnboundedSender<SubAgentOp>,
) -> Result<Entity, String>Expand description
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.
Enforces the required-at-spawn region gate - a fresh spawn whose required
caller-input regions weren’t provided fails here. Use
build_agent_for_reload on the recovery path, where the window is restored
from a snapshot afterward and the gate must not re-fire.