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

# Hook Result • Rust AI Agent SDK

> HookResult: Result from a hook execution

# HookResult

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

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

Result from a hook execution

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph TD
    event["Event Trigger"] --> hook["Hook: HookResult"]
    hook --> decision{"Decision"}
    decision -- "Allow" --> proc["Process"]
    decision -- "Deny" --> block["Block"]
    style hook fill:#189AB4,color:#fff
    style event fill:#8B0000,color:#fff
    style proc fill:#8B0000,color:#fff
    style block fill:#8B0000,color:#fff
```

## Fields

| Name                 | Type                          | Description                        |
| -------------------- | ----------------------------- | ---------------------------------- |
| `decision`           | `HookDecision`                | Decision (allow, deny, block, ask) |
| `reason`             | `Option&lt;String&gt;`        | Reason for the decision            |
| `modified_input`     | `Option&lt;HashMap&lt;String` | Modified input data (optional)     |
| `serde_json`         | `:Value&gt;&gt;`              | Modified input data (optional)     |
| `additional_context` | `Option&lt;String&gt;`        | Additional context                 |
| `suppress_output`    | `bool`                        | Whether to suppress output         |

## Methods

### `allow`

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

Create an allow result

### `allow_with_reason`

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

Create an allow result with reason

**Parameters:**

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

### `deny`

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

Create a deny result

**Parameters:**

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

### `block`

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

Create a block result

**Parameters:**

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

### `ask`

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

Create an ask result

**Parameters:**

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

### `is_allowed`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_allowed(&self) -> bool
```

Check if the result allows execution

### `is_denied`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn is_denied(&self) -> bool
```

Check if the result denies execution

### `with_modified_input`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_modified_input(mut self, input: HashMap<String, serde_json::Value>) -> Self
```

Add modified input

**Parameters:**

| Name         | Type                |
| ------------ | ------------------- |
| `input`      | `HashMap&lt;String` |
| `serde_json` | `:Value&gt;`        |

### `with_context`

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

Add additional context

**Parameters:**

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

### `suppress`

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

Suppress output

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Hooks" icon="anchor" href="/docs/rust/hooks" />

  <Card title="Rust Events" icon="bolt" href="/docs/rust/events" />

  <Card title="Rust Callbacks" icon="phone" href="/docs/rust/callbacks" />
</CardGroup>
