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

- [ENVELOPE_ROOT](/reference/python-sdk/roboto/domain/platform_events/catalog#roboto.domain.platform_events.catalog.ENVELOPE_ROOT) (data): `ENVELOPE_ROOT = 'envelope'`. Namespace root served from the platform event's own envelope: its id, source, subject, type, time, and org, plus the payload as published under `data`. Reserved: no event type may expose it as an entity root.

- [TRIGGER_ROOT](/reference/python-sdk/roboto/domain/platform_events/catalog#roboto.domain.platform_events.catalog.TRIGGER_ROOT) (data): `TRIGGER_ROOT = 'trigger'`. Namespace root describing the trigger being evaluated. Reserved for the consumer; no event type may expose it as an entity root.

### CHANGED_ROOT

```python
roboto.domain.triggers.namespace.CHANGED_ROOT = 'changed'
```

`from roboto.domain.triggers.namespace import CHANGED_ROOT`

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

Delta root: the metadata fields an update event put, keyed by field name.

### EventNamespace

```python
class roboto.domain.triggers.namespace.EventNamespace(
    event: roboto.domain.platform_events.PlatformEvent,
    source: NamespaceSource,
    *,
    trigger: Optional[roboto.domain.triggers.record.TriggerRecord] = None,
    _records: Optional[dict[str, Optional[Mapping[str, Any]]]] = None,
)
```

`from roboto.domain.triggers import EventNamespace`

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

Resolves dotted variable paths against a platform event.

The one namespace with three consumers: condition evaluation (whole records via [`record()`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.EventNamespace.record)), target template substitution (single paths via [`resolve()`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.EventNamespace.resolve), satisfying the [`VariableResolver`](/reference/python-sdk/roboto/templating/substitution#roboto.templating.substitution.VariableResolver) protocol), and idempotency projections. Entity-backed roots hydrate through the [`NamespaceSource`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.NamespaceSource) at most once each and are cached for the namespace's lifetime — including `None` results. The `envelope`, `changed`, `tag` and `schedule` roots are served from the event itself and never touch the source; `trigger` is served from the bound trigger (see [`bound_to()`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.EventNamespace.bound_to)) and is otherwise absent.

`envelope` carries the event's own fields plus the payload under `envelope.data`. The payload is fixed when the event is published, while an entity root reads that entity as it stands at evaluation time: on a `file.uploaded` event, `envelope.data.file_version` is the version that fired the trigger and `file.version` is the version the file is on when the condition runs. That payload field is optional on `file.uploaded`, `file.ingested` and `file.metadata_updated`, and resolves to `None` on events published before the payload carried it.

Payload values are rendered as JSON, so a timestamp under `envelope.data` is an ISO-8601 string while `envelope.time` and `schedule.scheduled_for` are `datetime` objects. Conditions compare the two forms alike; a template substitutes each in its own spelling (`2026-08-27T09:00:00Z` against `2026-08-27 09:00:00+00:00`).

**Parameters**

- **event** (`roboto.domain.platform_events.PlatformEvent`)
- **source** (`NamespaceSource`)
- **trigger** (`Optional[roboto.domain.triggers.record.TriggerRecord]`)
- **`_records`** (`Optional[dict[str, Optional[Mapping[str, Any]]]]`)

#### EventNamespace.bound_to()

```python
def bound_to(trigger: roboto.domain.triggers.record.TriggerRecord) -> EventNamespace
```

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

A view of this namespace for one trigger, in which `trigger.*` resolves.

One namespace is shared across every trigger evaluated for an event so each entity hydrates once; the trigger being evaluated is per-trigger state, so it lives on a view rather than on the shared object. The view delegates every other root to the same hydration cache -- reading `dataset.name` through it and through the parent costs one fetch in total.

**Parameters**

- **trigger** (`roboto.domain.triggers.record.TriggerRecord`): The trigger whose templates and condition are being evaluated.

**Returns**

- `EventNamespace`

#### EventNamespace.get()

```python
def get(path: str) -> Any
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/namespace.py#L159-L171)

Return the value at dotted `path` (e.g. `dataset.metadata.vehicle_id`), or `None`.

The first path segment names the root; the rest walk nested mappings. Any missing segment yields `None`.

**Parameters**

- **path** (`str`)

**Returns**

- `Any`

#### EventNamespace.record()

```python
def record(root: str) -> Optional[Mapping[str, Any]]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/namespace.py#L125-L157)

Return the whole record for namespace `root`, hydrating it at most once.

**Parameters**

- **root** (`str`): Namespace root to fetch. `envelope` yields the event's own fields, with the payload fixed at publish time under `data`; `changed` yields the changeset's put fields; `tag` yields `{"added": [...], "removed": [...]}`; `schedule` and `trigger` yield the firing schedule and the bound trigger; any other root delegates to the cached [`NamespaceSource`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.NamespaceSource).

**Returns**

- `Optional[Mapping[str, Any]]`: The record as a mapping, or `None` when the source cannot resolve the root.

#### EventNamespace.resolve()

```python
def resolve(name: str) -> Optional[str]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/domain/triggers/namespace.py#L173-L176)

Return the string form of the value at `name` for template substitution, or `None`.

**Parameters**

- **name** (`str`)

**Returns**

- `Optional[str]`

### NamespaceSource

```python
class roboto.domain.triggers.namespace.NamespaceSource
```

`from roboto.domain.triggers import NamespaceSource`

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

Bases: `Protocol`

Lazily hydrates entity-backed namespace roots for an event.

#### NamespaceSource.record_for_root()

```python
def record_for_root(
    root: str,
    event: roboto.domain.platform_events.PlatformEvent,
) -> Optional[Mapping[str, Any]]
```

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

Load the entity for namespace `root` as a JSON-able mapping.

**Parameters**

- **root** (`str`): The namespace root to hydrate (`"dataset"`, `"file"`, `"invocation"`, `"event"`, ...). Never a delta or reserved root: the namespace serves `envelope`, `trigger`, `schedule`, `changed` and `tag` itself.
- **event** (`roboto.domain.platform_events.PlatformEvent`): The event whose subject identifies the entity to load.

**Returns**

- `Optional[Mapping[str, Any]]`: The entity as a mapping, or `None` when `event` cannot resolve it (no such root for this event type, or the entity was deleted between emit and evaluation).

### TAG_ROOT

```python
roboto.domain.triggers.namespace.TAG_ROOT = 'tag'
```

`from roboto.domain.triggers.namespace import TAG_ROOT`

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

Delta root: the tags an event added and removed.
