Expand description
Governed-conversation flow primitives: Flow, Step, Guard, FlowMonitor.
Modules§
- stack
FlowStack— the runtime above the DAG: a main flow plus its digressions.- timing
- Voice timing per stage: how the conversation sounds while a step is active.
- verbatim
- Verbatim stages: text the model must say word for word, verified.
Structs§
- Compiled
Flow - A validated
Flowplus its precomputedToolSurface. - Edge
- A dependency edge into a step.
- 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. - Flow
Stack - The main flow plus its digressions, with push-on-trigger and resume-on-completion.
- Guard
Trace - A
Guardevaluated to a truth tree: each predicate node with its prose description and whether it currently holds. Serializable, so a devtool can render exactly which atom a stuck step is waiting on. - 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). - Overlay
- A digression the runtime can enter: its trigger, governed flow and resume policy. Built from a compiled flow so it carries proof of compilation.
- Repair
Policy - A step’s repair policy for the weird paths (silence, no-match, the user
stalling). The stack sets
repair:{step}:repromptonce the step has been activereprompt_afterturns without completing, andrepair:{step}:escalateafterescalate_after. Whenescalate_tois set, the authoring layer lowers an extra edge gated on the escalate signal — a deterministic “give up and hand off”. - Reset
Builder - Intermediate for
reset(steps).when(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 withon_enter. 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
Surface - The precomputed tool surface of a compiled flow: every tool name the flow
reasons about (step
allow/deny,once,never…until, confirm), so introspection can enumerate and explain gating decisions. Distinct fromtool::ToolPolicy, which is a per-tool runtime policy (timeout/cache/confirm). - Verbatim
Requirement - The published requirement of the active verbatim stage.
- Violation
- A recorded conformance deviation (observe mode) or denial (enforce mode).
- Voice
Timing - Voice pacing for one stage. Every field is optional; an unset field leaves the session’s own behaviour alone.
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. - Join
- How a step’s dependency edges combine.
- Pred
- A serializable predicate atom — the closed set of guard primitives.
- Resume
- How the main flow continues after a digression (overlay) completes.
- Verdict
- The conformance status of a step.
Constants§
- DEFAULT_
REPROMPT - The reprompt sent when a stage sets
reprompt_after_msbut no text. - OVERLAY_
STATE_ KEY - The state key that names the active digression (
nullwhen the main flow is driving). Published by the control plane at every turn boundary. - TERMINATED_
STATE_ KEY - The state key raised (
true) once aResume::Terminatedigression has ended the conversation. Governance is inert from then on: no postures, no admitted tools. The runtime does not hang up by itself — the application decides how a call ends — so watch this key (orFlowStack::is_terminated) and close the session. Published by the control plane at every turn boundary. - TOOL_
CALL_ KEY - Written when the governed flow admits a tool call, before it runs:
{"tool": name, "id": call id}. WithTOOL_DENIED_KEYandTOOL_RESULT_KEYit puts every governance decision about a tool in the mutation journal, in order, which is what makes a recorded session replayable as a scenario. - TOOL_
DENIED_ KEY - Written when the governed flow refuses a tool call:
{"tool": name, "id": call id, "reason": why}. - TOOL_
RESULT_ KEY - Written when an admitted tool call completes:
{"tool": name, "id": call id, "ok": succeeded}. - VERBATIM_
KEY - The state key under which the active verbatim requirement is published.
- VOICE_
TIMING_ KEY - The state key the active stage’s merged timing is published under.
Functions§
- correction_
flag - The state key raised for one turn when the user corrects
slot: its value changed from one captured value to another. SeeFlowStack::with_correction. - escalate_
flag - The state key raised when a stage’s repair policy escalates.
- on_
enter - Build a step-enter action that runs
agentinmodewhen the step first activates. Pair withFlowMonitor::on_enter. - render_
ground - Render a grounding template against
state. - reprompt_
flag - The state key raised when a stage’s repair policy asks for a reprompt.
- verbatim_
flag - The state key holding whether
step’s text was said verbatim.
Type Aliases§
- 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::explain) can snapshot it concurrently. All monitor methods are synchronous: lock briefly and never hold the guard across anawait. - Shared
Flow Stack - A shared, lock-protected
FlowStack— the form in which the Live control plane owns governance, so runtime surfaces (e.g.LiveHandle::explain) can snapshot it concurrently. All methods are synchronous: lock briefly and never hold the guard across anawait.