Skip to content

Write workflows with an agent

This page is for a coding agent that writes or changes a Winslow workflow. Point the agent to it from the instructions of your project, for example with one line in AGENTS.md:

Before you write or change a workflow, read https://winslow-workflow.org/agent-guide/ in full.

Winslow owns the order of the work and its state. A workflow is made only of the parts on this page.

The part for each need

The need The part The page
Is this task relevant for the current config? is_eligible(), or eligibility_constraints Tasks
May Winslow check the task now? can_check(), or checkability_constraints Tasks
Is the work done? check(), or success_constraints Tasks
May the task run now? can_run(), or runnability_constraints Tasks
Do the work run() Tasks
Give the reason for an outcome a signal and its message Tasks
Give data with the reason the context of a signal Tasks
Order the tasks dependencies Dependencies
Select tasks a filter: a name, !g for a group, !a for an agent Filters
Put tasks in a group groups Dependencies
Name the agent that does the work agent_name Tasks
Review the work of a task Producer and Reviewer Reviews
Make one task for each item Parameter and get_parameters Parameterization
Share a rule between tasks a Constraint Constraints
Share a value between tasks a workflow cache Caching

A task has check(), run(), the gates and its declarations. The parts above decide the order of the tasks, their state and their selection.

Select the gate

Each gate answers one question. The order of the methods gives the moment of each call.

  • is_eligible() answers whether the task belongs to this run. A task that does not belong is SKIPPED, and a skipped task is not a fault.
  • can_check() answers whether the check can be trusted now. Use it when check() reads data that arrives later. The task is then BLOCKED until the data is there.
  • can_run() answers whether the change is safe now. Winslow asks it for a task with a run(), after the check of that task fails.

The rules

  • The system is the source of truth. A task keeps no state. check() reads the system on every call.
  • A task answers for itself. It reads the system and its own config.
  • One task does one job.
  • A rule that two tasks share is a constraint. The constraint gives the reason with reject, and the list that holds it selects the status (see Reject with a reason). A rule of one task is in the check() or the gate of that task.
  • A message is one short line. It states what is missing, as a count when there are many items. The items go in the context of the signal.
  • Work for a person or an agent is a task without run(). Its check() calls require_action until the work is in the system.
  • The code that reads the system is a plain class or a function beside the tasks.

When a part is missing

Stop, and tell the user which part the workflow needs. The need is then a change to Winslow, and the workflow waits for that change.