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. Wasscheduler/workflow_run.rs; folded underworkflowso the declarative spec and its runtime live in one module. W0: a kernel-resident workflow run — the DAG state for one in-flightWorkflowSpec.
Structs§
- Classify
AndAct - A classifier followed by labeled branches, exactly one of which runs.
- Classify
Branch - One branch of a
NodeKind::Classifynode: 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. - Workflow
Node - One node in a workflow DAG: a task plus the contract its agent runs under.
- Workflow
Spec - A declarative workflow DAG.
Enums§
- Node
Kind - Control-flow kind of a workflow node.
Spawn(the default) runs the node’s agent once.Loopre-runs it until a stop condition;Classifyroutes to one branch by its result;Tournamentgenerates entrants and pairwise-judges them — all dynamic control-flow types. Additive: existing specs omitkind→Spawn. (NoEq: aTournament’s entrant tasks carry arbitrary JSON metadata, which isPartialEqbut notEq.) - Node
Trust - W3: a node’s trust level.
Quarantinednodes 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
Planclassifier plus labeledImplementbranches. - 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
Loopworker node (the task, re-run up tomax_iters, stopping early on aloop_continue=falseself-signal) followed by aVerifyeval node that scores the worker’s output against the goal/criteria and emits a structured verdict (crate::harness::verdict_output_schemaas itsoutput_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.