# Condition

Source: https://openflow.run/en/docs/nodes/condition/
Language: en
Product version: 0.1.0-beta.77

Select named execution branches using explicit comparisons of fixed or available data.

Use Condition for rules such as a status check, threshold, empty value, or exact category match. It does not call a model.

## Define branches

Each branch has a name and a `when` expression. Expressions can be combined using `all` or `any`. Set `match` to `first` for the first matching branch or `all` for every matching branch.

```json
{
  "op": "node.add", "as": "route", "type": "condition", "name": "Route a ticket",
  "config": {
    "match": "first",
    "branches": [{
      "name": "priority",
      "when": {
        "left": { "kind": "value", "value": "priority" },
        "operator": "==",
        "right": { "kind": "value", "value": "priority" }
      }
    }]
  }
}
```

Operands can select supported upstream outputs or Variables instead of a fixed value. Read the schema for operators and operand requirements.

## Connect branch paths

Use a named branch when connecting an execution edge:

```json
{ "op": "edge.connect", "source": "$route", "branch": "priority", "target": "$escalate" }
```

`otherwise` is selected when no branch matches. With `match: "all"`, more than one branch can continue; their downstream join still follows normal predecessor rules.

Condition compares the customer tier and selects the priority branch or its otherwise branch.

**Input**
The compared customer tier is "priority".

**Expected result**
Priority queue is selected. Changing the tier to another value selects Standard queue.

**Before running**
An Open Flow deployment is needed to execute or import this example. The preview itself runs offline.

[Download workflow](https://openflow.run/docs/examples/route-by-value.openflow.json)

## Data and control

Condition branch names are execution choices, not data outputs. Bind downstream business data from its actual upstream source. A handled Task’s system error can be compared here without adding an error edge.

For model-generated assessment, use [AI Decision](https://openflow.run/en/docs/nodes/decision/index.md) and route on its structured result. Condition has no ordinary Task retry or handled-error configuration.

## Sources

*   [docs/authoring/node-authoring.md](https://github.com/oomol-lab/open-flow/blob/e25a738d170322734572a0b8a1323cb00b9d355a/docs/authoring/node-authoring.md)
*   [docs/control/contracts/control-api.md](https://github.com/oomol-lab/open-flow/blob/e25a738d170322734572a0b8a1323cb00b9d355a/docs/control/contracts/control-api.md#execution-graphs-and-input-sources)
*   [packages/open-flow/src/workbench/browser/runtime/editor/addNodeOptions.ts](https://github.com/oomol-lab/open-flow/blob/e25a738d170322734572a0b8a1323cb00b9d355a/packages/open-flow/src/workbench/browser/runtime/editor/addNodeOptions.ts)
