# condition

Canonical URL: https://developers.iagenify.com/sdk/workflows/steps/condition/
Language: en

`type: "condition"`

Two branches. It compares two values and the graph takes true or false — both of which must exist.

Status: free · both branches required · 9 operators

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `left` | any |  | Usually a template. |
| `operator` | string | eq | One of the nine below. |
| `right` | any |  | What to compare against. Unused by `exists` and `empty`. |

## The operators {#operators}

| Operator | True when |
| --- | --- |
| `eq` · `neq` | Equal, or not. |
| `contains` | The left contains the right. |
| `gt` · `gte` · `lt` · `lte` | Ordered comparisons. |
| `exists` | The left is there at all. |
| `empty` | The left is empty. |

An unknown operator is refused when the workflow is saved.

## Both branches are required {#edges}

```javascript
edges: [
  { from: "check", to: "urgent", branch: "true" },
  { from: "check", to: "normal", branch: "false" },
]
```

> **A missing branch is refused, not defaulted**
>
> A condition with only a true edge would end the run, without a word, whenever the answer was false. Requiring both means every path is one somebody wrote.

## Output {#output}

```javascript
{{steps.check.output.result}}     // true or false
{{steps.check.output.left}}
{{steps.check.output.operator}}
```

## Branch on a schema, not on prose {#schema}

A model step with a `schema` gives a boolean. Testing whether free text contains a word breaks the first time the model writes « not urgent ».

- [switch](/sdk/workflows/steps/switch): More than two branches.
- [merge](/sdk/workflows/steps/merge): Bringing them back.
- [Workflow steps](/sdk/workflows/steps): The 23 types.

```python
edges = [
    {"from": "check", "to": "urgent", "branch": "true"},
    {"from": "check", "to": "normal", "branch": "false"},
]
```

```python
"{{steps.check.output.result}}"    # True or False
"{{steps.check.output.left}}"
"{{steps.check.output.operator}}"
```
