use crate::brain::provider::ProviderError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum AgentError {
#[error("Provider error: {0}")]
Provider(#[from] ProviderError),
#[error("Database error: {0}")]
Database(String),
#[error("Session not found: {0}")]
SessionNotFound(uuid::Uuid),
#[error("Invalid request: {0}")]
InvalidRequest(String),
#[error("Context too large: {current} tokens exceeds limit of {limit}")]
ContextTooLarge { current: usize, limit: usize },
#[error("Tool execution error: {0}")]
ToolError(String),
#[error("Tool not found: {0}")]
ToolNotFound(String),
#[error("Maximum tool iterations exceeded: {0}")]
MaxIterationsExceeded(usize),
#[error("Cancelled")]
Cancelled,
#[error("Internal error: {0}")]
Internal(String),
}
pub type Result<T> = std::result::Result<T, AgentError>;