#[non_exhaustive]pub enum ApprovalDecision {
Approve,
ApproveWithInput(Value),
Substitute(Value),
Deny(String),
Stop(String),
}async only.Expand description
Verdict from a ToolApprover for a single tool_use invocation.
Approvers are consulted by crate::Client::run before each tool
dispatch, so users can gate side-effecting tools behind an interactive
confirmation, a policy check, an input rewriter, or a static
allowlist.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Approve
Proceed with the tool dispatch unchanged.
ApproveWithInput(Value)
Proceed, but substitute a different input (the model’s original
payload is discarded). Useful for sanitizing arguments before the
tool runs (path scrubbing, scope clamping, etc.).
Substitute(Value)
Skip the tool dispatch entirely and return value as the
tool_result content (with no is_error flag). Useful for
stubbing tools in tests or short-circuiting expensive calls when
the answer is already known.
Deny(String)
Skip the tool dispatch. The supplied reason is returned to the
model as the tool_result content (with is_error = true) so
the model can choose how to recover.
Stop(String)
Abort the entire agent loop. Surfaces as
crate::Error::ToolApprovalStopped from Client::run.
Trait Implementations§
Source§impl Clone for ApprovalDecision
impl Clone for ApprovalDecision
Source§fn clone(&self) -> ApprovalDecision
fn clone(&self) -> ApprovalDecision
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ApprovalDecision
impl RefUnwindSafe for ApprovalDecision
impl Send for ApprovalDecision
impl Sync for ApprovalDecision
impl Unpin for ApprovalDecision
impl UnsafeUnpin for ApprovalDecision
impl UnwindSafe for ApprovalDecision
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more