Sequences

Last updated on November 23, 2026

A sequence is a group of phases written once in its own YAML file and called from a procedure with uses:. Product A runs groups 1, 2 and 3, product B runs groups 2, 4 and 5: each group is a sequence file, and each procedure calls the ones it needs.

A call has its own outcome, and the run page shows its phases nested under it. Stations need CLI 2.2.0 or newer.

Call a sequence

Add a uses: entry to setup, main or teardown, where a phase would go. The value is the sequence file, relative to the file that calls it.

name: Product A

main:
  - name: Power On
    python: phases.power_on

  - uses: sequences/calibration.yaml

  - name: Final Check
    python: phases.final_check
name: Calibration

main:
  - name: Zero
    python: phases.zero
  - name: Check
    python: phases.check

A sequence file holds name, an optional description, inputs, plugs and the lists setup, main and teardown. version, execution, unit and operated_by belong to the procedure and are refused in a sequence file. Python references, working_directory, component images and the phase panel resolve against the sequence file's directory, so the file works the same whichever procedure calls it. A dotted reference with no matching file there is imported as an installed module. A path the caller chooses comes through a file input, which the caller writes from its own folder. An image must sit under the project root, the only folder the operator UI serves: a sequence shared from outside that root takes its images from a file input the caller fills, and tofupilot validate reports image_outside_root otherwise. A sequence delivered in a Python package writes its references as module names of that package (acme_bench.phases.measure:run).

Name and key

A call shows the file's name and takes its key from it, unless it states name: or key:. Its phases are keyed under it: Check above is calibration/check in the dashboard and the run report. In the procedure, depends_on names the call by its key. State a key: on a call that other entries depend on, so renaming the file's name does not re-key it.

Call the same file twice with two keys to run it twice:

procedure.yaml
main:
  - uses: sequences/calibration.yaml
    name: Calibration before soak
    key: calib_before
  - name: Soak
    python: phases.soak
    depends_on: [calib_before]
  - uses: sequences/calibration.yaml
    name: Calibration after soak
    key: calib_after
    depends_on: [soak]

Where the file can be

FormExampleResolves against
Relative pathsequences/calibration.yaml, ../shared/bench.yamlIn a procedure, the project root (the folder of its pyproject.toml), like python:. In a sequence file, that file's directory
Package pathacme_bench:sequences/calibration.yamlA Python package installed in the procedure's environment
  • Absolute paths and ~ are refused.
  • A procedure file in a subfolder of its project writes the path from the project root. The validator refuses a path written from the file's own folder and gives the spelling that works.
  • A relative path must stay inside what a deployment ships: the project root, or the uv workspace around it. The validator reports a file outside it.
  • tofupilot deploy packs the project root only and refuses a pack that leaves a sequence file behind. A workspace deploys through a git integration.
  • A sequence in a Python package has no such limit: it is installed with the procedure's dependencies.

Inputs

A sequence declares the values it needs with inputs:, and the call gives them with with:. An input without a default is required.

name: Calibration

inputs:
  target_voltage:
    type: number
    description: Supply voltage applied during calibration
  samples:
    type: integer
    default: 10

main:
  - name: Check
    python: phases.check
    measurements:
      - name: Voltage
        validators:
          - operator: ">="
            expected_value: "{inputs.target_voltage}"
main:
  - uses: sequences/calibration.yaml
    with:
      target_voltage: 12.0
def check(phase, inputs, measurements):
    # inputs.target_voltage is the value the call gave, 12.0 here
    # inputs.samples is the default, 10
    readings = [read_voltage() for _ in range(inputs.samples)]
    measurements.voltage = min(readings)

An input's type is string, number, integer, boolean or file. The validator refuses a value of another type, an input the file does not declare, and a required input left unset.

A file input is a path to a file or a folder under the project root: a component image, a panel, a phase's python: or a working_directory. The call writes it from its own folder (the project root in a procedure, the sequence file's folder in another sequence file), a default is written from the sequence file's folder, and the phases receive it written from the project root. A value that starts with a file input, such as {inputs.stem}.png, is read from the project root too. A file input is a path: the sequence uses it as it is, as a folder ({inputs.dir}/a.py) or followed by a function ({inputs.script}:run). A module name comes through a string input. A string input used as a path keeps the caller's spelling in an image or a panel, and is read from the sequence file's folder in python: and working_directory. Inside a command, a marker is plain text that the shell reads from the command's working directory, the sequence file's folder unless the phase sets one.

{inputs.<name>} stands for a value in any field of the sequence file. A field that is exactly one marker takes the typed value, so expected_value above is a number. A marker inside a longer string is written in as text. The markers resolved when the run starts ({run.*}, {config.*}, {secrets.*} and the old {slot}, {slot_name}) and regex quantifiers like {3} are left alone.

In Python, a phase takes inputs as a parameter and reads inputs.samples or inputs["samples"].

Config and secrets

A sequence file declares the config and secrets its phases read, with the same fields as the procedure's. The values come from the procedure's run: a sequence never sets one, and the call does not pass them.

sequences/mes_upload.yaml
config:
  MES_URL:
    required: true
secrets:
  MES_TOKEN:
    required: true

main:
  - name: Upload
    python: phases.upload
    with:
      url: "{config.MES_URL}"
      token: "{secrets.MES_TOKEN}"

The sequence's phases read only the keys its file declares, as {config.KEY} in with: and env:, or config.KEY in Python. A key declared by the procedure and by a sequence file is one value: both must declare it under the same section (config: or secrets:) with the same type. It is required when any of them requires it.

A call's with: is resolved when the procedure loads, so {config.*}, {secrets.*} and {run.*} cannot be passed through it: declare the key in the sequence file instead.

Plugs

Only the procedure creates plugs. A sequence declares the plugs its phases need, and the call binds each one to a plug of the procedure.

name: Calibration

plugs:
  - name: Multimeter
    key: dmm
    python: plugs.Keysight34461A:Keysight34461A

main:
  - name: Check
    python: phases.check   # def check(phase, dmm): ...
plugs:
  - name: Bench DMM
    key: bench_dmm
    python: plugs.Keysight34461A:Keysight34461A

main:
  - uses: sequences/calibration.yaml
    plugs:
      dmm: bench_dmm

A requirement whose key matches a procedure plug's key binds without an entry. Its python is optional: when given, a bound plug of another class is reported as a warning. with: belongs to the procedure's plug.

Setup, main and teardown

Inside a call, setup runs first, main waits for all of it, and teardown runs after main whatever the outcome, also when the sequence was cut short. Phases of one list run in parallel, ordered by depends_on.

A sequence runs where it is called: from main, once per slot. A call in the procedure's setup or teardown takes scope: slot (the default) or scope: execution, and every phase of the sequence inherits it. scope: inside a sequence file is refused.

procedure.yaml
setup:
  - uses: sequences/bench_warmup.yaml
    scope: execution # once for all slots, like a shared setup phase

Dependencies

depends_on names entries of the same file. In the procedure, a phase can wait for a call by its key, which means for all of its phases. In a sequence file, phases name each other by their local keys, and never the procedure's phases, so the file stays reusable.

Nesting

A sequence file can call other sequences, up to 8 levels deep. A file that calls itself, directly or through another file, is refused.

Failure and outcome

A failing phase stops its sequence: the remaining phases are skipped and the sequence's teardown runs. The procedure then applies the call's then:, or on_first_failure. A failing nested call stops its parent the same way.

procedure.yaml
main:
  - uses: sequences/calibration.yaml
    then:
      fail: continue # the procedure goes on to the next phases
  - name: Final Check
    python: phases.final_check

On a call, then: takes fail, error and timeout, each continue or stop. A call is not retried. A failure in a setup list always stops its scope, a then: continue included. A phase that asks to stop (phase.stop(), then: pass: stop) ends the run as it does outside a sequence.

The call's outcome follows the run outcome rule applied to its phases, plus SKIP:

OutcomeIf
ERRORA phase of the sequence raised
ABORTEDThe run was stopped while the sequence ran, or a phase asked to stop
TIMEOUTA phase of the sequence exceeded its timeout
FAILA phase of the sequence failed
PASSEvery phase that ran passed
SKIPNo phase ran: the call is disabled, or an earlier failure skipped it

In the dashboard

The run page nests a call's phases under a collapsible row with its duration and outcome, and the unit page lists each run's top-level calls. Phase analytics identify a phase by its sequence path and name, so calib_before/check and calib_after/check are two phases, with a Sequence filter for procedures that use calls. Measurement Control still groups measurements by phase name across calls.

Layout

Keep sequence files next to the procedures that call them, in a sequences/ folder or a shared folder of the same repository. See Monorepos for a layout shared between several procedures.

How is this guide?

On this page