Skip to main content

Module step

Module step 

Source
Expand description

The effectful counterpart to crate::filter::Filter.

A Filter is a function: same config, same state, same input, same output — which is what makes content-addressed caching sound. A Step is not a function. It calls models, reads the world, decides what to run next, and may pause for a person. Forcing that into forward() would either make the trait async (colouring the whole runtime and complicating the GIL story) or make caching lie.

So Step gets its own shape: advance one turn, describe what you need, hand control back.

loop {
    match step.poll(&ctx, resume)? {
        Transition::Await(effects) => resume = Some(driver.perform(effects)),
        Transition::Done(value)    => break value,
        // Spawn / Goto / Suspend hand control to the runtime
    }
}

poll is synchronous and cheap. The driver owns the concurrency. The five Transition variants are, deliberately, the union of the control primitives every agent framework converges on: awaiting work, dynamic fan-out, handoff, interrupt, and finishing.

Structs§

StepCtx
What the runtime tells a step about where it is.
StepMeta
What the compiler and runtime need to know about a step without running it.

Enums§

Transition
What a step wants to happen next.

Traits§

Step
An effectful node.