1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AgentError {
5 #[error("Language model error: {0}")]
6 LanguageModel(#[from] llm_sdk::LanguageModelError),
7 #[error("Invariant: {0}")]
8 Invariant(String),
9 #[error("Tool execution error: {0}")]
10 ToolExecution(#[source] BoxedError),
11 #[error("Run initialization error: {0}")]
12 Init(#[source] BoxedError),
13 #[error("The maximum number of turns ({0}) has been exceeded.")]
14 MaxTurnsExceeded(usize),
15}
16
17pub type BoxedError = Box<dyn std::error::Error + Send + Sync>;