Skip to main content

Module world

Module world 

Source
Expand description

The pipeline driver: a single PipelineWorld that hosts every agent as ECS data and ticks the crate::pipeline systems over all of them - the traditional-game-loop core of the shared world.

The world owns the bevy World, the tick Schedule, the per-model inference pools, and the async bridges (inference jobs + the tool worker). Systems never block: they dispatch async work to the bridges and collect the results on a later tick. Between ticks the driver parks on a wake Notify until an async result lands or an external message arrives, so an idle world costs ~0 CPU regardless of how many (paused/blocked) agents it holds.

§Idle detection (no busy-spin)

Each outer iteration drives the schedule to a fixed point: it ticks until a tick produces no change in the per-phase marker counts (the “fingerprint”). At quiescence every remaining agent is either waiting on an in-flight async job (which will notify on completion) or blocked on a resource that only an async completion can free (a full pool) or on nothing at all (a missing provider / no input) - so the driver parks on the wake instead of spinning. A fresh async result or an external send_message fires the wake and the fixed-point loop re-runs.

Structs§

AgentCounts
How many agents are in each status. See PipelineWorld::lane_snapshot.
LaneSnapshot
What the world is holding and what it is waiting on, at one instant.
PipelineWorld
The shared ECS world that hosts and drives every agent.

Enums§

TickOutcome
What one PipelineWorld::tick did.