> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# lifecycle

# `prefect.server.events.schemas.lifecycle`

Typed payloads and builders for `prefect.<object>.{created,updated,deleted}`
lifecycle events.

Each payload is the shape of the event's `payload` field for a domain object —
what a consumer sees on the event without reading the object back from the API.
The shapes mirror Prefect Cloud's lifecycle-event payloads so the two emit the
same thing.

The builders here are pure functions of an ORM object and a timestamp, with no
dependency on the model layer, so any model module can import them without
risking a circular import.

## Functions

### `variable_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L72](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L72)</sup>

```python theme={null}
variable_created_event(variable: 'ORMVariable', occurred: DateTime) -> Event
```

Create an event for variable creation.

### `variable_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L77](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L77)</sup>

```python theme={null}
variable_updated_event(variable: 'ORMVariable', occurred: DateTime) -> Event
```

Create an event for variable updates.

### `variable_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L82](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L82)</sup>

```python theme={null}
variable_deleted_event(variable: 'ORMVariable', occurred: DateTime) -> Event
```

Create an event for variable deletion.

### `flow_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L108](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L108)</sup>

```python theme={null}
flow_created_event(flow: 'ORMFlow', occurred: DateTime) -> Event
```

Create an event for flow creation.

### `flow_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L113](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L113)</sup>

```python theme={null}
flow_updated_event(flow: 'ORMFlow', occurred: DateTime) -> Event
```

Create an event for flow updates.

### `flow_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L118](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L118)</sup>

```python theme={null}
flow_deleted_event(flow: 'ORMFlow', occurred: DateTime) -> Event
```

Create an event for flow deletion.

### `block_type_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L149](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L149)</sup>

```python theme={null}
block_type_created_event(block_type: 'BlockType', occurred: DateTime) -> Event
```

Create an event for block type creation.

### `block_type_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L154](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L154)</sup>

```python theme={null}
block_type_updated_event(block_type: 'BlockType', occurred: DateTime) -> Event
```

Create an event for block type updates.

### `block_type_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L159](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L159)</sup>

```python theme={null}
block_type_deleted_event(block_type: 'BlockType', occurred: DateTime) -> Event
```

Create an event for block type deletion.

### `block_document_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L203](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L203)</sup>

```python theme={null}
block_document_created_event(block_document: 'BlockDocument', occurred: DateTime) -> Event
```

Create an event for block document creation.

### `block_document_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L210](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L210)</sup>

```python theme={null}
block_document_updated_event(block_document: 'BlockDocument', occurred: DateTime) -> Event
```

Create an event for block document updates.

### `block_document_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L217](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L217)</sup>

```python theme={null}
block_document_deleted_event(block_document: 'BlockDocument', occurred: DateTime) -> Event
```

Create an event for block document deletion.

### `concurrency_limit_v2_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L290](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L290)</sup>

```python theme={null}
concurrency_limit_v2_created_event(concurrency_limit: 'ConcurrencyLimitV2', occurred: DateTime) -> Event
```

Create an event for global concurrency limit creation.

### `concurrency_limit_v2_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L297](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L297)</sup>

```python theme={null}
concurrency_limit_v2_updated_event(concurrency_limit: 'ConcurrencyLimitV2', occurred: DateTime) -> Event
```

Create an event for global concurrency limit updates.

### `concurrency_limit_v2_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L304](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L304)</sup>

```python theme={null}
concurrency_limit_v2_deleted_event(concurrency_limit: 'ConcurrencyLimitV2', occurred: DateTime) -> Event
```

Create an event for global concurrency limit deletion.

### `concurrency_limit_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L336](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L336)</sup>

```python theme={null}
concurrency_limit_created_event(concurrency_limit: 'ConcurrencyLimit', occurred: DateTime) -> Event
```

Create an event for tag-based concurrency limit creation.

### `concurrency_limit_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L343](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L343)</sup>

```python theme={null}
concurrency_limit_updated_event(concurrency_limit: 'ConcurrencyLimit', occurred: DateTime) -> Event
```

Create an event for tag-based concurrency limit updates.

### `concurrency_limit_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L350](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L350)</sup>

```python theme={null}
concurrency_limit_deleted_event(concurrency_limit: 'ConcurrencyLimit', occurred: DateTime) -> Event
```

Create an event for tag-based concurrency limit deletion.

### `artifact_collection_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L385](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L385)</sup>

```python theme={null}
artifact_collection_created_event(artifact_collection: 'ORMArtifactCollection', occurred: DateTime) -> Event
```

Create an event for artifact collection creation.

### `artifact_collection_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L392](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L392)</sup>

```python theme={null}
artifact_collection_updated_event(artifact_collection: 'ORMArtifactCollection', occurred: DateTime) -> Event
```

Create an event for artifact collection updates.

### `artifact_collection_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L399](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L399)</sup>

```python theme={null}
artifact_collection_deleted_event(artifact_collection: 'ORMArtifactCollection', occurred: DateTime) -> Event
```

Create an event for artifact collection deletion.

### `automation_created_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L449](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L449)</sup>

```python theme={null}
automation_created_event(automation: 'Automation', occurred: DateTime) -> Event
```

Create an event for automation creation.

### `automation_updated_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L454](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L454)</sup>

```python theme={null}
automation_updated_event(automation: 'Automation', occurred: DateTime) -> Event
```

Create an event for automation updates.

### `automation_deleted_event` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L459](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L459)</sup>

```python theme={null}
automation_deleted_event(automation: 'Automation', occurred: DateTime) -> Event
```

Create an event for automation deletion.

## Classes

### `VariableEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L62](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L62)</sup>

The payload of a variable lifecycle event: its name, value, and tags.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `FlowEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L98](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L98)</sup>

The payload of a flow lifecycle event: its name, tags, and labels.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `BlockTypeEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L134](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L134)</sup>

The payload of a block type lifecycle event: its identity, presentation,
and protection.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `BlockDocumentBlockType` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L179](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L179)</sup>

The block type a block document belongs to, nested on its block schema.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `BlockSchemaEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L186](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L186)</sup>

The schema a block document conforms to, with its block type nested.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `BlockDocumentEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L193](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L193)</sup>

The payload of a block document lifecycle event: its name, the non-secret
string values of its data, and the nested block schema (capabilities and
block type).

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `ConcurrencyLimitV2EventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L278](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L278)</sup>

The payload of a global concurrency limit lifecycle event: its name,
limit, active flag, and slot decay rate.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `ConcurrencyLimitEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L326](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L326)</sup>

The payload of a tag-based (v1) concurrency limit lifecycle event: the tag
it applies to and its limit.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.

### `ArtifactCollectionEventPayload` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L372](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/events/schemas/lifecycle.py#L372)</sup>

The payload of an artifact collection lifecycle event: the collection key,
the artifact type, and its data and description. The latest artifact and its
flow/task runs ride the event's `related` resources, not the payload.

**Methods:**

#### `model_validate_list` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L56](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L56)</sup>

```python theme={null}
model_validate_list(cls, obj: Any) -> list[Self]
```

#### `reset_fields` <sup>[https://github.com/PrefectHQ/prefect/blob/main/src/prefect/\_internal/schemas/bases.py#L85](https://github.com/PrefectHQ/prefect/blob/main/src/prefect/_internal/schemas/bases.py#L85)</sup>

```python theme={null}
reset_fields(self: Self) -> Self
```

Reset the fields of the model that are in the `_reset_fields` set.

**Returns:**

* A new instance of the model with the reset fields.
