Skip to main content

robit_agent/
error.rs

1//! Error types for the robit-agent crate.
2
3use thiserror::Error;
4
5/// Unified error type for Agent operations.
6#[derive(Debug, Error)]
7pub enum AgentError {
8    #[error(transparent)]
9    LlmError(#[from] robit_ai::LlmError),
10
11    #[error(transparent)]
12    DbError(#[from] rusqlite::Error),
13
14    #[error("Configuration error: {0}")]
15    ConfigError(String),
16
17    #[error("Tool execution error: {0}")]
18    ToolError(String),
19
20    #[error("Context overflow: current {current} tokens, max {max} tokens")]
21    ContextOverflow { current: usize, max: usize },
22
23    #[error("Agent internal error: {0}")]
24    InternalError(String),
25}
26
27pub type Result<T> = std::result::Result<T, AgentError>;