---
sidebar:
  hidden: true
title: roboto.domain.triggers.samples
---
Sample events: what a trigger's condition and target templates can see, shown with realistic values.

Before writing a condition or a message template, an author needs to know what `{{dataset.name}}` or `file.relative_path` will resolve to. The event catalog says which namespace roots an event exposes, but not what sits under them. A sample fills that in: it is built with the same [`EventNamespace`](/docs/reference/python-sdk/roboto/domain/triggers#roboto.domain.triggers.EventNamespace) and record models that serve a real firing, so the shape it shows is the shape a trigger sees. One coherent scenario runs through every root — one robot, one drive, one file, one action run on it — so the values read as a story rather than as placeholders.

Values are illustrative, not templates for real ids. Every id here is fabricated.

## Module Contents

- [SAMPLE_TIME](/reference/python-sdk/roboto/domain/platform_events/samples#roboto.domain.platform_events.samples.SAMPLE_TIME) (data): The instant every sample event and record is dated from, so samples are stable across calls.

- [sample_platform_event()](/reference/python-sdk/roboto/domain/platform_events/samples#roboto.domain.platform_events.samples.sample_platform_event) (function): A valid, fully populated event of `event_type` from the sample scenario.

### PlatformEventSample

```python
class roboto.domain.triggers.samples.PlatformEventSample(/, **data: Any)
```

`from roboto.domain.triggers import PlatformEventSample`

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

Bases: `pydantic.BaseModel`

One event type, dereferenced: the envelope, every root it exposes, and the template paths that resolve against them.

**Parameters**

- **data** (`Any`)

**Attributes**

- **PlatformEventSample.event** (`dict[str, Any]`): The event envelope as it would arrive: id, type, time, org, and payload.
- **PlatformEventSample.event_type** (`roboto.domain.platform_events.PlatformEventType`): The event type this sample illustrates.
- **PlatformEventSample.namespace** (`dict[str, dict[str, Any]]`): Every namespace root a condition or template may reference for this event type, keyed by root name, with the full record under each. Always includes `envelope` and `trigger`; the rest are the catalog's exposed roots for the type.
- **PlatformEventSample.paths** (`list[str]`): Every `root.path` a `{{ }}` placeholder or condition field may name, in the order the roots and their fields appear in [`namespace`](/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.PlatformEventSample.namespace).

### PlatformEventSamplesResponse

```python
class roboto.domain.triggers.samples.PlatformEventSamplesResponse(/, **data: Any)
```

`from roboto.domain.triggers import PlatformEventSamplesResponse`

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

Bases: `pydantic.BaseModel`

Wire shape of `GET /v1/triggers/events/samples`: one sample per platform event type.

**Parameters**

- **data** (`Any`)

**Attributes**

- **PlatformEventSamplesResponse.samples** (`dict[roboto.domain.platform_events.PlatformEventType, PlatformEventSample]`)

### SampleNamespaceSource

```python
class roboto.domain.triggers.samples.SampleNamespaceSource
```

`from roboto.domain.triggers import SampleNamespaceSource`

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

A [`NamespaceSource`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.NamespaceSource) that hydrates every root from the sample scenario.

Serves each root the way a real firing does — including `action` as the invocation's provenance and `upload` as the bare transaction id — so a sample carries exactly the roots a trigger would see.

#### SampleNamespaceSource.record_for_root()

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

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

**Parameters**

- **root** (`str`)
- **event** (`roboto.domain.platform_events.PlatformEvent`)

**Returns**

- `Optional[collections.abc.Mapping[str, Any]]`

### platform_event_sample()

```python
def roboto.domain.triggers.samples.platform_event_sample(
    event_type: roboto.domain.platform_events.PlatformEventType,
    catalog: roboto.domain.platform_events.PlatformEventCatalog = DEFAULT_PLATFORM_EVENT_CATALOG,
) -> PlatformEventSample
```

`from roboto.domain.triggers import platform_event_sample`

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

Build the sample for one event type.

The `event`, `changed` and `tag` roots are built by the same [`EventNamespace`](/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.EventNamespace) that serves them when a trigger fires; the entity roots are exactly the ones `catalog` exposes for the type.

**Parameters**

- **event_type** (`roboto.domain.platform_events.PlatformEventType`)
- **catalog** (`roboto.domain.platform_events.PlatformEventCatalog`)

**Returns**

- `PlatformEventSample`

### platform_event_samples()

```python
def roboto.domain.triggers.samples.platform_event_samples(
    catalog: roboto.domain.platform_events.PlatformEventCatalog = DEFAULT_PLATFORM_EVENT_CATALOG,
) -> dict[roboto.domain.platform_events.PlatformEventType, PlatformEventSample]
```

`from roboto.domain.triggers import platform_event_samples`

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

A sample for every event type in `catalog`, in catalog order.

**Parameters**

- **catalog** (`roboto.domain.platform_events.PlatformEventCatalog`)

**Returns**

- `dict[roboto.domain.platform_events.PlatformEventType, PlatformEventSample]`

### sample_trigger()

```python
def roboto.domain.triggers.samples.sample_trigger() -> roboto.domain.triggers.record.TriggerRecord
```

`from roboto.domain.triggers import sample_trigger`

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

The trigger the sample is evaluated for; what `{{trigger.*}}` sees.

**Returns**

- `roboto.domain.triggers.record.TriggerRecord`

### template_paths()

```python
def roboto.domain.triggers.samples.template_paths(
    record: collections.abc.Mapping[str, Any],
    prefix: str,
) -> list[str]
```

`from roboto.domain.triggers import template_paths`

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

Every dotted path a template may reference under `prefix`, in document order.

Walks nested mappings only. A list is a leaf, because path resolution descends through mappings and stops at anything else: `dataset.tags` is addressable, `dataset.tags.0` is not.

**Parameters**

- **record** (`collections.abc.Mapping[str, Any]`)
- **prefix** (`str`)

**Returns**

- `list[str]`
