Expand description
Flow — a governed conversation/tool DAG.
A Flow is a directed acyclic graph of Steps. A Step is the only
node type; it unifies “conversation stage” and “tool-call milestone” by
differing only in attributes, not in kind. A step is done when its
completion Guard latches true; edges (after) are dependencies. The
FlowMonitor maintains a Marking (the set of done steps) by observing
the session trace, projects active steps’ postures into turn-boundary
steering, and enforces ordering by admitting/denying tool calls.
The vocabulary is deliberately closed (see the crate docs / RFC): the only
nouns are Flow, Step, Guard, Posture, Marking, Verdict. Words
like phase, transition, watch, needs are lowering details and never
appear here.
Because every Guard atom is a named, parameterized predicate, a Flow
is fully serializable — enabling data-driven scripts edited without a
recompile. The custom closure escape hatch is available in code but is not
serializable.
Structs§
- Compiled
Flow - A validated
Flowplus its precomputedToolPolicy. - Flow
- A governed conversation/tool DAG.
- Flow
Builder - Builder for a
Flowusing the cemented verbs. - FlowCtx
- Evaluation context handed to a
Guard: the session state plus the current flow marking. - Flow
Errors - All problems found while compiling a
Flow; non-empty on failure. - Flow
Explanation - A model-readable explanation of the current control-plane state — the
foundation of
why did the assistant ask that?. - Flow
Monitor - Observes the session trace, maintains the
Marking, answers tool admissibility, and projects active postures. - Marking
- The runtime position in a flow: which steps are done and how often each tool has succeeded.
- Never
Builder - Sub-builder for
never(tool).until(guard). - Step
- A node in the flow DAG — the only node type.
- Step
Action - An action fired the first time a step becomes active: run an agent in an
AgentMode. Built withrun. The result lands in{name}:result(the name defaults to the step id), so a downstream step can complete on it viaGuard::resolved— this is how a flow drives orchestration in-session. - Tool
Policy - The precomputed tool-gating surface of a compiled flow: every tool name the flow reasons about, so introspection can enumerate and explain decisions.
- Violation
- A recorded conformance deviation (observe mode) or denial (enforce mode).
Enums§
- Constraint
- A cross-cutting flow constraint.
- Enforcement
- How a
FlowMonitortreats off-path activity — enforcement vs observation. - Flow
Error - A single problem found while compiling a
Flow. - Guard
- A boolean predicate over
(state, marking)— the only predicate type. - Pred
- A serializable predicate atom — the closed set of guard primitives.
- Verdict
- The conformance status of a step.
Functions§
- render_
ground - Render a grounding template against
state. - run
- Build a step-enter action that runs
agentinmodewhen the step first activates. Pair withFlowMonitor::on_enter.
Type Aliases§
- Mode
Deprecated - Deprecated alias for
Enforcement, kept for one release. - Shared
Flow Monitor - A shared, lock-protected
FlowMonitor— the form in which the Live control plane owns a governed flow, so runtime surfaces (e.g.LiveHandle::why_blocked) can snapshot it concurrently. All monitor methods are synchronous: lock briefly and never hold the guard across anawait.