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

# Sandbox Config • Rust AI Agent SDK

> SandboxConfig: Configuration for a sandbox.

# SandboxConfig

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

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

Configuration for a sandbox.

## Fields

| Name           | Type                   | Description                             |
| -------------- | ---------------------- | --------------------------------------- |
| `sandbox_type` | `String`               | Sandbox type (docker, subprocess, etc.) |
| `image`        | `Option&lt;String&gt;` | Docker image to use (if docker type)    |
| `working_dir`  | `Option&lt;String&gt;` | Working directory                       |
| `env`          | `HashMap&lt;String`    | Environment variables                   |
| `limits`       | `ResourceLimits`       | Resource limits                         |
| `auto_cleanup` | `bool`                 | Whether to auto-cleanup after execution |

## Methods

### `new`

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

Create a new config with defaults.

### `docker`

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

Create a Docker sandbox config.

**Parameters:**

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

### `subprocess`

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

Create a subprocess sandbox config.

### `working_dir`

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

Set working directory.

**Parameters:**

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

### `env`

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

Add environment variable.

**Parameters:**

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

### `limits`

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

Set resource limits.

**Parameters:**

| Name     | Type             |
| -------- | ---------------- |
| `limits` | `ResourceLimits` |

### `auto_cleanup`

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

Set auto-cleanup.

**Parameters:**

| Name      | Type   |
| --------- | ------ |
| `cleanup` | `bool` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/sandbox/mod.rs#L311">
  `praisonai/src/sandbox/mod.rs` at line 311
</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 Database" icon="database" href="/docs/rust/database" />

  <Card title="Rust Sandbox" icon="box" href="/docs/rust/sandbox" />

  <Card title="Rust Code Execution" icon="terminal" href="/docs/rust/code-execution" />
</CardGroup>
