Skip to main content

Module workflow

Module workflow 

Source
Expand description

Declarative workflow shapes — the six patterns as composable templates.

A WorkflowSpec is a pure, declarative DAG of WorkflowNodes, each carrying the per-node execution contract (role / isolation / context inheritance / model hint) that the SDK turns into an AgentRunSpec at spawn time. This is the data the template constructors below emit, and the shape a future “orchestration-as-syscall” round will lower into per-step crate::syscall::Syscalls.

Three patterns are template constructors here. The dynamic control-flow patterns — loop-until-done, classify-and-act, and tournament — are now first-class NodeKind variants (NodeKind::Loop / NodeKind::Classify / NodeKind::Tournament) driven by the unified workflow executor; the former standalone loop_until_done / tournament SDK primitives were removed in their favor (A#1). The generate→evaluate→retry quality gate is the gen_eval template (a Loop worker + a Verify eval node carrying crate::harness::verdict_output_schema); its eval/verdict compute lives in crate::harness.

Pure: no I/O, no clock, no spawning. Validation reuses TaskGraph::topological_sort.

Re-exports§

pub use run::*;

Modules§

run
The kernel-resident execution state for an in-flight WorkflowSpec — the DAG run-queue, tournament bracket advancement, and per-node spawn descriptors. Was scheduler/workflow_run.rs; folded under workflow so the declarative spec and its runtime live in one module. W0: a kernel-resident workflow run — the DAG state for one in-flight WorkflowSpec.

Structs§

ClassifyAndAct
A classifier followed by labeled branches, exactly one of which runs.
ClassifyBranch
One branch of a NodeKind::Classify node: a label and the node indices to enable when the classifier’s result selects that label. The other branches’ nodes are pruned (failed) so they never run — this is how a classify node yields conditional edges in an otherwise static DAG.
WorkflowNode
One node in a workflow DAG: a task plus the contract its agent runs under.
WorkflowSpec
A declarative workflow DAG.

Enums§

NodeKind
Control-flow kind of a workflow node. Spawn (the default) runs the node’s agent once. Loop re-runs it until a stop condition; Classify routes to one branch by its result; Tournament generates entrants and pairwise-judges them — all dynamic control-flow types. Additive: existing specs omit kindSpawn. (No Eq: a Tournament’s entrant tasks carry arbitrary JSON metadata, which is PartialEq but not Eq.)
NodeTrust
W3: a node’s trust level. Quarantined nodes read untrusted content and must run with no privileges; their output crosses into the trusted plane only as a structured summary (the SDK enforces this — the kernel carries the flag to every spawn descriptor).

Functions§

classify_and_act
Build a classify-and-act workflow: a Plan classifier plus labeled Implement branches.
fanout_synthesize
N parallel workers feeding a single synthesize barrier that depends on all of them.
gen_eval
The generate→evaluate quality gate as a workflow: a Loop worker node (the task, re-run up to max_iters, stopping early on a loop_continue=false self-signal) followed by a Verify eval node that scores the worker’s output against the goal/criteria and emits a structured verdict (crate::harness::verdict_output_schema as its output_schema).
generate_and_filter
N parallel generators feeding a single filter/dedupe step that depends on all of them.
verify_rules
One fresh-context verifier per rule/claim, optionally followed by a skeptic that re-checks every flag to suppress false positives.