#[non_exhaustive]pub enum AgentError {
Llm {
message: String,
failure: Failure,
},
ToolExecution {
name: String,
error: String,
},
MaxIterations {
limit: usize,
},
HookRejected {
hook: Cow<'static, str>,
reason: String,
},
ToolNotFound {
name: String,
},
Config(String),
Approval(Arc<ApprovalError>),
Cancelled,
Paused(RunPause),
}Expand description
Errors that can occur during agent execution.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Llm
LLM returned an error.
Fields
ToolExecution
Tool execution failed.
MaxIterations
Maximum iterations exceeded without completing the task.
HookRejected
A hook rejected the operation.
ToolNotFound
Tool not found.
Config(String)
Configuration error.
Approval(Arc<ApprovalError>)
A tool call needed an approval and none could be had: the agent has no approver, the approver failed, or the run was cancelled while waiting.
Cancelled
The run was cancelled.
A cancelled Run ends with
RunOutcome::Cancelled and drive
returns normally; this is what Agent::query,
which returns a reply, reports.
Paused(RunPause)
The run paused for a reason that needs the embedder; see
RunPause.
Agent::query reports it, since it has no
reply to return.
Implementations§
Source§impl AgentError
impl AgentError
Sourcepub fn from_model_error<E: Error + Classify>(error: &E) -> Self
pub fn from_model_error<E: Error + Classify>(error: &E) -> Self
Captures a provider error with its classification.
Sourcepub fn llm_local(message: impl Into<String>) -> Self
pub fn llm_local(message: impl Into<String>) -> Self
An LLM-side error that originates in this process, never from a provider, and so is permanent.
Sourcepub const fn failure(&self) -> Option<&Failure>
pub const fn failure(&self) -> Option<&Failure>
How the provider failure classifies, or None when this error is not
a provider failure.
Retry policy belongs to the caller: this says whether a retry can help
(Failure::is_retryable) and what delay the upstream asked for.
Trait Implementations§
Source§impl Clone for AgentError
impl Clone for AgentError
Source§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()