---
sidebar:
  hidden: true
title: roboto.domain.triggers.sources
---
What makes a trigger fire: a platform event subscription or a schedule.

A trigger has exactly one firing source. Both kinds feed the same condition and the same targets, and a target cannot tell which one fired it beyond what the event namespace exposes.

## Module Contents

### EventSubscription

```python
class roboto.domain.triggers.sources.EventSubscription(/, **data: Any)
```

`from roboto.domain.triggers import EventSubscription`

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

Bases: `_SourceBase`

Fire when any of the subscribed platform events occurs.

Carries `once_per` because it only means something here: it names what the *event* is about that the trigger fires at most once for, and a schedule has no such subject.

**Parameters**

- **data** (`Any`)

**Attributes**

- **EventSubscription.events** (`list[roboto.domain.platform_events.PlatformEventType]`): Event types the trigger subscribes to. At least one; a condition may only reference namespace roots exposed by every subscribed event.
- **EventSubscription.once_per** (`roboto.domain.platform_events.OncePer`): What the trigger fires at most once per: the occurrence, or an entity the event names. Must be legal for every subscribed event type.
- **EventSubscription.type** (`Literal[TriggerSourceType]`): Discriminator for [`TriggerSource`](/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.TriggerSource).

#### EventSubscription.fires_for()

```python
def fires_for(event_type: roboto.domain.platform_events.PlatformEventType) -> bool
```

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

Return whether an event of `event_type` is one this subscription fires for.

**Parameters**

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

**Returns**

- `bool`

### Schedule

```python
class roboto.domain.triggers.sources.Schedule(/, **data: Any)
```

`from roboto.domain.triggers import Schedule`

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

Bases: `_SourceBase`

Fire on a cron schedule, in UTC.

Each scheduled minute fires the trigger once (`once_per='occurrence'` over the schedule tick). A missed minute is skipped rather than replayed later, so a delayed schedule never floods targets with backdated firings. Cron expressions are evaluated in UTC; a schedule cannot name a time zone.

**Parameters**

- **data** (`Any`)

**Attributes**

- **Schedule.cron** (`str`): A five-field cron expression (`minute hour day-of-month month day-of-week`), evaluated in UTC — e.g. `0 9 * * 1` for 09:00 UTC every Monday.
- **Schedule.type** (`Literal[TriggerSourceType]`): Discriminator for [`TriggerSource`](/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.TriggerSource).

**Properties**

- **Schedule.once_per** (`roboto.domain.platform_events.OncePer`): A schedule always fires once per scheduled minute.

#### Schedule.fires_for()

```python
def fires_for(event_type: roboto.domain.platform_events.PlatformEventType) -> bool
```

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

Return whether `event_type` is the schedule occurrence this source fires for.

**Parameters**

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

**Returns**

- `bool`

### TriggerSource

```python
roboto.domain.triggers.sources.TriggerSource
```

`from roboto.domain.triggers import TriggerSource`

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

A trigger's firing source, discriminated on `type`.

### TriggerSourceType

```python
class roboto.domain.triggers.sources.TriggerSourceType
```

`from roboto.domain.triggers import TriggerSourceType`

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

Bases: `roboto.compat.StrEnum`

Discriminator for [`TriggerSource`](/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.TriggerSource).

**Attributes**

- **TriggerSourceType.Events** = `'events'`: The trigger fires when a subscribed platform event occurs.
- **TriggerSourceType.Schedule** = `'schedule'`: The trigger fires on a cron schedule.
