Hook Result • Rust AI Agent SDK
HookResult: Result from a hook execution
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
fn allow() -> SelfCreate an allow result
allow_with_reason
fn allow_with_reason(reason: impl Into<String>) -> SelfCreate an allow result with reason
Parameters:
| Name | Type |
|---|---|
reason | impl Into<String> |
deny
fn deny(reason: impl Into<String>) -> SelfCreate a deny result
Parameters:
| Name | Type |
|---|---|
reason | impl Into<String> |
block
fn block(reason: impl Into<String>) -> SelfCreate a block result
Parameters:
| Name | Type |
|---|---|
reason | impl Into<String> |
ask
fn ask(reason: impl Into<String>) -> SelfCreate an ask result
Parameters:
| Name | Type |
|---|---|
reason | impl Into<String> |
is_allowed
fn is_allowed(&self) -> boolCheck if the result allows execution
is_denied
fn is_denied(&self) -> boolCheck if the result denies execution
with_modified_input
fn with_modified_input(mut self, input: HashMap<String, serde_json::Value>) -> SelfAdd modified input
Parameters:
| Name | Type |
|---|---|
input | HashMap<String |
serde_json | :Value> |
with_context
fn with_context(mut self, context: impl Into<String>) -> SelfAdd additional context
Parameters:
| Name | Type |
|---|---|
context | impl Into<String> |
suppress
fn suppress(mut self) -> SelfSuppress output
Source
View on GitHubpraisonai/src/hooks/mod.rs at line 177