pub struct ToolErrorPolicy {
pub terminate_on: ToolErrorKindSet,
}Expand description
Operator-tunable classification gate consumed by
ToolErrorPolicyLayer.
The struct is intentionally small: one ToolErrorKindSet
describing which kinds escalate to terminal. Operators that want
finer-grained behaviour (per-tool overrides, per-tenant
hot-swap) compose a higher layer that produces tenant-scoped
ToolErrorPolicy values; the leaf layer here stays simple by
design.
Fields§
§terminate_on: ToolErrorKindSetToolErrorKinds that cause the layer to wrap the inner
failure into crate::Error::ToolErrorTerminal, short-
circuiting the reasoning loop. The empty default is the
no-op — every failure flows through unchanged and reaches the
model as a tool-result message.
Implementations§
Source§impl ToolErrorPolicy
impl ToolErrorPolicy
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Empty policy — every failure flows back to the model. The
Default shape, suitable for dev / debugging deployments.
Sourcepub const fn operator_safe() -> Self
pub const fn operator_safe() -> Self
Recommended production set: Auth | Quota | Permanent. Three
kinds the model cannot influence on retry — surfacing them to
the LLM only burns tokens before recursion-limit fires.
Internal is deliberately excluded. ToolErrorKind::classify
routes the _ catch-all (unclassified Error variants) to
Internal, so including it in the default would silently
terminate runs on every future Error variant that ships
without an explicit classifier arm. Operators that want the
catch-all behaviour add it explicitly with
.add_terminal_kind(ToolErrorKind::Internal).
Transient / RateLimit are excluded because
crate::tools::RetryToolLayer handles them transport-side;
what reaches this policy in those buckets is past the retry
budget and surfacing to the model gives it a chance to pick a
different tool or restructure the call. Validation is
excluded because the model authored the bad input — retrying
with a corrected payload is exactly the failure mode the
LLM-recoverable channel was designed for.
Sourcepub const fn add_terminal_kind(self, kind: ToolErrorKind) -> Self
pub const fn add_terminal_kind(self, kind: ToolErrorKind) -> Self
Add kind to the terminate-on set. Fluent builder shape for
recipe wiring sites.
Sourcepub const fn classifies_terminal(self, kind: ToolErrorKind) -> bool
pub const fn classifies_terminal(self, kind: ToolErrorKind) -> bool
Whether kind causes the layer to escalate to terminal.
Trait Implementations§
Source§impl Clone for ToolErrorPolicy
impl Clone for ToolErrorPolicy
Source§fn clone(&self) -> ToolErrorPolicy
fn clone(&self) -> ToolErrorPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolErrorPolicy
impl Debug for ToolErrorPolicy
Source§impl Default for ToolErrorPolicy
impl Default for ToolErrorPolicy
Source§fn default() -> ToolErrorPolicy
fn default() -> ToolErrorPolicy
Source§impl PartialEq for ToolErrorPolicy
impl PartialEq for ToolErrorPolicy
Source§fn eq(&self, other: &ToolErrorPolicy) -> bool
fn eq(&self, other: &ToolErrorPolicy) -> bool
self and other values to be equal, and is used by ==.impl Copy for ToolErrorPolicy
impl Eq for ToolErrorPolicy
impl StructuralPartialEq for ToolErrorPolicy
Auto Trait Implementations§
impl Freeze for ToolErrorPolicy
impl RefUnwindSafe for ToolErrorPolicy
impl Send for ToolErrorPolicy
impl Sync for ToolErrorPolicy
impl Unpin for ToolErrorPolicy
impl UnsafeUnpin for ToolErrorPolicy
impl UnwindSafe for ToolErrorPolicy
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.