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

### DispatchSlot

```python
class roboto.domain.triggers.dispatch.DispatchSlot
```

`from roboto.domain.triggers import DispatchSlot`

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

Slot a dispatch occupies: one target of one trigger, for the platform events that share one idempotency token.

Roboto keeps one dispatch record per slot, and a retry of the slot replaces it. Returned by `TriggerDispatchRecord.slot`.

**Attributes**

- **DispatchSlot.idempotency_token** (`str`): Token that identifies the matched platform event at the trigger's `once_per`.

  For example, `file.uploaded|dataset:ds_12345`.

- **DispatchSlot.target_id** (`str`): ID of the target, unique within the trigger.

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

### TriggerDispatchRecord

```python
class roboto.domain.triggers.dispatch.TriggerDispatchRecord(/, **data: Any)
```

`from roboto.domain.triggers import TriggerDispatchRecord`

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

Bases: `pydantic.BaseModel`

Data record of a trigger dispatch, as the Roboto API returns it.

A dispatch is one attempt to run one of a trigger's targets for a platform event that matched the trigger. The trigger's `once_per` (a [`OncePer`](/docs/reference/python-sdk/roboto/domain/platform_events/once_per#roboto.domain.platform_events.once_per.OncePer)) decides which platform events share an idempotency token, and Roboto runs each target at most once per token, except when it retries a slot whose dispatch failed or was abandoned. [`dispatches()`](/docs/reference/python-sdk/roboto/domain/triggers/trigger#roboto.domain.triggers.trigger.Trigger.dispatches) returns these records.

**Parameters**

- **data** (`Any`)

**Attributes**

- **TriggerDispatchRecord.claimed_at** (`datetime.datetime`): Time the slot was last claimed.

- **TriggerDispatchRecord.dataset_id** (`str | None`) = `None`: ID of the dataset the platform event is about, or of the dataset that holds the file it is about.

  `None` for a platform event about anything else, such as an invocation or a session.

- **TriggerDispatchRecord.event_id** (`str`): ID of the platform event that last claimed this slot.

  A retry can come from another platform event with the same token, such as an upload of another file to the same dataset at `once_per=dataset`.

- **TriggerDispatchRecord.event_type** (`roboto.domain.platform_events.PlatformEventType`): Type of the matched platform event.

- **TriggerDispatchRecord.finalized_at** (`datetime.datetime | None`) = `None`: Time the dispatch reached a final status.

  `None` while `status` is `TriggerDispatchStatus.Claimed`.

- **TriggerDispatchRecord.idempotency_token** (`str`): Token that identifies the matched platform event at the trigger's `once_per`.

  It has the form `<event type>|<once_per>:<value>`, such as `file.uploaded|dataset:ds_12345`.

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

- **TriggerDispatchRecord.result_ref** (`str | None`) = `None`: What the target produced, by `target_type`: an invocation ID, an agent thread ID, or a Slack message timestamp.

  `None` until `status` is `TriggerDispatchStatus.Dispatched`, after a failure, and when the action invocation or agent thread already existed for this slot, so the target did not run again.

- **TriggerDispatchRecord.status** (`TriggerDispatchStatus`): Status of the dispatch.

- **TriggerDispatchRecord.status_detail** (`str | None`) = `None`: Human-readable detail on `status`, such as the error a failed target raised, or `None` if there is none.

- **TriggerDispatchRecord.subject** (`str`): Entity the platform event in `event_id` is about, as a `roboto://` URI such as `roboto://file/fl_12345`.

- **TriggerDispatchRecord.target_id** (`str`): ID of the target this dispatch ran, unique within the trigger.

- **TriggerDispatchRecord.target_type** (`roboto.domain.triggers.targets.TriggerTargetType`): Kind of target this dispatch ran, which decides what `result_ref` holds.

- **TriggerDispatchRecord.trigger_id** (`str`): ID of the trigger this dispatch belongs to.

**Properties**

- **TriggerDispatchRecord.slot** (`DispatchSlot`): Slot this dispatch occupies.
- **TriggerDispatchRecord.subject_uri** (`roboto.uri.RobotoUri`): Same value as `subject`, parsed as a [`RobotoUri`](/docs/reference/python-sdk/roboto/uri#roboto.uri.RobotoUri).

### TriggerDispatchStatus

```python
class roboto.domain.triggers.dispatch.TriggerDispatchStatus
```

`from roboto.domain.triggers import TriggerDispatchStatus`

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

Bases: `roboto.compat.StrEnum`

Status of a dispatch: one attempt to run one of a trigger's targets for one matched platform event.

Roboto may deliver a platform event to a trigger more than once, such as after a failure, so a slot whose dispatch failed or was abandoned can be claimed again and its target retried.

**Attributes**

- **TriggerDispatchStatus.Claimed** = `'claimed'`: The dispatch has claimed its slot, and its target is running or about to run.

  A claim that has not finished after five minutes is presumed abandoned, and a redelivery of the platform event may claim the slot again, so a target can run twice for one platform event.

- **TriggerDispatchStatus.Dispatched** = `'dispatched'`: The target ran, or had already run for this slot.

  `TriggerDispatchRecord.result_ref` names what it produced when it ran.

- **TriggerDispatchStatus.Failed** = `'failed'`: The target failed or was rejected. A redelivery of the platform event may claim the slot again.

- **TriggerDispatchStatus.Unknown** = `'unknown'`: The claim never finished and no redelivery claimed the slot again, so the target's outcome cannot be determined.

  Roboto moves a claim to this status after about two hours, and never claims the slot again.
