#[non_exhaustive]pub enum AgentError {
Show 29 variants
Llm {
provider: &'static str,
reason: LlmFailureReason,
message: String,
},
StoreError(String),
ToolError(String),
McpError(String),
SessionNotFound(SessionId),
TokenBudgetExceeded {
used: u64,
limit: u64,
},
TimeBudgetExceeded {
elapsed_secs: u64,
limit_secs: u64,
},
ToolCallBudgetExceeded {
count: usize,
limit: usize,
},
MaxTokensReached {
turn: u32,
partial: String,
},
ContentFiltered {
turn: u32,
},
MaxTurnsReached {
turns: u32,
},
Cancelled,
InvalidStateTransition {
from: String,
to: String,
},
OperationNotFound(String),
DepthLimitExceeded {
depth: u32,
max: u32,
},
ConcurrencyLimitExceeded,
ConfigError(String),
InvalidToolAccess {
tool: String,
},
InternalError(String),
BuildError(String),
CallbackPending {
tool_name: String,
args: Value,
},
StructuredOutputValidationFailed {
attempts: u32,
reason: String,
last_output: String,
},
InvalidOutputSchema(String),
HookDenied {
point: HookPoint,
reason_code: HookReasonCode,
message: String,
payload: Option<Value>,
},
HookTimeout {
hook_id: String,
timeout_ms: u64,
},
HookExecutionFailed {
hook_id: String,
reason: String,
},
HookConfigInvalid {
reason: String,
},
TerminalFailure {
outcome: TurnTerminalOutcome,
},
NoPendingBoundary,
}Expand description
Errors that can occur during agent execution
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Llm
StoreError(String)
ToolError(String)
McpError(String)
SessionNotFound(SessionId)
TokenBudgetExceeded
TimeBudgetExceeded
ToolCallBudgetExceeded
MaxTokensReached
ContentFiltered
MaxTurnsReached
Cancelled
InvalidStateTransition
OperationNotFound(String)
DepthLimitExceeded
ConcurrencyLimitExceeded
ConfigError(String)
InvalidToolAccess
InternalError(String)
BuildError(String)
Agent construction failed (e.g. missing API key, unknown provider).
CallbackPending
A tool call must be routed externally (callback pending)
StructuredOutputValidationFailed
Structured output validation failed after retries
InvalidOutputSchema(String)
Invalid output schema provided
HookDenied
HookTimeout
HookExecutionFailed
HookConfigInvalid
TerminalFailure
Turn execution reached a terminal outcome classified as HardFailure.
Fields
§
outcome: TurnTerminalOutcomeNoPendingBoundary
The session has no pending user/tool-results boundary for run_pending.
Returned when RuntimeExecutionKind::ResumePending is requested but the
session’s last message is not User or ToolResults. The caller should
treat this as a successful no-op (no turn ran, no output produced).
Implementations§
Source§impl AgentError
impl AgentError
pub fn llm( provider: &'static str, reason: LlmFailureReason, message: impl Into<String>, ) -> Self
pub fn is_graceful(&self) -> bool
pub fn is_rate_limited(&self) -> bool
pub fn retry_after_hint(&self) -> Option<Duration>
pub fn is_recoverable(&self) -> bool
Trait Implementations§
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<AgentError> for CompactionError
impl From<AgentError> for CompactionError
Source§fn from(source: AgentError) -> Self
fn from(source: AgentError) -> Self
Converts to this type from the input type.
Source§impl From<AgentError> for SessionError
impl From<AgentError> for SessionError
Source§fn from(source: AgentError) -> Self
fn from(source: AgentError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for AgentError
impl RefUnwindSafe for AgentError
impl Send for AgentError
impl Sync for AgentError
impl Unpin for AgentError
impl UnsafeUnpin for AgentError
impl UnwindSafe for AgentError
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