How a workflow script is built, read left to right: declare -> the atom -> compose -> observe. Hover any box for its signature, options, and a real example.
Declaration + inputs
• meta -- the one required line: a pure-literal { name, description, phases }. Declares the workflow before the body runs.
• args -- the value you passed into the tool, verbatim. Parameterizes a named workflow (a question, a path, a config).
• budget -- the turn's token target: { total, spent(), remaining() }. Scale depth dynamically; total is null when no target was set.
The atom & composition
• agent(prompt, opts?) -- spawn ONE subagent. Returns its text, or a validated object when you pass opts.schema. The unit everything else builds on.
• parallel(thunks) -- run thunks concurrently with a BARRIER: awaits every one before returning. Failed thunks resolve to null -> filter them.
• pipeline(items, ...stages) -- run each item through all stages independently, NO barrier between stages. The default for multi-stage work.
• workflow(name, args?) -- run another workflow inline as a sub-step. Nests ONE level only; an agent cannot spawn workflows.
Observability
• phase(title) -- start a progress group; subsequent agent() calls are grouped under it in the live /workflows view.
• log(message) -- emit a narrator line to the user. A pure side channel: it does no work, just reports progress.
• Both are called BY the script as it runs -- they shape what the user sees, not what the workflow computes.
Reading the arrows
• Solid (emphasis) -- the main line: meta declares, then the body runs the atom.
• Solid (default) -- agent() fanned out through a composition primitive.
• Dashed -- optional or secondary: inputs feeding in, nesting, and the narration side channels.
• Left-to-right = the order you write a script: header, then atom, then how you compose and narrate it.
Data-flow diagram • Built with Archify • Press T for theme and E for export