1use thiserror::Error;
3
4#[derive(Debug, Error, Clone)]
6pub enum AgentError {
7 #[error("Max iterations ({0}) reached without final answer")]
9 MaxIterationsExceeded(u32),
10 #[error("Tool '{name}' not found in registry")]
12 ToolNotFound { name: String },
13 #[error("Tool '{name}' execution failed: {reason}")]
15 ToolFailed { name: String, reason: String },
16 #[error("Parse error in ReAct step: {0}")]
18 ParseError(String),
19 #[error("Timeout: agent exceeded {timeout_ms}ms budget")]
21 Timeout { timeout_ms: u64 },
22 #[error("History overflow: {size} tokens exceeds context limit {limit}")]
24 HistoryOverflow { size: usize, limit: usize },
25 #[error("Serialization error: {0}")]
27 Serialization(String),
28 #[error("Invalid tool signature: {0}")]
30 InvalidToolSignature(String),
31}