atomr_agents_core/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum AgentError {
5 #[error("budget exceeded: {0}")]
6 BudgetExceeded(&'static str),
7
8 #[error("strategy resolution failed: {0}")]
9 Strategy(String),
10
11 #[error("tool invocation failed: {0}")]
12 Tool(String),
13
14 #[error("memory operation failed: {0}")]
15 Memory(String),
16
17 #[error("inference call failed: {0}")]
18 Inference(String),
19
20 #[error("policy denied: {0}")]
21 PolicyDenied(String),
22
23 #[error("workflow error: {0}")]
24 Workflow(String),
25
26 #[error("harness error: {0}")]
27 Harness(String),
28
29 #[error("serialization error: {0}")]
30 Serde(#[from] serde_json::Error),
31
32 #[error("internal: {0}")]
33 Internal(String),
34}
35
36impl AgentError {
37 pub fn internal(msg: impl Into<String>) -> Self {
38 Self::Internal(msg.into())
39 }
40}
41
42pub type Result<T, E = AgentError> = std::result::Result<T, E>;