Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
HookResult
Defined in the hooks module.
Rust AI Agent SDK
Result from a hook execution
Fields
| Name | Type | Description |
|---|
decision | HookDecision | Decision (allow, deny, block, ask) |
reason | Option<String> | Reason for the decision |
modified_input | Option<HashMap<String | Modified input data (optional) |
serde_json | :Value>> | Modified input data (optional) |
additional_context | Option<String> | Additional context |
suppress_output | bool | Whether to suppress output |
Methods
allow
Create an allow result
allow_with_reason
fn allow_with_reason(reason: impl Into<String>) -> Self
Create an allow result with reason
Parameters:
| Name | Type |
|---|
reason | impl Into<String> |
deny
fn deny(reason: impl Into<String>) -> Self
Create a deny result
Parameters:
| Name | Type |
|---|
reason | impl Into<String> |
block
fn block(reason: impl Into<String>) -> Self
Create a block result
Parameters:
| Name | Type |
|---|
reason | impl Into<String> |
ask
fn ask(reason: impl Into<String>) -> Self
Create an ask result
Parameters:
| Name | Type |
|---|
reason | impl Into<String> |
is_allowed
fn is_allowed(&self) -> bool
Check if the result allows execution
is_denied
fn is_denied(&self) -> bool
Check if the result denies execution
fn with_modified_input(mut self, input: HashMap<String, serde_json::Value>) -> Self
Add modified input
Parameters:
| Name | Type |
|---|
input | HashMap<String |
serde_json | :Value> |
with_context
fn with_context(mut self, context: impl Into<String>) -> Self
Add additional context
Parameters:
| Name | Type |
|---|
context | impl Into<String> |
suppress
fn suppress(mut self) -> Self
Suppress output
Source
View on GitHub
praisonai/src/hooks/mod.rs at line 177