A parameter is a setting a workflow can change without new code, such as a threshold or a frame step. You declare it once with a default and a range; every workflow that uses the algorithm can then set its own value, and the editor builds the form for it.
Declare a parameter in code
Parameters live in a dataclass named Params, passed to the decorator as params=Params. Each field is a param(...) with a default and, for numbers, optional limits:
@dataclass
class Params:
step: int = param(1, minimum=1, title="Frame step")
smooth: int = param(1, minimum=1, maximum=15, title="Smoothing window")Read a value in run as ctx.params.smooth. The platform reads the declaration without running your code, so defaults and limits must be literals: numbers, strings, True or False, and lists.
See them in the Parameters tab
In the editor, the Parameters tab lists every parameter the Params dataclass declares, with its type, default and range; a float parameter is a decimal, so param(1.0) shows 1.0. The tab is read-only: the code is the only place a parameter is written, and a change in the code shows there at once. Click a parameter to go to its line. Add parameter inserts a new field at the cursor inside the Params class (or after its last field); fill in its name, type, default and title in the code.
A test run uses each parameter's default, so change the default in the code to try another value before you save. A default outside its range blocks the test with a message such as "Fix the value of smooth to run a test."
Where the parameters show up
After you save, the algorithm's page lists every parameter with its type, default and range.
- What the algorithm reads.
- Its parameters, with their type, default and range.
- Its saved versions, the newest first.
In the workflow editor, select the step and open Settings: each parameter is a field with its default and its range, for example "At least 1". A changed value shows on the step as a small chip. Changing a value is a change to the workflow, saved in its next revision; the algorithm itself stays the same version.
Parameters and versions
| Change | Next version |
|---|---|
| Add a parameter | Minor, for example 1.0.0 → 1.1.0 |
| Change a default, a limit or a title | Minor |
| Remove a parameter, or change its type | Major, for example 1.1.0 → 2.0.0 |
A minor version keeps every workflow that uses the algorithm working; a major one doesn't reach them until you change the step. Versions and compatibility explains why.