> ## 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 Input • Rust AI Agent SDK

> HookInput: Input data for hooks

# HookInput

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

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

Input data for hooks

```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: HookInput"]
    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                            |
| ------------ | --------------------------------- | -------------------------------------- |
| `session_id` | `String`                          | Session ID                             |
| `event_name` | `String`                          | Event name                             |
| `timestamp`  | `String`                          | Timestamp (ISO 8601)                   |
| `agent_name` | `Option&lt;String&gt;`            | Agent name (optional)                  |
| `tool_name`  | `Option&lt;String&gt;`            | Tool name (for tool events)            |
| `tool_args`  | `Option&lt;serde_json::Value&gt;` | Tool arguments (for tool events)       |
| `message`    | `Option&lt;String&gt;`            | Message content (for agent/LLM events) |
| `error`      | `Option&lt;String&gt;`            | Error message (for error events)       |
| `extra`      | `HashMap&lt;String`               | Additional data                        |
| `serde_json` | `:Value&gt;`                      | Additional data                        |

## Methods

### `new`

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

Create a new hook input

**Parameters:**

| Name         | Type                      |
| ------------ | ------------------------- |
| `event`      | `HookEvent`               |
| `session_id` | `impl Into&lt;String&gt;` |

### `with_agent`

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

Set agent name

**Parameters:**

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

### `with_tool`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
fn with_tool(mut self, name: impl Into<String>, args: serde_json::Value) -> Self
```

Set tool info

**Parameters:**

| Name   | Type                      |
| ------ | ------------------------- |
| `name` | `impl Into&lt;String&gt;` |
| `args` | `serde_json::Value`       |

### `with_message`

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

Set message

**Parameters:**

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

### `with_error`

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

Set error

**Parameters:**

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

### `with_extra`

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

Add extra data

**Parameters:**

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

## Source

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