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("Configuration error: {0}")]
12    ConfigError(String),
13
14    #[error("Tool execution error: {0}")]
15    ToolError(String),
16
17    #[error("Context overflow: current {current} tokens, max {max} tokens")]
18    ContextOverflow { current: usize, max: usize },
19
20    #[error("Agent internal error: {0}")]
21    InternalError(String),
22}
23
24pub type Result<T> = std::result::Result<T, AgentError>;