Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Workflow DSL reference

The dialect is Starlark with assignments, if, for, comprehensions, def, lambda, load(), at the top level or inside a def. Every one of them runs at compile time: the compiled plan is a static graph, so a loop in the source unrolls into tasks rather than becoming a cycle.

prompt_file() and load() are the only file access, both confined below the pack directory, and a loaded module cannot re-export what it loaded. The surface has no processes, network access, clock, or randomness.

For what the engine does with the compiled graph, see Work graphs; for the normative rules, see the implementation contract.

Every lane

Available in every workflow type, playbooks included.

agent()

An agent turn driven by a prompt.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
promptstrThe turn's prompt.
harnessstrAgent harness, overriding [agent].
modelstrModel, overriding [agent].
effortstrReasoning effort, overriding [agent].
sessionsession | strJoin a durable conversation. A task in a session cannot be isolated.
depends_onlist[task]Dependencies. Readiness decides execution order; declaration order does not.
needs"any" | "all"How many dependencies must be admitted before the task is ready.
join"all" | "passed" | "settled"Which dependencies must have passed: all every one, passed at least one and only those are forwarded, settled none — it dispatches once every dependency is terminal, whatever it settled as, unless the run has already halted, and forwards each one as {status, note, output, files}.
requiredboolFalse makes the task advisory: it blocks dependents but cannot invalidate the run.
isolatedboolRun in a disposable worktree. File changes are discarded; only JSON output continues.
emitslist[str]Result fields the task promises in its JSON output.
emits_fileslist[str]Workspace files the task produces. A dependent is staged with the declared files of every dependency that passed.
overproducer.fieldMap the task over a dependency's emitted list, one instance per item.
max_fanoutintInstance cap for over, within the engine's ceiling of 256.
stage"iteration" | "epilogue"epilogue runs once after the loop concludes, and only if the run kept a candidate.

skill()

An agent turn whose prompt is a skill's instructions plus its arguments.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
skillstrSkill directory below the pack; its instructions become the prompt.
argsdictArguments appended to the instructions.
harnessstrAgent harness, overriding [agent].
modelstrModel, overriding [agent].
effortstrReasoning effort, overriding [agent].
sessionsession | strJoin a durable conversation. A task in a session cannot be isolated.
depends_onlist[task]Dependencies. Readiness decides execution order; declaration order does not.
needs"any" | "all"How many dependencies must be admitted before the task is ready.
join"all" | "passed" | "settled"Which dependencies must have passed: all every one, passed at least one and only those are forwarded, settled none — it dispatches once every dependency is terminal, whatever it settled as, unless the run has already halted, and forwards each one as {status, note, output, files}.
requiredboolFalse makes the task advisory: it blocks dependents but cannot invalidate the run.
isolatedboolRun in a disposable worktree. File changes are discarded; only JSON output continues.
emitslist[str]Result fields the task promises in its JSON output.
emits_fileslist[str]Workspace files the task produces. A dependent is staged with the declared files of every dependency that passed.
overproducer.fieldMap the task over a dependency's emitted list, one instance per item.
max_fanoutintInstance cap for over, within the engine's ceiling of 256.
stage"iteration" | "epilogue"epilogue runs once after the loop concludes, and only if the run kept a candidate.

command()

A deterministic shell task in the candidate workspace.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
runstrThe command, run through sh -c.
depends_onlist[task]Dependencies. Readiness decides execution order; declaration order does not.
needs"any" | "all"How many dependencies must be admitted before the task is ready.
join"all" | "passed" | "settled"Which dependencies must have passed: all every one, passed at least one and only those are forwarded, settled none — it dispatches once every dependency is terminal, whatever it settled as, unless the run has already halted, and forwards each one as {status, note, output, files}.
requiredboolFalse makes the task advisory: it blocks dependents but cannot invalidate the run.
isolatedboolRun in a disposable worktree. File changes are discarded; only JSON output continues.
emitslist[str]Result fields the task promises in its JSON output.
emits_fileslist[str]Workspace files the task produces. A dependent is staged with the declared files of every dependency that passed.
overproducer.fieldMap the task over a dependency's emitted list, one instance per item.
max_fanoutintInstance cap for over, within the engine's ceiling of 256.
stage"iteration" | "epilogue"epilogue runs once after the loop concludes, and only if the run kept a candidate.

evaluate()

A measurement command. Its last non-empty stdout line is a JSON object; pass = false vetoes the result and numeric score feeds grade() and top_k().

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
runstrThe command, run through sh -c.
thresholdnumberGrade the emitted score against this bound. An explicit pass wins.
direction"lower" | "higher"Which side of the threshold passes.
depends_onlist[task]Dependencies. Readiness decides execution order; declaration order does not.
needs"any" | "all"How many dependencies must be admitted before the task is ready.
join"all" | "passed" | "settled"Which dependencies must have passed: all every one, passed at least one and only those are forwarded, settled none — it dispatches once every dependency is terminal, whatever it settled as, unless the run has already halted, and forwards each one as {status, note, output, files}.
requiredboolFalse makes the task advisory: it blocks dependents but cannot invalidate the run.
isolatedboolRun in a disposable worktree. File changes are discarded; only JSON output continues.
emitslist[str]Result fields the task promises in its JSON output.
emits_fileslist[str]Workspace files the task produces. A dependent is staged with the declared files of every dependency that passed.
overproducer.fieldMap the task over a dependency's emitted list, one instance per item.
max_fanoutintInstance cap for over, within the engine's ceiling of 256.
stage"iteration" | "epilogue"epilogue runs once after the loop concludes, and only if the run kept a candidate.

report()

Publish a rendered template to a controller-configured destination. The workflow selects a destination key, never an endpoint or a credential.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
destinationstrThe configured sink to publish to.
templatestrThe template rendered into the message.
resulttaskThe task whose result the template renders.
requiredboolFalse makes the report advisory.

session()

Declare a durable agent conversation. Tasks that share one run serially under one agent config, across dependency order and loop iterations.

ArgumentTypePurpose
namestrSession identity, referenced by session =.
harnessstrDefault harness for tasks in the session.
modelstrDefault model for tasks in the session.
effortstrDefault effort for tasks in the session.

param()

Read a launch parameter. The params block must be the source's first statement, and a source that declares one compiles per run.

Takes one positional argument, name.

prompt_file()

Embed a UTF-8 file below the pack directory. Absolute paths, .., symlinks, non-files, and oversized inputs are refused.

Takes one positional argument, path.

workflow()

The source's final expression: the lane, the tasks that ship, and the result. A task constructed but not listed is a compile error.

Takes one positional argument, tasks.

ArgumentTypePurpose
type"autoresearch" | "custom" | "playbook"The lane, which decides which constructors exist.
taskslist[task]Every task that ships.
resulttaskThe task whose output is the workflow's result.

Scored lanes only

Available to type = "autoresearch" and type = "custom". A playbook does not have these in scope at all, so naming one is an unknown-name error and a did-you-mean never offers one.

propose()

The loop's candidate-producing agent turn.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
sessionsession | strThe conversation the turn belongs to.
depends_onlist[task]Dependencies.

apply()

Make the candidate live through the configured world. A failure means unscoreable, not worse.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
depends_onlist[task]Dependencies.

measure()

Run the manifest's frozen judge as one opaque measurement task.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
depends_onlist[task]Dependencies.

grade()

Fold evaluation evidence into a measurement. Evidence includes tasks that failed or never ran, which is what the score source alone cannot see.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
scoretaskThe task whose score the decision uses.
tiebreaktaskSecondary score that breaks primary-score ties.
evidencelist[task]Tasks folded into the measurement.
join"all" | "passed"Which evidence must have passed.

decide()

Apply the engine's keep-or-discard rule to a measurement. An autoresearch workflow must end here.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
measurementtaskThe measurement being ruled on.
depends_onlist[task]Dependencies, defaulting to the measurement.

top_k()

Engine-owned reducer: the best k dependency outputs by numeric score.

ArgumentTypePurpose
namestrTask identity, unique within the workflow.
kintHow many dependencies survive.
direction"lower" | "higher"Which score wins.
depends_onlist[task]The candidates being reduced.
requiredboolFalse makes the reducer advisory.

default_autoresearch()

Expand the built-in propose/apply/measure/decide loop into visible nodes, plus the tasks passed to it.

Takes one positional argument, extra_tasks.

Reserved fields

Names the engine reads and writes for itself. They are not constructor arguments; they appear in a task's own JSON output and in the inputs it receives.

A task's own JSON output

Read out of the object the task returns.

FieldTypeMeaning
status"pass" | "fail" | "skipped"Settles the task, overriding an exit code or pass. Any other value is ignored.

Inputs the engine writes

Present alongside the dependency entries, never wrapped in one.

FieldTypeMeaning
itemstrThis mapped instance's key, one per item of the list over names.
keptobjectThe kept candidate, in an epilogue task only.
outcomeobjectHow the main graph ended and what each of its tasks settled as, as {"exit": str, "tasks": {name: {"status", "note"}}}, in an epilogue task only.