#[derive(Debug, Clone, thiserror::Error)]
pub enum AgentError {
#[error("tool error: {0}")]
Tool(String),
#[error("validation error: {0}")]
Validation(String),
#[error("operation aborted")]
Abort,
#[error("provider error: {0}")]
Provider(String),
#[error("queue error: {0}")]
Queue(String),
#[error("invalid state: {0}")]
State(String),
}
impl AgentError {
pub fn tool(message: impl Into<String>) -> Self {
AgentError::Tool(message.into())
}
pub fn is_abort(&self) -> bool {
matches!(self, AgentError::Abort)
}
}