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

# autogen.events.wrap_event

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### wrap\_event

```python theme={null}
wrap_event(event_cls: type[BaseEvent]) -> type[BaseModel]
```

Wrap a event class with a type field to be used in a union type

This is needed for proper serialization and deserialization of events in a union type.<br />

<b>Parameters:</b>

| Name        | Description                                                                                               |
| ----------- | --------------------------------------------------------------------------------------------------------- |
| `event_cls` | Event class to wrap<br /><br />**Type:** type\[[BaseEvent](/docs/api-reference/autogen/events/BaseEvent)] |

<br />
