#[non_exhaustive]pub enum AgentError {
Memory(MemoryError),
Provider(ProviderError),
TooManyToolRounds(usize),
Cancelled,
StructuredParse(String),
StructuredRetriesExhausted(usize),
DeadlineExceeded,
EffectRequiresHarness(String),
InvalidStep(String),
}Expand description
Reasons an Agent run can fail.
A tool execution failure is not an AgentError — it is fed back to the
model as text, and the model decides what to do next. #[non_exhaustive]
ensures future error categories won’t be a breaking change.
§Examples
use molo::AgentError;
// The round-limit error carries the limit value, useful for prompting
// the user to adjust the config
let err = AgentError::TooManyToolRounds(10);
assert!(err.to_string().contains("10"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Memory(MemoryError)
Context access failed.
Provider(ProviderError)
Communication with the LLM failed.
TooManyToolRounds(usize)
The model kept requesting tools past the implementation’s maximum
number of rounds without giving a final answer. Increase via
AgentConfig::with_max_tool_rounds.
Cancelled
The run was cooperatively cancelled (via the CancellationToken passed to run/run_stream); already-recorded messages are kept, not rolled back.
StructuredParse(String)
Structured output: validation passed but deserializing into the
target type failed — triggered when the JSON the schema allows is
inconsistent with the serde representation of run_typed’s type
parameter U (auto-generated schemas agree with U by default;
conflicts come from #[schemars(...)] custom derives).
StructuredRetriesExhausted(usize)
Structured output: validation failed more times than the configured
limit. Increase via
AgentConfig::with_max_structured_retries.
DeadlineExceeded
The run-level deadline elapsed before the run completed.
EffectRequiresHarness(String)
A tool requested a side effect, but this high-level agent run has no harness driver to govern and execute it.
InvalidStep(String)
A step-wise kernel received an observation that does not match its current state.
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
impl Eq for AgentError
Source§impl Error for AgentError
impl Error for AgentError
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()
Source§impl From<MemoryError> for AgentError
impl From<MemoryError> for AgentError
Source§fn from(source: MemoryError) -> Self
fn from(source: MemoryError) -> Self
Source§impl From<ProviderError> for AgentError
impl From<ProviderError> for AgentError
Source§fn from(source: ProviderError) -> Self
fn from(source: ProviderError) -> Self
Source§impl PartialEq for AgentError
impl PartialEq for AgentError
impl StructuralPartialEq for AgentError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.