pub fn restore_agent(
world: &mut World,
entity: Entity,
snapshot: &ContextSnapshot,
stage_index: usize,
iteration: usize,
totals: TokenTotals,
)Expand description
Restore a just-spawned entity to the persisted state captured in snapshot
(its context), stage_index + iteration (its position), and totals (its
running token/tool counts). The agent stays Active + ReadyToInfer so it
resumes on the next tick.
Context is overlaid by region name: each persisted region replaces the
matching window region’s entries (rebuilt from the blueprint layout, so region
kinds/limits are correct). A persisted region with no matching window region
is skipped. An out-of-range stage_index (e.g. the blueprint gained/lost
stages) leaves the spawned stage-0 config in place.