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

# Code Config • Rust AI Agent SDK

> CodeConfig: Configuration for code execution settings.

# CodeConfig

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

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

Configuration for code execution settings.

## Fields

| Name                | Type                   | Description                   |
| ------------------- | ---------------------- | ----------------------------- |
| `sandbox`           | `bool`                 | Enable sandboxed execution    |
| `timeout`           | `u32`                  | Execution timeout in seconds  |
| `allowed_languages` | `Vec&lt;String&gt;`    | Allowed programming languages |
| `max_output_length` | `usize`                | Maximum output length         |
| `working_directory` | `Option&lt;String&gt;` | Working directory             |
| `environment`       | `HashMap&lt;String`    | Environment variables         |

## Methods

### `new`

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

Create a new CodeConfig

### `sandbox`

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

Set sandbox mode

**Parameters:**

| Name      | Type   |
| --------- | ------ |
| `sandbox` | `bool` |

### `timeout`

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

Set timeout

**Parameters:**

| Name      | Type  |
| --------- | ----- |
| `timeout` | `u32` |

### `allowed_languages`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn allowed_languages(mut self, languages: Vec<String>) -> Self
```

Set allowed languages

**Parameters:**

| Name        | Type                |
| ----------- | ------------------- |
| `languages` | `Vec&lt;String&gt;` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/agents/mod.rs#L721">
  `praisonai/src/agents/mod.rs` at line 721
</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 Code Execution" icon="terminal" href="/docs/rust/code-execution" />

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