---
sidebar:
  hidden: true
title: roboto.domain.triggers.conditions
---
## Module Contents

### ConditionMatcher

```python
class roboto.domain.triggers.conditions.ConditionMatcher(
    namespace: roboto.domain.triggers.namespace.EventNamespace,
    default_root: str,
)
```

`from roboto.domain.triggers import ConditionMatcher`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/conditions.py#L87-L147)

Evaluator of a trigger's condition against one platform event.

Roboto uses it when a trigger fires, to decide whether the trigger runs its targets; to see how a trigger's condition evaluates against an event, use [`dry_run()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.dry_run) instead.

Each leaf of the condition reads the record of the root its field names, or of `default_root` when the field names none, and compares the value there with the comparators [`Condition`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.Condition) uses in queries. A root's record is loaded only when a leaf reads it. A leaf is false, whatever its comparator, when:

- Its field starts with `topic.` or `msgpath.`. No platform event exposes topics or message paths.
- The event has no record for its root, such as when the resource was deleted before the condition ran. So the [`Comparator`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.Comparator) members `NotExists` and `IsNull` do not match a deleted resource, though a [`Not`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.ConditionOperator.Not) group over such a leaf does.

Under `Equals`, `NotEquals` and the four ordering comparators, two zoned ISO-8601 timestamps compare as instants rather than as text, so `2026-09-16T15:00:00Z` equals `2026-09-16T15:00:00+00:00`.

**Parameters**

- **namespace** (`roboto.domain.triggers.namespace.EventNamespace`): Namespace of the platform event to evaluate the condition against.
- **default_root** (`str`): Root that a condition field with no root reads from: the subscribed event type's [`default_root`](/docs/reference/python-sdk/roboto/domain/platform_events/catalog#roboto.domain.platform_events.catalog.PlatformEventDescriptor.default_root).

#### ConditionMatcher.matches()

```python
def matches(condition: Optional[roboto.query.ConditionType]) -> bool
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/conditions.py#L115-L123)

Return whether a condition holds for the event.

**Parameters**

- **condition** (`Optional[roboto.query.ConditionType]`): Condition tree to evaluate. `None` always matches.

**Returns**

- `bool`

### UNSTRIPPED_ROOTS

```python
roboto.domain.triggers.conditions.UNSTRIPPED_ROOTS: frozenset[str]
```

`from roboto.domain.triggers.conditions import UNSTRIPPED_ROOTS`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/conditions.py#L26-L28)

Roots of trigger condition fields that [`Field`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.Field) keeps in the field's lookup path.

The field parser strips the `dataset.` and `file.` prefixes, so `dataset.x` looks up `x`, but keeps any other root, so `changed.vehicle_id` is looked up whole. The set holds every root an event type in the default platform event catalog exposes, plus `envelope` and `trigger`, minus `dataset` and `file`.

### explicit_root()

```python
def roboto.domain.triggers.conditions.explicit_root(
    condition: roboto.query.Condition,
) -> Optional[str]
```

`from roboto.domain.triggers.conditions import explicit_root`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/conditions.py#L56-L84)

Return the root a condition leaf's field names, or `None` if the field names no root.

Roboto calls this when a trigger is created or updated, through [`validate()`](/docs/reference/python-sdk/roboto/domain/triggers/validation#roboto.domain.triggers.validation.TriggerValidator.validate), to check that the trigger's condition reads only roots every subscribed platform event exposes, and when it evaluates a trigger's condition against a platform event, to read each leaf from the right record. A field names a root when it starts with `dataset.`, `file.`, `topic.` or `msgpath.`, which return `"dataset"`, `"file"`, `"topic"` and `"message_path"`, or when its first segment is in `UNSTRIPPED_ROOTS`, such as `changed` in `changed.vehicle_id`. A field that names no root reads from the subscribed event type's default root.

**Parameters**

- **condition** (`roboto.query.Condition`): Condition leaf whose field to read the root of.

**Returns**

- `Optional[str]`: Root the field names, such as `"dataset"` or `"changed"`, or `None` when it names none.

### iter_leaf_conditions()

```python
def roboto.domain.triggers.conditions.iter_leaf_conditions(
    condition: roboto.query.ConditionType,
) -> collections.abc.Iterator[roboto.query.Condition]
```

`from roboto.domain.triggers.conditions import iter_leaf_conditions`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/conditions.py#L36-L53)

Yield every leaf [`Condition`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.Condition) in a condition tree, depth-first.

Roboto calls this when a trigger is created or updated, to check each leaf of its condition, and when it evaluates a trigger's condition against a platform event, including in a dry run. A [`ConditionGroup`](/docs/reference/python-sdk/roboto/query/conditions#roboto.query.conditions.ConditionGroup) is never yielded itself, whatever its operator; the conditions inside it are.

**Parameters**

- **condition** (`roboto.query.ConditionType`): Condition tree to walk. A single leaf is yielded alone.

**Yields**

- Each leaf condition, in the order it appears in the tree.

**Returns**

- `collections.abc.Iterator[roboto.query.Condition]`
