---
sidebar:
  label: roboto.domain.triggers
  order: 15
title: roboto.domain.triggers
---
Triggers: rules that run targets, such as invoking an action, on matching platform events or on a schedule.

Use [`Trigger`](/docs/reference/python-sdk/roboto/domain/triggers#roboto.domain.triggers.Trigger), which replaces the deprecated [`Trigger`](/docs/reference/python-sdk/roboto/domain/actions#roboto.domain.actions.Trigger), to create, find, update, and dry-run triggers, including those the deprecated class cannot express.

## Submodules

- [roboto.domain.triggers.conditions](/docs/reference/python-sdk/roboto/domain/triggers/conditions)
- [roboto.domain.triggers.dispatch](/docs/reference/python-sdk/roboto/domain/triggers/dispatch)
- [roboto.domain.triggers.dry_run](/docs/reference/python-sdk/roboto/domain/triggers/dry_run)
- [roboto.domain.triggers.namespace](/docs/reference/python-sdk/roboto/domain/triggers/namespace)
- [roboto.domain.triggers.operations](/docs/reference/python-sdk/roboto/domain/triggers/operations)
- [roboto.domain.triggers.query_templates](/docs/reference/python-sdk/roboto/domain/triggers/query_templates)
- [roboto.domain.triggers.record](/docs/reference/python-sdk/roboto/domain/triggers/record)
- [roboto.domain.triggers.samples](/docs/reference/python-sdk/roboto/domain/triggers/samples)
- [roboto.domain.triggers.sources](/docs/reference/python-sdk/roboto/domain/triggers/sources)
- [roboto.domain.triggers.targets](/docs/reference/python-sdk/roboto/domain/triggers/targets)
- [roboto.domain.triggers.trigger](/docs/reference/python-sdk/roboto/domain/triggers/trigger)
- [roboto.domain.triggers.validation](/docs/reference/python-sdk/roboto/domain/triggers/validation)

## Package Contents

- [ActionInvocationSpec](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.ActionInvocationSpec) (class): How to invoke an action: the action, its parameter values, its inputs, and overrides of its settings.

- [ConditionLeafTrace](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.ConditionLeafTrace) (class): One comparison in a trigger's condition, with the value the dry run's event supplied for its field.

- [ConditionMatcher](/docs/reference/python-sdk/roboto/domain/triggers/conditions#roboto.domain.triggers.conditions.ConditionMatcher) (class): Evaluator of a trigger's condition against one platform event.

- [CreateTriggerRequest](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.CreateTriggerRequest) (class): Request body for [`create()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.create).

- [DispatchSlot](/docs/reference/python-sdk/roboto/domain/triggers/dispatch#roboto.domain.triggers.dispatch.DispatchSlot) (class): Slot a dispatch occupies: one target of one trigger, for the platform events that share one idempotency token.

- [DispatchSlotTrace](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.DispatchSlotTrace) (class): Dispatch slot of one target that accepts the dry run's event, showing whether the target already ran for it.

- [EventNamespace](/docs/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.EventNamespace) (class): Namespace of the values a trigger's condition and target templates read for one platform event, by dotted path.

- [EventSubscription](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.EventSubscription) (class): Firing source that fires a trigger when any of its subscribed platform events occurs.

- [InvokeActionTarget](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.InvokeActionTarget) (class): Target that invokes an action when its trigger fires.

- [MAX_TRIGGER_NAME_LENGTH](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.MAX_TRIGGER_NAME_LENGTH) (data): `MAX_TRIGGER_NAME_LENGTH = 256`. Maximum length of a trigger name, in characters.

- [ManagedBy](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.ManagedBy) (class): Owner that manages a trigger's definition in place of the organization's members.

- [ManagedByKind](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.ManagedByKind) (class): Kind of owner that manages a trigger in place of the organization's members.

- [NamespaceSource](/docs/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.NamespaceSource) (class): Loader of the entity records a platform event's roots name, such as `dataset` and `file`.

- [PlatformEventSample](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.PlatformEventSample) (class): Sample of one platform event type: the event, every root it exposes, and the paths that resolve against them.

- [PlatformEventSamplesResponse](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.PlatformEventSamplesResponse) (class): Response body of [`platform_event_samples()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.platform_event_samples).

- [SampleNamespaceSource](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.SampleNamespaceSource) (class): Namespace source that loads every entity root, such as `dataset` and `file`, from the sample records.

- [Schedule](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.Schedule) (class): Firing source that fires a trigger on a cron schedule, in UTC.

- [SendSlackMessageTarget](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.SendSlackMessageTarget) (class): Target that posts a message to a Slack channel when its trigger fires.

- [StartAgentTarget](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.StartAgentTarget) (class): Target that starts a thread from a saved agent when its trigger fires.

- [TRIGGER_NAME_PATTERN](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.TRIGGER_NAME_PATTERN) (data): `TRIGGER_NAME_PATTERN = '^[\\w\\-]+$'`. Regular expression a trigger name must match: letters, digits, underscores and hyphens only.

- [TargetAcceptanceTrace](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TargetAcceptanceTrace) (class): One target's decision on whether to accept the dry run's event.

- [Trigger](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger) (class): A trigger: a rule that runs targets when a platform event matches it, or on a schedule.

- [TriggerDispatchRecord](/docs/reference/python-sdk/roboto/domain/triggers/dispatch#roboto.domain.triggers.dispatch.TriggerDispatchRecord) (class): Data record of a trigger dispatch, as the Roboto API returns it.

- [TriggerDispatchStatus](/docs/reference/python-sdk/roboto/domain/triggers/dispatch#roboto.domain.triggers.dispatch.TriggerDispatchStatus) (class): Status of a dispatch: one attempt to run one of a trigger's targets for one matched platform event.

- [TriggerDryRunGate](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TriggerDryRunGate) (class): Result of one gate in a trigger dry run.

- [TriggerDryRunGateName](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TriggerDryRunGateName) (class): Gate a trigger dry-run result is for: a check a trigger must pass to run its targets for a platform event.

- [TriggerDryRunGateStatus](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TriggerDryRunGateStatus) (class): Outcome of one gate in a trigger dry run.

- [TriggerDryRunRequest](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TriggerDryRunRequest) (class): Request body for [`dry_run()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.dry_run).

- [TriggerDryRunResponse](/docs/reference/python-sdk/roboto/domain/triggers/dry_run#roboto.domain.triggers.dry_run.TriggerDryRunResponse) (class): Response body of [`dry_run()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.dry_run).

- [TriggerRecord](/docs/reference/python-sdk/roboto/domain/triggers/record#roboto.domain.triggers.record.TriggerRecord) (class): Data record of a trigger, as the Roboto API returns it.

- [TriggerSource](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.TriggerSource) (data): Firing source of any kind: one of `EventSubscription` and `Schedule`, told apart by `type`.

- [TriggerSourceType](/docs/reference/python-sdk/roboto/domain/triggers/sources#roboto.domain.triggers.sources.TriggerSourceType) (class): Kind of firing source, the `type` of each `TriggerSource`.

- [TriggerTargetSpec](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.TriggerTargetSpec) (data): Target of any kind: one of the target models, told apart by `type`.

- [TriggerTargetType](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.TriggerTargetType) (class): Kind of target, the `type` of each `TriggerTargetSpec`.

- [TriggerValidator](/docs/reference/python-sdk/roboto/domain/triggers/validation#roboto.domain.triggers.validation.TriggerValidator) (class): Checker for the rules that span a trigger's source, condition and targets.

- [UpdateTriggerRequest](/docs/reference/python-sdk/roboto/domain/triggers/operations#roboto.domain.triggers.operations.UpdateTriggerRequest) (class): Request body for [`update()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.update).

- [iter_query_templates()](/docs/reference/python-sdk/roboto/domain/triggers/query_templates#roboto.domain.triggers.query_templates.iter_query_templates) (function): Yield the RoboQL query of each selector in an invocation input, in the order the selectors appear.

- [map_query_templates()](/docs/reference/python-sdk/roboto/domain/triggers/query_templates#roboto.domain.triggers.query_templates.map_query_templates) (function): Return a copy of an invocation input with `transform` applied to each selector's RoboQL query.

- [platform_event_sample()](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.platform_event_sample) (function): Build the sample of one platform event type.

- [platform_event_samples()](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.platform_event_samples) (function): Build the sample of every platform event type in `catalog`, keyed by event type, in catalog order.

- [sample_trigger()](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.sample_trigger) (function): Build the sample trigger, which the `trigger` root shows in every sample but one.

- [session_event_root()](/docs/reference/python-sdk/roboto/domain/triggers/namespace#roboto.domain.triggers.namespace.session_event_root) (function): Build the `event` root a trigger reads when an event is created on a session.

- [substitute_query_template()](/docs/reference/python-sdk/roboto/domain/triggers/query_templates#roboto.domain.triggers.query_templates.substitute_query_template) (function): Return a RoboQL query with each placeholder replaced by its value, escaped for the string literal it sits in.

- [target_catalog_manifest()](/docs/reference/python-sdk/roboto/domain/triggers/targets#roboto.domain.triggers.targets.target_catalog_manifest) (function): Return the kinds of target a trigger can have, keyed by their `type`.

- [template_paths()](/docs/reference/python-sdk/roboto/domain/triggers/samples#roboto.domain.triggers.samples.template_paths) (function): Return every dotted path a condition field or `{{ }}` placeholder may name in `record`, in key order.

### sample_schedule_trigger()

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

`from roboto.domain.triggers import sample_schedule_trigger`

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

Build the sample trigger that the sample of a schedule firing shows.

It is `sample_trigger` renamed `weekly-report` and fired by the cron schedule `0 9 * * 1` in place of an event subscription, so the [`ScheduleFired`](/docs/reference/python-sdk/roboto/domain/platform_events/events#roboto.domain.platform_events.events.PlatformEventType.ScheduleFired) sample's `schedule` root includes the `cron` a template may name.

**Returns**

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