> ## 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.

# Resource Limits • Rust AI Agent SDK

> ResourceLimits: Resource limits for sandbox execution.

# ResourceLimits

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

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

Resource limits for sandbox execution.

## Fields

| Name              | Type   | Description                                     |
| ----------------- | ------ | ----------------------------------------------- |
| `memory_mb`       | `u32`  | Maximum memory in megabytes (0 = unlimited)     |
| `cpu_percent`     | `u32`  | Maximum CPU percentage (0 = unlimited)          |
| `timeout_seconds` | `u32`  | Maximum execution time in seconds               |
| `max_processes`   | `u32`  | Maximum number of processes                     |
| `max_open_files`  | `u32`  | Maximum number of open files                    |
| `network_enabled` | `bool` | Whether network access is allowed               |
| `disk_write_mb`   | `u32`  | Maximum disk write in megabytes (0 = unlimited) |

## Methods

### `new`

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

Create default resource limits.

### `minimal`

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

Create minimal resource limits for untrusted code.

### `standard`

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

Create standard resource limits.

### `generous`

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

Create generous resource limits for trusted code.

### `memory_mb`

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

Set memory limit.

**Parameters:**

| Name | Type  |
| ---- | ----- |
| `mb` | `u32` |

### `cpu_percent`

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

Set CPU limit.

**Parameters:**

| Name      | Type  |
| --------- | ----- |
| `percent` | `u32` |

### `timeout_seconds`

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

Set timeout.

**Parameters:**

| Name      | Type  |
| --------- | ----- |
| `seconds` | `u32` |

### `max_processes`

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

Set max processes.

**Parameters:**

| Name  | Type  |
| ----- | ----- |
| `max` | `u32` |

### `max_open_files`

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

Set max open files.

**Parameters:**

| Name  | Type  |
| ----- | ----- |
| `max` | `u32` |

### `network_enabled`

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

Enable/disable network access.

**Parameters:**

| Name      | Type   |
| --------- | ------ |
| `enabled` | `bool` |

### `disk_write_mb`

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

Set disk write limit.

**Parameters:**

| Name | Type  |
| ---- | ----- |
| `mb` | `u32` |

## Source

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