> ## 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 Config • Rust AI Agent SDK

> GatewayConfig: Configuration for a gateway.

# GatewayConfig

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

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

Configuration for a gateway.

## Fields

| Name              | Type                   | Description                             |
| ----------------- | ---------------------- | --------------------------------------- |
| `host`            | `String`               | Host to bind to                         |
| `port`            | `u16`                  | Port to listen on                       |
| `max_connections` | `usize`                | Maximum connections                     |
| `session_timeout` | `u64`                  | Session timeout in seconds              |
| `auth_enabled`    | `bool`                 | Enable authentication                   |
| `auth_token`      | `Option&lt;String&gt;` | Authentication token (if auth\_enabled) |
| `tls_enabled`     | `bool`                 | Enable TLS                              |
| `tls_cert_path`   | `Option&lt;String&gt;` | TLS certificate path                    |
| `tls_key_path`    | `Option&lt;String&gt;` | TLS key path                            |

## Methods

### `new`

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

Create a new config with defaults.

### `host`

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

Set host.

**Parameters:**

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

### `port`

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

Set port.

**Parameters:**

| Name   | Type  |
| ------ | ----- |
| `port` | `u16` |

### `max_connections`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn max_connections(mut self, max: usize) -> Self
```

Set max connections.

**Parameters:**

| Name  | Type    |
| ----- | ------- |
| `max` | `usize` |

### `session_timeout`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn session_timeout(mut self, timeout: u64) -> Self
```

Set session timeout.

**Parameters:**

| Name      | Type  |
| --------- | ----- |
| `timeout` | `u64` |

### `auth`

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

Enable authentication with token.

**Parameters:**

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

### `tls`

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

Enable TLS.

**Parameters:**

| Name        | Type                      |
| ----------- | ------------------------- |
| `cert_path` | `impl Into&lt;String&gt;` |
| `key_path`  | `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#L298">
  `praisonai/src/gateway/mod.rs` at line 298
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Configuration" icon="gear" href="/docs/rust/configuration" />

  <Card title="Rust Installation" icon="download" href="/docs/rust/installation" />

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