Hook Input • Rust AI Agent SDK

HookInput: Input data for hooks

HookInput

Defined in the hooks module.

Rust AI Agent SDK

Input data for hooks

Diagram

Allow

Deny

Event Trigger

Hook: HookInput

Decision

Process

Block

Fields

NameTypeDescription
session_idStringSession ID
event_nameStringEvent name
timestampStringTimestamp (ISO 8601)
agent_nameOption<String>Agent name (optional)
tool_nameOption<String>Tool name (for tool events)
tool_argsOption<serde_json::Value>Tool arguments (for tool events)
messageOption<String>Message content (for agent/LLM events)
errorOption<String>Error message (for error events)
extraHashMap<StringAdditional data
serde_json:Value>Additional data

Methods

new

rust
fn new(event: HookEvent, session_id: impl Into<String>) -> Self

Create a new hook input

Parameters:

NameType
eventHookEvent
session_idimpl Into&lt;String&gt;

with_agent

rust
fn with_agent(mut self, name: impl Into<String>) -> Self

Set agent name

Parameters:

NameType
nameimpl Into&lt;String&gt;

with_tool

rust
fn with_tool(mut self, name: impl Into<String>, args: serde_json::Value) -> Self

Set tool info

Parameters:

NameType
nameimpl Into&lt;String&gt;
argsserde_json::Value

with_message

rust
fn with_message(mut self, message: impl Into<String>) -> Self

Set message

Parameters:

NameType
messageimpl Into&lt;String&gt;

with_error

rust
fn with_error(mut self, error: impl Into<String>) -> Self

Set error

Parameters:

NameType
errorimpl Into&lt;String&gt;

with_extra

rust
fn with_extra(mut self, key: impl Into<String>, value: serde_json::Value) -> Self

Add extra data

Parameters:

NameType
keyimpl Into&lt;String&gt;
valueserde_json::Value

Source

View on GitHub

praisonai/src/hooks/mod.rs at line 105


Related Documentation