Skip to main content

Module condition

Module condition 

Source
Expand description

Declarative edge conditions.

Edges are data, not closures: every edge carries a Condition that the engine evaluates against the consumer state S and the value store after the source node completes. Named conditions resolve through a per-S registry the consumer fills at graph construction, which is what makes routing predicates serializable and GUI-renderable: the name serializes, the closure does not need to.

The Condition::Custom variant is the escape hatch for the long tail of predicates. It never truly serializes — only its label survives a definition round-trip, and instantiation fails closed unless a condition with the same label is registered. Keep the share of custom conditions low (target ≥90% named per consumer crate); the moment half the edges in real graphs are custom closures, the GUI loses its representational value.

Structs§

ConditionEval
Evaluation context handed to conditions when a source node completes (or fails).
NamedConditionId
Registry key for a consumer-registered named condition, e.g. "my-crate.has_tool_calls".

Enums§

Condition
A declarative predicate deciding whether an edge fires.

Type Aliases§

ConditionFn
The shared signature of named condition predicates registered by consumers.
ConditionMap
Map of condition name -> predicate, carried by the graph so condition evaluation needs no engine-side global state.