Skip to main content

bamboo_agent_core/agent/
error.rs

1//! Agent error types
2//!
3//! This module defines the error types used throughout the agent system.
4
5use thiserror::Error;
6
7/// Errors that can occur during agent operations
8#[derive(Error, Debug)]
9pub enum AgentError {
10    /// Session with the specified ID was not found
11    #[error("Session not found: {0}")]
12    SessionNotFound(String),
13
14    /// Error from LLM provider (API error, network error, etc.)
15    #[error("LLM error: {0}")]
16    LLM(String),
17
18    /// LLM request exceeded provider context/input limits and requires
19    /// host-side overflow recovery before retry.
20    #[error("LLM overflow: {0}")]
21    LLMOverflow(String),
22
23    /// Error during tool execution
24    #[error("Tool error: {0}")]
25    Tool(String),
26
27    /// Token budget exceeded error
28    #[error("Budget error: {0}")]
29    Budget(String),
30
31    /// Agent execution was cancelled by user
32    #[error("Cancelled")]
33    Cancelled,
34}