Skip to main content
A definition with steps runs other agents in order. Each step is a run of its own, with its own page, its own Learnings and its own questions for a person. The parent run holds the steps together and reports the output of the last step that ran. A definition does the work itself or runs steps. It cannot have both instructions and steps.

An example

The refund step runs when triage called the ticket a late order. If it is skipped, $refund.output.decision reads as nothing in the reply step and is not an error.

What a step names

agent is a saved agent’s name, an inline definition, or a file path such as ./triage.yaml. The sensei command and the SDK read a file in before they send the definition, and resolve relative paths against the file that names them. The service itself never reads files. A step’s id is a short lower-case name that starts with a letter. Later steps use it to read the step’s output.

Pass values between steps

In a step’s input, a string that starts with $ is a reference. Any other value is taken as written. A step can read $input and the steps before it. A reference to a step that comes later is refused when the definition is checked.

Run a step on a condition

when takes a condition. The step runs when the condition is true.
Conditions compare references, quoted strings, numbers, true, false and null with == and !=, and combine with and, or, not and parentheses.

Fan out over a list

for_each names a list from the input or from an earlier step. The step runs once per item, and $item is the item.
parallel is how many items run at once, from 1 to 10. It defaults to 1. A list can have up to 200 items.

Steps or a batch

Steps and a batch do different work, and a batch can be one of the steps. for_each over an agent that changes a repository runs the agent once per item. It does not check the changes against each other. For several changes to one repository, use a batch.

A batch as a step

A step’s agent can be a batch. The batch names the input field that holds its tasks, and the step fills that field from an earlier step:
The step is a batch like one started on its own. Every task starts from the same commit, the verified changes are tested together, and the pull requests say how each change fits with the rest. The step’s row on the run’s page says how the tasks went and opens the batch. The list is read when the step starts. It has 1 to 200 entries and each is text. A list with anything else in it fails the step, and the run says which entry. when: $list.output.changes skips the step when the list is empty. The agent that lists the tasks is an agent with an output, such as one that reads your tracker with its tools. A step that changes a repository has no output of its own shape, so it cannot be the one that lists them.

What the batch hands on

A batch where no task verified fails, and so does the run. A batch that is part verified does not: the steps after it run, and can read which tasks made it.

What it may spend

The run’s limit covers all of its steps, the batch and its tasks included: at most $50 and 120 minutes. The batch's own ceiling is its `total` or what the run has left, whichever is lower, less up to $0.50 kept for the check together. At the batch’s ceiling its unfinished tasks stop and what verified is kept and delivered. At the run’s limit the whole run stops. A batch that needs more than a run with steps may spend is started on its own.

When a step waits

A step that reaches an ask_first action waits the same way any agent run does. The parent shows Waiting for you and links to the step. Your answer goes to the step, and the parent carries on from there.

Limits

A limit on the parent covers the whole run. Each step is capped by what the parent has left. Keys that describe one computer belong on the agent a step runs: computer, repo, ref, image, tools, ask_first and check are refused beside steps.

Mark a run with steps

Right applies to every step. Wrong asks which step was wrong, and applies to the last step that ran when you leave it at Not sure. From the terminal: