Notes
- Direct children run sequentially;
<Sequence>is only needed inside other control-flow components. - Input schemas run before workflow rendering. Fresh runs and
bunx smthrs graphapply Zod defaults and transforms before the workflow readsctx.input. Explicit caller values take precedence over.default()values. Coalesce only fields declared optional or nullable. - Two ways to get
<Workflow>, both equivalent. Import it directly (import { Workflow } from "smthrs") or destructure it fromcreateSmithers(...); both render the identical node, since the factory’sWorkflowis a thin pass-through injecting no schema or context, unlikeTask/Approval/Sandbox/Signal, which the factory wires to the run’s context and your output schemas. Convention: destructureWorkflowfromcreateSmithersalongsideTask,smithers, andoutputs, so a workflow’s components all come from one place, as the example above and ~95% ofexamples/do. A direct top-level import (also fine forSequence,Branch,Loop,Parallel, and other pure structural components) suits tiny single-file workflows. - Custom Drizzle tables require
runId,nodeId, anditerationcolumns with a composite primary key(run_id, node_id, iteration). Tasks outside a<Loop>writeiteration = 0.