pub enum ToolDecision {
Allow,
Deny {
reason: String,
},
Rewrite {
arguments: Value,
},
Interrupt {
reason: String,
kind: InterruptKind,
},
Answer {
output: ToolOutput,
},
}Expand description
What a before_tool hook decides about one call.
Variants§
Allow
Deny
Refuse. The reason goes back to the model as the tool result, and a
Denied receipt is recorded.
Rewrite
Replace the arguments and restart all hooks so earlier judgments cannot authorize different effects. Identical arguments are a no-op; more than 16 changes refuses the call. Rewriters should be idempotent.
Interrupt
Pause the run before this call (for example, to ask a human). The run
returns crate::RunStatus::Interrupted with serializable state that
crate::Agent::resume continues later, in this or another process.
Fields
kind: InterruptKindWho the interruption waits for; resolvers settle the kinds they own.
Answer
Answer in the tool’s place: the tool does not run and the model sees
output. For results the host already holds (a replayed receipt, a
suppressed duplicate) or a call deferred on purpose. The receipt is
crate::ReceiptStatus::Answered; an answer never ends the run (its
finish is dropped) and never counts as work done.
Fields
output: ToolOutputImplementations§
Source§impl ToolDecision
impl ToolDecision
Sourcepub fn ask(request: OwnerApprovalRequest) -> Self
pub fn ask(request: OwnerApprovalRequest) -> Self
Pause the run for the owner to answer request
(InterruptKind::OwnerApproval), with the summary as the reason.
Build the request with crate::OwnerApprovalRequest::for_call to
carry the call’s declared effects, so a decline binds the rest of
the run.