Expand description
The workflow model: a named DAG of steps beginning at start nodes,
parsed from a JSON or YAML document and validated for acyclicity,
reachability, finish reachability, dependency existence, schema
well-formedness, CEL compilation and the caps.
Field checking is strict per kind: a field the kind does not declare is a validation error, not something to ignore. A misspelled key is the failure mode that hurts most here — the workflow parses, runs, and quietly does not do the thing that key was meant to configure — so an unknown field must be refused where someone is still looking at it.
The node catalogue is one table (KINDS); the validator, the executor
and --workflow-schema all read it, so a kind cannot be documented without
being validated or exposed without being described.
Structs§
- Body
- A nested sub-DAG: the body of
foreach/batch/iterate/subgraph, or one branch ofparallel/race. Body steps depend only on siblings; steps with no dependencies are the entry points; steps nothing depends on are the sinks whose outputs form the body’s result (one sink ⇒ its output; many ⇒ an object keyed by step id). - Concurrency
- Kind
Info - A step kind’s metadata.
- Retry
- State
Decl - One declared run variable.
- Step
- One step (the cross-cutting fields typed; kind fields in
spec). - Unload
- The
unload:declaration ({policy, timeout}). - Workflow
- A parsed, validated workflow.
- Workflow
Limits - Workflow
Tool - A workflow’s tool registration.
- Workflow
Tool Grant
Enums§
- Concurrency
Scope - OnError
on_errorpolicy.- OnOverflow
- OnReplay
- Priority
- Contention priority — for workflows and subagent spawns. Ordering matters: higher is more important.
- Unload
Policy - What happens to a workflow’s LIVE runs when its definition goes away —
removed from the config, replaced by another version, or
workflow.deleted. Whatever the policy, withdrawing a definition always disarms its starts, unsubscribes its MCP resources, stops admitting new runs, and pins the definition each surviving run started against, so a run’s shape never changes underneath it. - Workflow
Tool Mode
Constants§
- COMMON_
FIELDS - Cross-cutting fields every step may carry, whatever its kind. Field checking is the union of these and the kind’s own list, so a name that appears in neither is refused.
- DEFAULT_
FAN_ OUT - Lanes a
foreach/batchuses when the definition does not say. - DIALECT
- The dialect this model speaks.
- KINDS
- The node catalogue: every step kind, its start-node status, the fields it accepts, the fields it requires, whether this build executes it, and whether it carries a nested sub-DAG. This table is the single source the validator, the schema generator and the executor all consult.
- MAX_
BATCH_ PARALLEL - MAX_
ID_ LEN - MAX_
ITERATIONS - MAX_
NESTING - MAX_
STEPS - Structural caps, enforced at validation so a pathological document is refused when it is submitted rather than after it has been scheduled.
- ONE_
SHOT_ STARTS - The start kinds that do NOT keep an instance alive.
oncefires when armed andmanualonly on an explicitworkflow.run; when either finishes there is nothing left waiting, so a job-shaped instance may exit. - RAW_
FIELDS - Fields never rendered as templates before execution (expressions the step evaluates itself, and nested definitions).
- TOP
- The top-level fields a workflow document may carry. The parser and the JSON Schema both read this list, so an editor can never flag a field the loader accepts (or complete one it refuses) — they drifted apart once.
Functions§
- canonical
- Canonical JSON (sorted keys — serde_json’s Map is a BTreeMap here) for hashing.
- duration_
ms - A duration field:
"30s","5m", bare seconds, or ms as{"ms": n}. - duration_
ms_ opt Some(ms)for a duration field,Nonewhen absent/invalid.- implemented_
kinds - The kinds implemented by this build’s engine.
- is_
long_ lived_ start - Whether a start kind keeps the instance alive.
- is_
raw_ field - kind_
info - parse_
workflow - Parse + validate a dialect-3 document. Errors name every problem.
- pure_
data_ kind - Step kinds that are PURE data transforms: no external effect, no durable write of their own, fully deterministic over the run’s data. The checkpoint-before-effect rule exists to stop a crash from losing or repeating an effect, and these steps have none — a crash simply replays them from the last checkpoint and reaches the same values. So the scheduler skips the checkpoint for them, and an inline chain batches into its tick’s single checkpoint instead of paying a serialize-and-write per step, which measures at roughly 40% of such a chain’s cycles.
- start_
kinds - Every start kind, derived from
KINDSso it cannot drift from the table the parser uses. - valid_
id [a-zA-Z_][a-zA-Z0-9_-]{0,63}.- workflow_
schema - The workflow JSON Schema, as
--workflow-schemaprints it. Generated fromKINDSrather than written by hand, so the schema and the validator can never disagree about which fields a kind accepts.