pub struct ToolPolicy {
pub timeout: Option<Duration>,
pub cache: bool,
pub confirm: bool,
pub confirm_message: Option<String>,
}Expand description
Optional per-tool execution policy.
Fields§
§timeout: Option<Duration>If set, the tool call is bounded by this duration.
cache: boolIf true, successful results are memoized by (name, canonical args).
confirm: boolIf true, the tool requires user confirmation before execution.
confirm_message: Option<String>Optional hint shown when confirmation is requested.
Implementations§
Source§impl ToolPolicy
impl ToolPolicy
Sourcepub fn is_noop(&self) -> bool
pub fn is_noop(&self) -> bool
Whether this policy enforces anything at all.
Used to decide whether wrapping a tool in a PolicyTool is worthwhile.
Sourcepub fn with_timeout(self, d: Duration) -> Self
pub fn with_timeout(self, d: Duration) -> Self
Set a timeout.
Sourcepub fn with_cache(self) -> Self
pub fn with_cache(self) -> Self
Enable caching.
Sourcepub fn with_confirm(self, message: Option<String>) -> Self
pub fn with_confirm(self, message: Option<String>) -> Self
Require confirmation with an optional message.
Sourcepub fn merge(self, other: &ToolPolicy) -> Self
pub fn merge(self, other: &ToolPolicy) -> Self
Merge another policy into this one (the other takes precedence where set).
Trait Implementations§
Source§impl Clone for ToolPolicy
impl Clone for ToolPolicy
Source§fn clone(&self) -> ToolPolicy
fn clone(&self) -> ToolPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ToolPolicy
impl Debug for ToolPolicy
Source§impl Default for ToolPolicy
impl Default for ToolPolicy
Source§fn default() -> ToolPolicy
fn default() -> ToolPolicy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ToolPolicy
impl RefUnwindSafe for ToolPolicy
impl Send for ToolPolicy
impl Sync for ToolPolicy
impl Unpin for ToolPolicy
impl UnwindSafe for ToolPolicy
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
Mutably borrows from an owned value. Read more