Skip to main content

HookInput

Defined in the hooks module.
Rust AI Agent SDK Input data for hooks

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

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

fn with_agent(mut self, name: impl Into<String>) -> Self
Set agent name Parameters:
NameType
nameimpl Into&lt;String&gt;

with_tool

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

fn with_message(mut self, message: impl Into<String>) -> Self
Set message Parameters:
NameType
messageimpl Into&lt;String&gt;

with_error

fn with_error(mut self, error: impl Into<String>) -> Self
Set error Parameters:
NameType
errorimpl Into&lt;String&gt;

with_extra

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