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

# LLM Guardrail • Rust AI Agent SDK

> LLMGuardrail: LLM-based guardrail for content validation

# LLMGuardrail

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

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

LLM-based guardrail for content validation

## Fields

| Name               | Type     | Description                              |
| ------------------ | -------- | ---------------------------------------- |
| `name`             | `String` | Name of the guardrail                    |
| `description`      | `String` | Description of what the guardrail checks |
| `prompt_template`  | `String` | The prompt template for the LLM check    |
| `model`            | `String` | Model to use for the guardrail check     |
| `block_on_failure` | `bool`   | Whether to block on failure              |

## Methods

### `new`

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

Create a new LLM guardrail

**Parameters:**

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

### `with_prompt`

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

Set the prompt template

**Parameters:**

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

### `with_model`

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

Set the model

**Parameters:**

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

### `block_on_failure`

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

Set whether to block on failure

**Parameters:**

| Name    | Type   |
| ------- | ------ |
| `block` | `bool` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/extras.rs#L260">
  `praisonai/src/parity/extras.rs` at line 260
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Guardrails" icon="shield" href="/docs/rust/guardrails" />

  <Card title="Rust Approval" icon="check" href="/docs/rust/approval" />

  <Card title="Rust Security" icon="lock" href="/docs/rust/security" />

  <Card title="Rust LLM" icon="microchip" href="/docs/rust/llm" />

  <Card title="Rust Providers" icon="server" href="/docs/rust/providers" />
</CardGroup>
