pub enum AgentLoopError {
Show 16 variants
Llm(LlmError),
RequestTooLarge(String),
ModelNotAvailable(String),
ModelNotConfigured,
ToolExecution(String),
MessageStore(String),
EventEmission(String),
Configuration(String),
MaxIterationsReached(usize),
Cancelled,
NoMessages,
AgentNotFound(AgentId),
HarnessNotFound(HarnessId),
SessionNotFound(SessionId),
Internal(Error),
DriverNotRegistered(String),
}Expand description
Errors that can occur during agent loop execution
Variants§
Llm(LlmError)
LLM provider error
RequestTooLarge(String)
Request too large error (context length exceeded, token limits, etc.) Contains the original error message for logging
ModelNotAvailable(String)
Model not available (404, model not found, access denied for model) Contains the model_id string that was requested
ModelNotConfigured
No explicit, snapshot, or system-default model could be resolved.
ToolExecution(String)
Tool execution error
MessageStore(String)
Message store error
EventEmission(String)
Event emission error
Configuration(String)
Configuration error
MaxIterationsReached(usize)
Loop terminated due to max iterations
Cancelled
Loop was cancelled
NoMessages
No messages to process
AgentNotFound(AgentId)
Agent not found
HarnessNotFound(HarnessId)
Harness not found
SessionNotFound(SessionId)
Session not found
Internal(Error)
Internal error
DriverNotRegistered(String)
Driver not registered for provider type
Implementations§
Source§impl AgentLoopError
impl AgentLoopError
Sourcepub fn with_provider(self, provider: &str) -> Self
pub fn with_provider(self, provider: &str) -> Self
Prefix provider-bound messages without changing structured identifiers.
Sourcepub fn llm(msg: impl Into<String>) -> Self
pub fn llm(msg: impl Into<String>) -> Self
Create an LLM error with no semantic kind (falls back to string classification downstream).
Sourcepub fn llm_kind(kind: LlmErrorKind, msg: impl Into<String>) -> Self
pub fn llm_kind(kind: LlmErrorKind, msg: impl Into<String>) -> Self
Create an LLM error with a semantic kind assigned at the driver boundary.
Sourcepub fn llm_http(status: u16, body: &str, msg: impl Into<String>) -> Self
pub fn llm_http(status: u16, body: &str, msg: impl Into<String>) -> Self
Create an LLM error from an HTTP failure, classifying it and keeping the status.
This is the constructor HTTP drivers reach for: it is the one place
that both classifies (via
LlmErrorKind::from_provider_status) and preserves the status a
consumer would otherwise have to parse back out of the message.
Sourcepub fn llm_http_kind(
kind: LlmErrorKind,
status: u16,
body: &str,
msg: impl Into<String>,
) -> Self
pub fn llm_http_kind( kind: LlmErrorKind, status: u16, body: &str, msg: impl Into<String>, ) -> Self
Create an LLM error from an HTTP failure a driver has already classified, keeping the status and the provider’s error code.
The counterpart to llm_http for drivers whose
protocol extension classifies more precisely than status and body
alone allow.
Sourcepub fn provider_capability_rejected(
capability: RejectedProviderCapability,
status: u16,
body: &str,
msg: impl Into<String>,
) -> Self
pub fn provider_capability_rejected( capability: RejectedProviderCapability, status: u16, body: &str, msg: impl Into<String>, ) -> Self
Create a structured pre-stream provider capability rejection.
Sourcepub fn rejected_provider_capability(
&self,
capability: RejectedProviderCapability,
) -> bool
pub fn rejected_provider_capability( &self, capability: RejectedProviderCapability, ) -> bool
Whether this error rejects the specified provider capability.
Sourcepub fn with_status(self, status: u16) -> Self
pub fn with_status(self, status: u16) -> Self
Attach the HTTP status to an LLM error that was classified elsewhere.
No-op on non-LLM variants, whose status is implied by the variant and
reported by http_status.
Sourcepub fn with_retry_after_secs(self, secs: u64) -> Self
pub fn with_retry_after_secs(self, secs: u64) -> Self
Attach the delay the provider asked for before another attempt.
Sourcepub fn http_status(&self) -> Option<u16>
pub fn http_status(&self) -> Option<u16>
The HTTP status this failure corresponds to, if any.
Reports the recorded status for Llm, and the status the
variant itself stands for where Everruns classified the failure
semantically instead of carrying one:
ModelNotAvailable is 404 and
RequestTooLarge is 413. Everything else is
None — a caller putting an API in front of Everruns picks its own
status rather than being handed a guess.
Sourcepub fn provider_error_code(&self) -> Option<&str>
pub fn provider_error_code(&self) -> Option<&str>
The provider’s own machine-readable error code, if one was preserved.
Sourcepub fn retry_after_secs(&self) -> Option<u64>
pub fn retry_after_secs(&self) -> Option<u64>
The delay the provider asked for before another attempt, in seconds.
Reads the recorded Retry-After first, then the delay
LlmErrorKind::BillingPressure carries.
Sourcepub fn with_retry_metadata(self, metadata: &RetryMetadata) -> Self
pub fn with_retry_metadata(self, metadata: &RetryMetadata) -> Self
Attach retries already consumed by a lower provider layer. The reason loop uses this to avoid multiplying attempt budgets across layers.
Sourcepub fn llm_retry_attempts(&self) -> u32
pub fn llm_retry_attempts(&self) -> u32
Number of lower-layer retries already consumed by this failure.
Sourcepub fn llm_retry_handled(&self) -> bool
pub fn llm_retry_handled(&self) -> bool
Whether a lower provider layer already exhausted or rejected recovery.
Sourcepub fn llm_error_kind(&self) -> Option<LlmErrorKind>
pub fn llm_error_kind(&self) -> Option<LlmErrorKind>
Get the semantic LLM error kind, if this is an LLM error.
Sourcepub fn agent_not_found(agent_id: AgentId) -> Self
pub fn agent_not_found(agent_id: AgentId) -> Self
Create an agent not found error
Sourcepub fn harness_not_found(harness_id: HarnessId) -> Self
pub fn harness_not_found(harness_id: HarnessId) -> Self
Create a harness not found error
Sourcepub fn session_not_found(session_id: SessionId) -> Self
pub fn session_not_found(session_id: SessionId) -> Self
Create a session not found error
Sourcepub fn driver_not_registered(provider_type: impl Into<String>) -> Self
pub fn driver_not_registered(provider_type: impl Into<String>) -> Self
Create a driver not registered error
Sourcepub fn request_too_large(msg: impl Into<String>) -> Self
pub fn request_too_large(msg: impl Into<String>) -> Self
Create a request too large error
Sourcepub fn model_not_available(model_id: impl Into<String>) -> Self
pub fn model_not_available(model_id: impl Into<String>) -> Self
Create a model not available error
Sourcepub fn model_not_configured() -> Self
pub fn model_not_configured() -> Self
Create a missing-model configuration error.
Sourcepub fn is_request_too_large(&self) -> bool
pub fn is_request_too_large(&self) -> bool
Check if this is a request-too-large error
Sourcepub fn is_model_not_available(&self) -> bool
pub fn is_model_not_available(&self) -> bool
Check if this is a model-not-available error
Sourcepub fn model_not_available_id(&self) -> Option<&str>
pub fn model_not_available_id(&self) -> Option<&str>
Get the model ID if this is a model-not-available error
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Check if this is a rate-limit error (semantic kind, or HTTP 429 / rate-limit keywords for untyped errors)
Sourcepub fn is_auth_error(&self) -> bool
pub fn is_auth_error(&self) -> bool
Check if this is an authentication/authorization error (HTTP 401/403)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server error (HTTP 5xx or transient provider issue)
Sourcepub fn is_transient_llm_error(&self) -> bool
pub fn is_transient_llm_error(&self) -> bool
Check whether an LLM failure is safe to retry.
Semantic driver classification is authoritative. Untyped legacy errors retain the message-based fallback until all drivers preserve structure.
Sourcepub fn is_non_retryable(&self) -> bool
pub fn is_non_retryable(&self) -> bool
Check if this error is deterministic and should never be retried.
Non-retryable errors reference data that is permanently gone (e.g. a deleted message, a missing agent). Retrying will never succeed and only burns attempts while keeping the workflow stuck.
Note: the durable worker currently uses string-matching via
is_non_retryable_task_error because task errors arrive as strings.
This method provides the typed equivalent for callers that have access
to a structured AgentLoopError.
Sourcepub fn user_facing_message(&self) -> String
pub fn user_facing_message(&self) -> String
Get user-facing error message based on error classification
Sourcepub fn user_facing_error(
&self,
context: UserFacingErrorContext,
) -> UserFacingError
pub fn user_facing_error( &self, context: UserFacingErrorContext, ) -> UserFacingError
Get structured user-facing error metadata based on error classification.
Trait Implementations§
Source§impl Debug for AgentLoopError
impl Debug for AgentLoopError
Source§impl Display for AgentLoopError
impl Display for AgentLoopError
Source§impl Error for AgentLoopError
impl Error for AgentLoopError
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()