#[non_exhaustive]pub enum ToolErrorKind {
Transient,
RateLimit,
Quota,
Auth,
Permanent,
Validation,
Internal,
}Expand description
Cross-tool failure category.
Derive from Error via Self::classify. Used for retry
middleware (RetryToolLayer retries Self::Transient /
Self::RateLimit), observability sinks (operators surface the
category in dashboards), and downstream recovery routing
(different categories trigger different operator responses —
page on Auth, alert on Quota, ignore Validation noise).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Transient
Network blip, transient 5xx, generic transport failure — safe to retry.
RateLimit
Vendor signalled rate limiting (429 with Retry-After hint).
Retryable after the configured cooldown.
Quota
Vendor signalled exhausted quota / billing cap. Retry will not succeed until the quota resets or operator intervenes — surface to ops, do not retry automatically.
Auth
Credential rejected (401 / 403 / Error::Auth). Retry will
not succeed until credentials are rotated.
Permanent
Permanent vendor failure (4xx other than auth/rate/quota, 405, 410, 422 …). The same call will fail again.
Validation
Caller-side input rejected (Error::InvalidRequest,
Error::Serde) — the operator’s payload does not match
the tool contract. Retry is meaningless without changing the
payload.
Internal
Tool-internal bug or misconfiguration (Error::Config, or
any unclassified shape). Surface to ops; retry is not
meaningful.
Implementations§
Source§impl ToolErrorKind
impl ToolErrorKind
Sourcepub fn classify(error: &Error) -> Self
pub fn classify(error: &Error) -> Self
Derive the category from an Error.
The mapping is intentionally exhaustive over the variants
Error surfaces today — the _ catch-all routes to
Self::Internal so future variants stay observable until
classified explicitly. Operational variants
(Error::Cancelled, Error::DeadlineExceeded,
Error::Interrupted, Error::ModelRetry) flow through
Internal because they are agent-runtime control signals,
not tool failures — call sites that observe them should not
reach this classifier in the first place.
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Whether the runtime should attempt the tool call again.
Transient and RateLimit are retryable; everything else
is a surface-and-stop signal. RetryToolLayer consults this
via the underlying RetryClassifier (which can be
overridden per deployment) — operators that want different
retry policy install a custom classifier rather than mutating
this method.
Trait Implementations§
Source§impl Clone for ToolErrorKind
impl Clone for ToolErrorKind
Source§fn clone(&self) -> ToolErrorKind
fn clone(&self) -> ToolErrorKind
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 ToolErrorKind
impl Debug for ToolErrorKind
Source§impl Hash for ToolErrorKind
impl Hash for ToolErrorKind
Source§impl PartialEq for ToolErrorKind
impl PartialEq for ToolErrorKind
Source§fn eq(&self, other: &ToolErrorKind) -> bool
fn eq(&self, other: &ToolErrorKind) -> bool
self and other values to be equal, and is used by ==.impl Copy for ToolErrorKind
impl Eq for ToolErrorKind
impl StructuralPartialEq for ToolErrorKind
Auto Trait Implementations§
impl Freeze for ToolErrorKind
impl RefUnwindSafe for ToolErrorKind
impl Send for ToolErrorKind
impl Sync for ToolErrorKind
impl Unpin for ToolErrorKind
impl UnsafeUnpin for ToolErrorKind
impl UnwindSafe for ToolErrorKind
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.