Expand description
§Error Types
Error types for the Bob Agent Framework.
This module provides comprehensive error handling with:
AgentError: Top-level error enum wrapping all error typesLlmError: Errors from LLM providersToolError: Errors from tool executionStoreError: Errors from session storage
§Error Codes
Every error variant carries a stable machine-readable error code
(e.g. "BOB_LLM_RATE_LIMITED", "BOB_TOOL_TIMEOUT").
Codes are stable across patch releases and can be used for monitoring,
alerting rules, and structured error reporting.
§Error Handling Strategy
All errors use thiserror for ergonomic error definitions and implement:
std::error::Errorfor compatibilityDisplayfor user-friendly messagesFromfor automatic conversion
§Example
ⓘ
use bob_core::error::{AgentError, LlmError};
fn handle_error(err: AgentError) {
eprintln!("[{}] {}", err.code(), err);
match err {
AgentError::Llm(e) => eprintln!("LLM error: {}", e),
AgentError::Tool(e) => eprintln!("Tool error: {}", e),
AgentError::Policy(msg) => eprintln!("Policy violation: {}", msg),
AgentError::Timeout => eprintln!("Operation timed out"),
_ => eprintln!("Other error: {}", err),
}
}Enums§
- Agent
Error - Top-level agent error.
- Cost
Error - Cost meter errors.
- LlmError
- LLM adapter errors.
- Store
Error - Session store errors.
- Tool
Error - Tool execution errors.