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

# Gateway Event • Rust AI Agent SDK

> GatewayEvent: A gateway event with metadata.

# GatewayEvent

> Defined in the [**gateway**](../modules/gateway) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

A gateway event with metadata.

## Fields

| Name         | Type                   | Description                                       |
| ------------ | ---------------------- | ------------------------------------------------- |
| `event_type` | `EventType`            | The event type                                    |
| `data`       | `serde_json::Value`    | Event payload                                     |
| `event_id`   | `String`               | Unique event identifier                           |
| `timestamp`  | `f64`                  | Event creation time (Unix timestamp)              |
| `source`     | `Option&lt;String&gt;` | Source identifier (agent\_id, client\_id, etc.)   |
| `target`     | `Option&lt;String&gt;` | Target identifier (optional, for directed events) |

## Methods

### `new`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn new(event_type: EventType) -> Self
```

Create a new gateway event.

**Parameters:**

| Name         | Type        |
| ------------ | ----------- |
| `event_type` | `EventType` |

### `data`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn data(mut self, data: serde_json::Value) -> Self
```

Set event data.

**Parameters:**

| Name   | Type                |
| ------ | ------------------- |
| `data` | `serde_json::Value` |

### `source`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn source(mut self, source: impl Into<String>) -> Self
```

Set source identifier.

**Parameters:**

| Name     | Type                      |
| -------- | ------------------------- |
| `source` | `impl Into&lt;String&gt;` |

### `target`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn target(mut self, target: impl Into<String>) -> Self
```

Set target identifier.

**Parameters:**

| Name     | Type                      |
| -------- | ------------------------- |
| `target` | `impl Into&lt;String&gt;` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/gateway/mod.rs#L97">
  `praisonai/src/gateway/mod.rs` at line 97
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Gateway" icon="tower-broadcast" href="/docs/rust/gateway" />
</CardGroup>
