pub enum AgentError {
Provider(ProviderError),
Config(String),
Validation(String),
PermissionDenied(String),
ToolNotFound(String),
ToolExecution {
tool: String,
message: String,
},
MaxIterations(usize),
ProviderRetriesExhausted {
attempts: usize,
last_error: String,
},
SessionBusy,
Cancelled,
}Expand description
All error conditions surfaced by the agent runtime.
Variants§
Provider(ProviderError)
The model provider (HTTP transport, API contract, deserialisation, …) failed.
Config(String)
A misconfigured session or backend (missing env var, unwritable storage dir, …).
Validation(String)
Tool input failed schema/business-rule validation before execution.
PermissionDenied(String)
The permission engine or a tool refused to execute the call.
ToolNotFound(String)
The assistant requested a tool that isn’t in the registry.
ToolExecution
A tool ran but reported a runtime failure.
MaxIterations(usize)
The turn loop exceeded AgentConfig::max_iterations.
ProviderRetriesExhausted
Provider retries exhausted — every attempt failed.
SessionBusy
Another turn is already running for this session.
Cancelled
The turn was cancelled via CancellationState.
Implementations§
Source§impl AgentError
impl AgentError
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether the error is transient and worth retrying.
Network errors and server-side 429/5xx responses are retryable; configuration errors, validation failures, and permission denials are not.
Sourcepub fn is_context_too_long(&self) -> bool
pub fn is_context_too_long(&self) -> bool
Whether the error indicates the context window was exceeded.
HTTP 400 with a message about context/token length means the request was too large for the model. This is NOT retryable in the normal sense (repeating the same request will fail), but it IS recoverable via compaction: summarise history, then retry with fewer tokens.
Trait Implementations§
Source§impl Clone for AgentError
impl Clone for AgentError
Source§fn clone(&self) -> AgentError
fn clone(&self) -> AgentError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentError
impl Debug for AgentError
Source§impl Display for AgentError
impl Display for AgentError
Source§impl Error for AgentError
impl Error for AgentError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()