Appearance
Write a workflow
An agent follows the workflow file and cannot change it, so the file is where you decide what gets checked. This page builds a workflow one step at a time: a command, an agent, a validation and an approval. Read it if you start runs with daggry run.
A workflow is one file of plain YAML: no anchors, tags or merge keys. Each step has one of five kinds: agent, command, verify, human or effect. For every key, see the Workflow file reference. The snippets on this page are illustrative.
Write a one-step workflow
Start with one step so you can run the file at once.
Create a file named
flow.yamlwith onecommandstep.yamlformat: daggry/workflow@1 steps: - id: prepare kind: command scope: anywhere run: sh scripts/prepare.shThe first line is the same in every workflow file. Each step needs an
idthat is unique in the file. Acommandstep needsrun, the shell line, andscope, the paths it can write.Choose a
scope:nothing,anywhereor a list of globs such as["drafts/**"]. No scope can include a protected path.Start a run.
shdaggry run --workflow flow.yaml --workspace <workspace> --item <item><workspace>is your project's workspace, named as the tenant config names it.<item>is the work item. For software, the workspace is a Git repository,<owner>/<name>, and the work item is the URL of an issue. On success, the command prints a run ID.textrun-0123456789abcdef
What if the run is refused?
Daggry reads the file when you start a run. If the file is not valid, no run starts. The command prints the reason and exits with 1.
text
daggry: refused: 400: workflow: workflow schema: ... (at `/steps/0/kind`)The text in backticks points at the value at fault. /steps/0/kind is the kind of the first step. For each reason, see the Workflow file reference.
Add an agent step
Add an agent step when the work needs writing or judgement. A script cannot draft a plan, and an agent can.
Add the step before the command.
yamlformat: daggry/workflow@1 steps: - id: plan kind: agent engine: <engine> prompt: Read the work item and write a plan with checkable criteria. outputs: [plan] scope: nothing - id: prepare kind: command scope: anywhere run: sh scripts/prepare.sh<engine>is the engine the agent runs on, by a name the tenant config registers.promptis the agent's instruction.outputslists what the step must hand to the next step. The step succeeds when Daggry accepts every output.Limit the scope to what the step needs. This step only reads, so its scope is
nothing.
Add a verify step
Without a verify step, nothing checks what the agent did. A verify step has no command of its own. It names validators, and Daggry runs them on the last sealed change.
Add the step after the work it checks.
yamlformat: daggry/workflow@1 steps: - id: prepare kind: command scope: ["drafts/**"] run: sh scripts/prepare.sh - id: check kind: verify validators: [project, tenant/house-style]projectruns the project's main validator.tenant/house-styleis a script validator the tenant admin declares for every project.Make sure the project has a project config that names its main validator. See Set up a project.
Ask the tenant admin to accept the project's validators. By default they do not count, and Daggry refuses the run.
A verify step passes when every validator it names passes. Outside a loop, a failed verify step fails the run. To write a validator of your own, see Add a validator.
Add an approval
Add an approval where a wrong guess would waste the night. A human step stops the run until someone runs daggry approve.
Add the step where a person must decide.
yamlformat: daggry/workflow@1 steps: - id: plan kind: agent engine: <engine> prompt: Write a plan with checkable criteria. outputs: [plan] scope: nothing - id: approve-plan kind: human waiting_for: approval - id: prepare kind: command scope: anywhere run: sh scripts/prepare.shChoose
waiting_for. The value decides what you approve.Value You approve approvalthe sealed plan input-neededthe latest sealed change Put the
humanstep after the step that produces what the person reviews. If nothing is sealed yet,daggry approveis refused.To continue the run, run
daggry approve <run-id>.
Related: