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

### Trigger

```python
class roboto.domain.triggers.trigger.Trigger(
    record: roboto.domain.triggers.record.TriggerRecord,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
)
```

`from roboto.domain.triggers import Trigger`

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

A trigger: a rule that runs targets when a platform event matches it, or on a schedule.

A trigger has one firing source (a subscription to platform events, or a cron schedule), an optional condition over the variables a firing exposes, and one or more targets: invoking an action, starting an agent, or sending a Slack message. Its targets run as its organization's service user. This class reads every trigger, including those created with the deprecated [`Trigger`](/docs/reference/python-sdk/roboto/domain/actions/trigger#roboto.domain.actions.trigger.Trigger).

Get a `Trigger` from `create`, `from_id`, `from_name`, or `list`. To wrap a [`TriggerRecord`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord) already fetched from Roboto, build a `Trigger` from it directly. Each instance holds a copy of the trigger's record, which `update` and the methods that enable or disable the trigger replace with Roboto's response.

**Parameters**

- **record** (`roboto.domain.triggers.record.TriggerRecord`): Record of the trigger.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Properties**

- **Trigger.condition** (`roboto.query.ConditionType | None`): Condition over the variables a firing exposes, which must hold for the trigger to run its targets.

  `None` runs the targets on every firing. [`condition`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord.condition) describes its format.

  Return type: `Optional[roboto.query.ConditionType]`

- **Trigger.enabled** (`bool`): Whether the trigger is enabled. A disabled trigger does not fire.

- **Trigger.engine** (`str`): Trigger model Roboto evaluates the trigger with, `"v2"` or `"v1"`.

  [`engine`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord.engine) describes the values.

- **Trigger.events** (`List[roboto.domain.platform_events.PlatformEventType] | None`): Platform event types the trigger subscribes to, or `None` for a schedule-fired trigger.

  Return type: `Optional[List[roboto.domain.platform_events.PlatformEventType]]`

- **Trigger.fires_on** (`roboto.domain.triggers.sources.TriggerSource`): What makes the trigger fire: a subscription to platform events, or a schedule.

  [`fires_on`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord.fires_on) describes the values.

- **Trigger.name** (`str`): Human-readable name of the trigger, unique within its organization.

- **Trigger.once_per** (`roboto.domain.platform_events.OncePer`): What the trigger runs each target at most once for.

  Always [`Occurrence`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer.Occurrence) for a schedule-fired trigger, which fires once per scheduled minute.

- **Trigger.org_id** (`str`): ID of the organization that owns the trigger.

- **Trigger.record** (`roboto.domain.triggers.record.TriggerRecord`): Record of the trigger that this instance holds.

- **Trigger.schedule** (`str | None`): Cron expression the trigger fires on, evaluated in UTC.

  `None` for a trigger that fires on platform events.

  Return type: `Optional[str]`

- **Trigger.targets** (`List[roboto.domain.triggers.targets.TriggerTargetSpec]`): Targets the trigger runs when it fires.

- **Trigger.trigger_id** (`str`): Unique ID of the trigger.

#### Trigger.create()

```python
@classmethod
def create(
    name: str,
    targets: list[roboto.domain.triggers.targets.TriggerTargetSpec],
    *,
    events: Optional[list[roboto.domain.platform_events.PlatformEventType]] = None,
    once_per: Optional[roboto.domain.platform_events.OncePer] = None,
    schedule: Optional[str] = None,
    fires_on: Optional[roboto.domain.triggers.sources.TriggerSource] = None,
    condition: Optional[roboto.query.ConditionType] = None,
    enabled: bool = True,
    caller_org_id: Optional[str] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> Trigger
```

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

Create a trigger.

Give exactly one firing source: `events` together with `once_per`, `schedule`, or `fires_on`. If `enabled` is `True` and the organization is at its limit of active triggers, Roboto creates the trigger disabled.

**Parameters**

- **name** (`str`): Human-readable name of the trigger, unique within its organization: letters, digits, underscores and hyphens, at most 256 characters ([`MAX_TRIGGER_NAME_LENGTH`](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.MAX_TRIGGER_NAME_LENGTH)).
- **targets** (`list[roboto.domain.triggers.targets.TriggerTargetSpec]`): Targets to run when the trigger fires. At least one, each with a `target_id` unique within the trigger.
- **events** (`Optional[list[roboto.domain.platform_events.PlatformEventType]]`): Platform event types to subscribe to. At least one. Requires `once_per`.
- **once_per** (`Optional[roboto.domain.platform_events.OncePer]`): What the trigger runs each target at most once for, such as each platform event or each dataset. Every event type in `events` must support it. Requires `events`.
- **schedule** (`Optional[str]`): Five-field cron expression to fire on, evaluated in UTC, such as `"0 9 * * 1"` for 09:00 UTC every Monday.
- **fires_on** (`Optional[roboto.domain.triggers.sources.TriggerSource]`): Firing source, an [`EventSubscription`](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.EventSubscription) or a [`Schedule`](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.Schedule), in place of `events` and `once_per` or `schedule`.
- **condition** (`Optional[roboto.query.ConditionType]`): Condition over the variables a firing exposes, such as fields under `dataset.`. The trigger runs its targets only when the condition holds. `None` runs them on every firing.
- **enabled** (`bool`): Whether the trigger is active once created.
- **caller_org_id** (`Optional[str]`): Organization to create the trigger in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Returns**

- `Trigger`: The new trigger.

**Raises**

- `ValueError`: The arguments give no firing source or more than one, or give only one of `events` and `once_per`.
- `pydantic.ValidationError`: `name` has a character other than a letter, digit, underscore or hyphen, or is longer than 256 characters, or `schedule` is not a valid cron expression.
- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The trigger's parts do not fit together, such as a condition that names a variable some subscribed platform event does not expose, or a target names an agent or Slack channel the organization does not have.
- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): A target names an action that does not exist.
- [`RobotoUnauthorizedException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): A target names an action in another organization that is not in the Action Hub, or a dataset to upload outputs to that the caller may not upload to.
- [`RobotoLimitExceededException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoLimitExceededException): A target's timeout exceeds the organization's limit for action timeouts.
- [`RobotoConflictException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoConflictException): Another trigger in the organization already has `name`.

**Usage**

Start an agent each time a dataset gains a tag:

```python
from roboto.domain.platform_events import OncePer, PlatformEventType
from roboto.domain.triggers import StartAgentTarget, Trigger
trigger = Trigger.create(
    name="analyze-tagged-datasets",
    targets=[StartAgentTarget(target_id="analyze", agent_id="agt_12345")],
    events=[PlatformEventType.DatasetTagAdded],
    once_per=OncePer.Occurrence,
)
```

Post to Slack every Monday at 09:00 UTC:

```python
from roboto.domain.triggers import SendSlackMessageTarget
weekly = Trigger.create(
    name="weekly-status",
    targets=[SendSlackMessageTarget(target_id="post", channel_id="C0123", text="Weekly check-in")],
    schedule="0 9 * * 1",
)
```

#### Trigger.delete()

```python
def delete() -> None
```

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

Delete this trigger and its dispatch history.

Deleting a trigger that no longer exists succeeds and changes nothing.

**Raises**

- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): Roboto or an ingestion rule manages the trigger (see [`managed_by`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord.managed_by)). Disable a trigger Roboto manages instead, or delete the ingestion rule that owns the trigger.

**Returns**

- `None`

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status")
trigger.delete()
```

#### Trigger.disable()

```python
def disable() -> Trigger
```

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

Disable this trigger, so it stops firing.

A trigger an ingestion rule manages cannot be disabled here; change the rule instead, such as by turning its auto-ingest off. It calls `update`, whose failures also apply.

**Returns**

- `Trigger`: This instance, with its record updated from Roboto's response.

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status").disable()
```

#### Trigger.dispatches()

```python
def dispatches(
    limit: int = 100,
) -> collections.abc.Generator[roboto.domain.triggers.dispatch.TriggerDispatchRecord, None, None]
```

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

Yield this trigger's dispatches, most recently claimed first, fetching them a page at a time.

A dispatch is one attempt to run one of the trigger's targets for a platform event that matched the trigger, so a trigger that has never matched a platform event has none. When Roboto disables the trigger itself, such as after a target's action was deleted, it also records a failed dispatch whose `status_detail` says why.

**Parameters**

- **limit** (`int`): Maximum number of dispatches per request.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The trigger no longer exists. It surfaces on the first iteration.

**Returns**

- `collections.abc.Generator[roboto.domain.triggers.dispatch.TriggerDispatchRecord, None, None]`

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status")
for dispatch in trigger.dispatches():
    print(dispatch.target_id, dispatch.status, dispatch.status_detail)
```

#### Trigger.dry_run()

```python
def dry_run(
    event: Optional[roboto.domain.platform_events.PlatformEvent] = None,
    dataset_id: Optional[str] = None,
    file_id: Optional[str] = None,
    invocation_id: Optional[str] = None,
    event_id: Optional[str] = None,
    event_type: Optional[roboto.domain.platform_events.PlatformEventType] = None,
    scheduled_for: Optional[datetime.datetime] = None,
) -> roboto.domain.triggers.dry_run.TriggerDryRunResponse
```

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

Report whether this trigger would run its targets for a platform event, without running any.

For a trigger that fires on platform events, give a complete `event`, or one of `dataset_id`, `file_id`, `invocation_id` and `event_id` for Roboto to synthesize a platform event from. For a schedule-fired trigger, give `scheduled_for` to pick the minute, or nothing to use the schedule's next occurrence.

The response lists the trigger's gates in the order Roboto checks them when the trigger fires: subscribed, enabled, condition, target prefilter, and already fired. The first gate that fails is why the trigger would not fire, and the condition gate shows the value the event supplied for each field the condition compares.

**Parameters**

- **event** (`Optional[roboto.domain.platform_events.PlatformEvent]`): Platform event to evaluate as given. It must belong to the trigger's organization, as must every entity it names.
- **dataset_id** (`Optional[str]`): ID of a dataset to synthesize a platform event about.
- **file_id** (`Optional[str]`): ID of a file to synthesize a platform event about.
- **invocation_id** (`Optional[str]`): ID of an invocation to synthesize a platform event about.
- **event_id** (`Optional[str]`): ID of an event to synthesize a platform event about: [`EventCreated`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType.EventCreated) for a dataset's event, or [`SessionEventCreated`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType.SessionEventCreated) for a session's event.
- **event_type** (`Optional[roboto.domain.platform_events.PlatformEventType]`): Type of platform event to synthesize from a `dataset_id`, `file_id`, `invocation_id` or `event_id`. `None` uses the first of the trigger's subscribed event types that the reference can produce.
- **scheduled_for** (`Optional[datetime.datetime]`): Time of the occurrence to synthesize for a schedule-fired trigger, with seconds and smaller units dropped. `None` synthesizes the schedule's next occurrence.

**Returns**

- `roboto.domain.triggers.dry_run.TriggerDryRunResponse`: Outcome of each gate, and whether the trigger would fire.

**Raises**

- `pydantic.ValidationError`: `event` is given together with another argument, or more than one of `dataset_id`, `file_id`, `invocation_id`, `event_id` and `scheduled_for` is given.
- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): `event` belongs to another organization; a trigger that fires on platform events gets neither `event` nor an entity ID, or gets `scheduled_for`; a schedule-fired trigger gets an entity ID; or the entity cannot produce `event_type`, or any subscribed event type when `event_type` is `None`.
- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The entity, or an entity `event` names, is not in the trigger's organization, or is an event the caller may not read.

**Usage**

Check whether a trigger would fire for a dataset:

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("analyze-tagged-datasets")
result = trigger.dry_run(dataset_id="ds_12345")
print(result.verdict)
```

Check a schedule-fired trigger's next occurrence:

```python
weekly = Trigger.from_name("weekly-status")
weekly.dry_run().would_fire
```

#### Trigger.enable()

```python
def enable() -> Trigger
```

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

Enable this trigger, so it fires again.

Enabling a disabled trigger checks again that every action, agent and Slack channel its targets name still exists, and fails while one does not, such as after Roboto disabled the trigger because a target's action was deleted. It calls `update`, whose failures also apply.

**Returns**

- `Trigger`: This instance, with its record updated from Roboto's response.

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status").enable()
```

#### Trigger.from_id()

```python
@classmethod
def from_id(
    trigger_id: str,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> Trigger
```

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

Fetch a trigger by ID.

Finds any trigger, including one created with the deprecated [`Trigger`](/docs/reference/python-sdk/roboto/domain/actions/trigger#roboto.domain.actions.trigger.Trigger).

**Parameters**

- **trigger_id** (`str`): ID of the trigger, beginning with `tr_`.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): No trigger has this ID.

**Returns**

- `Trigger`

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_id("tr_12345")
```

#### Trigger.from_name()

```python
@classmethod
def from_name(
    name: str,
    owner_org_id: Optional[str] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> Trigger
```

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

Fetch a trigger by name.

Trigger names are unique within an organization, so a name and an organization identify one trigger. Finds any trigger, including one created with the deprecated [`Trigger`](/docs/reference/python-sdk/roboto/domain/actions/trigger#roboto.domain.actions.trigger.Trigger).

**Parameters**

- **name** (`str`): Name of the trigger.
- **owner_org_id** (`Optional[str]`): Organization that owns the trigger. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The organization has no trigger with this name.

**Returns**

- `Trigger`

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status")
```

#### Trigger.list()

```python
@classmethod
def list(
    owner_org_id: Optional[str] = None,
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> collections.abc.Generator[Trigger, None, None]
```

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

Yield every trigger in an organization, newest first.

Includes triggers that fire on platform events and on a schedule, and those created with the deprecated [`Trigger`](/docs/reference/python-sdk/roboto/domain/actions/trigger#roboto.domain.actions.trigger.Trigger).

**Parameters**

- **owner_org_id** (`Optional[str]`): Organization whose triggers to list. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Returns**

- `collections.abc.Generator[Trigger, None, None]`

**Usage**

```python
from roboto.domain.triggers import Trigger
for trigger in Trigger.list():
    print(trigger.name, trigger.enabled)
```

#### Trigger.platform_event_samples()

```python
@classmethod
def platform_event_samples(
    roboto_client: Optional[roboto.http.RobotoClient] = None,
) -> dict[roboto.domain.platform_events.PlatformEventType, roboto.domain.triggers.samples.PlatformEventSample]
```

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

Fetch a sample of every platform event type, showing what a trigger's condition and targets can read.

Each sample holds the platform event, the record under every root a condition or target template may read for that event type, and every `<root>.<path>` a condition field or `{{ }}` placeholder may name. Use a sample to see what a condition or template resolves to before writing it. The values are made up and name nothing that exists in Roboto.

Event types that this version of the SDK's [`PlatformEventType`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType) does not name, such as one Roboto added after this version was released, are left out. Upgrade the SDK to get their samples.

**Parameters**

- **roboto_client** (`Optional[roboto.http.RobotoClient]`): Client to make requests to Roboto with. Defaults to one configured from the environment, by [`from_env()`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.from_env).

**Returns**

- `dict[roboto.domain.platform_events.PlatformEventType, roboto.domain.triggers.samples.PlatformEventSample]`: Sample of each platform event type, keyed by type.

**Usage**

```python
from roboto.domain.platform_events import PlatformEventType
from roboto.domain.triggers import Trigger
samples = Trigger.platform_event_samples()
samples[PlatformEventType.FileUploaded].paths[:3]
# ['envelope.id', 'envelope.source', 'envelope.subject']
```

#### Trigger.set_enabled()

```python
def set_enabled(enabled: bool) -> Trigger
```

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

Enable or disable this trigger.

It calls `update`, whose failures also apply.

**Parameters**

- **enabled** (`bool`): Whether to enable the trigger.

**Returns**

- `Trigger`: This instance, with its record updated from Roboto's response.

**Usage**

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("weekly-status").set_enabled(False)
```

#### Trigger.to_dict()

```python
def to_dict() -> dict[str, Any]
```

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

Return this trigger's record as a dictionary of JSON-compatible values.

**Returns**

- `dict[str, Any]`: [`TriggerRecord`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord) of the trigger, as a JSON-compatible dictionary.

**Usage**

```python
from roboto.domain.triggers import Trigger
Trigger.from_name("weekly-status").to_dict()["name"]
# 'weekly-status'
```

#### Trigger.update()

```python
def update(
    *,
    name: Union[str, roboto.sentinels.NotSetType] = NotSet,
    fires_on: Union[roboto.domain.triggers.sources.TriggerSource, roboto.sentinels.NotSetType] = NotSet,
    events: Union[List[roboto.domain.platform_events.PlatformEventType], roboto.sentinels.NotSetType] = NotSet,
    once_per: Union[roboto.domain.platform_events.OncePer, roboto.sentinels.NotSetType] = NotSet,
    schedule: Union[str, roboto.sentinels.NotSetType] = NotSet,
    condition: Optional[Union[roboto.query.ConditionType, roboto.sentinels.NotSetType]] = NotSet,
    targets: Union[List[roboto.domain.triggers.targets.TriggerTargetSpec], roboto.sentinels.NotSetType] = NotSet,
    enabled: Union[bool, roboto.sentinels.NotSetType] = NotSet,
) -> Trigger
```

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

Update this trigger.

A field left unset (`NotSet`) is unchanged. Roboto checks the updated trigger by the same rules as on create.

The firing source is replaced whole. Give `fires_on`, `schedule`, or `events` and `once_per`; when only one of `events` and `once_per` is given, the other keeps its current value. `fires_on` takes precedence over the other three, and `schedule` over `events` and `once_per`; the arguments they take precedence over are ignored.

**Parameters**

- **name** (`Union[str, roboto.sentinels.NotSetType]`): New human-readable name of the trigger, unique within its organization. Afterward `from_name` finds the trigger only under this name; its ID does not change.
- **fires_on** (`Union[roboto.domain.triggers.sources.TriggerSource, roboto.sentinels.NotSetType]`): Firing source that replaces the current one.
- **events** (`Union[List[roboto.domain.platform_events.PlatformEventType], roboto.sentinels.NotSetType]`): Platform event types to subscribe to.
- **once_per** (`Union[roboto.domain.platform_events.OncePer, roboto.sentinels.NotSetType]`): What the trigger runs each target at most once for. Required with `events` to move a schedule-fired trigger onto platform events.
- **schedule** (`Union[str, roboto.sentinels.NotSetType]`): Five-field cron expression to fire on, evaluated in UTC.
- **condition** (`Optional[Union[roboto.query.ConditionType, roboto.sentinels.NotSetType]]`): New condition. `None` clears it, so the trigger runs its targets on every firing.
- **targets** (`Union[List[roboto.domain.triggers.targets.TriggerTargetSpec], roboto.sentinels.NotSetType]`): Targets that replace the current ones. Roboto keeps which entities a target already fired for under its `target_id`, so a target given a new `target_id` fires again for them.
- **enabled** (`Union[bool, roboto.sentinels.NotSetType]`): Whether the trigger is active.

**Returns**

- `Trigger`: This instance, with its record updated from Roboto's response.

**Raises**

- `ValueError`: The trigger fires on a schedule, and `events` is given without `once_per`.
- `pydantic.ValidationError`: `name` has a character other than a letter, digit, underscore or hyphen, or is longer than 256 characters ([`MAX_TRIGGER_NAME_LENGTH`](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.MAX_TRIGGER_NAME_LENGTH)), or `schedule` is not a valid cron expression.
- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The trigger no longer exists, or a target names an action that does not.
- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): The updated trigger's parts do not fit together, a target names an agent or Slack channel the organization does not have, or the trigger is managed (see [`managed_by`](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord.managed_by)): a trigger an ingestion rule owns changes only through its rule, and one Roboto manages can only be enabled or disabled.
- [`RobotoUnauthorizedException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): A target names an action the organization may not run, or a dataset to upload outputs to that the caller may not upload to.
- [`RobotoLimitExceededException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoLimitExceededException): Enabling the trigger would put the organization over its limit of active triggers, or a target's timeout exceeds the organization's limit for action timeouts.
- [`RobotoConflictException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoConflictException): Another trigger in the organization already has `name`, or the trigger kept changing while Roboto applied the update; retry it.

**Usage**

Disable a trigger:

```python
from roboto.domain.triggers import Trigger
trigger = Trigger.from_name("analyze-tagged-datasets")
trigger.update(enabled=False)
```

Fire on dataset creation instead, keeping its `once_per`:

```python
from roboto.domain.platform_events import PlatformEventType
trigger.update(events=[PlatformEventType.DatasetCreated])
```

Clear its condition:

```python
trigger.update(condition=None)
```
