1use runifold_core::{BudgetExceeded, CheckpointError, JournalError};
2use runifold_effect::EffectExecutorError;
3use runifold_model::ModelError;
4use runifold_tool::ToolError;
5use thiserror::Error;
6
7use crate::GatewayError;
8
9#[derive(Debug, Error)]
11#[non_exhaustive]
12pub enum AgentError {
13 #[error("model invocation failed: {0}")]
15 Model(#[from] ModelError),
16 #[error("tool execution failed: {0}")]
18 Tool(#[from] ToolError),
19 #[error("agent budget exceeded: {0}")]
21 Budget(#[from] BudgetExceeded),
22 #[error("agent delegation failed: {0}")]
24 Gateway(#[from] GatewayError),
25 #[error("agent observability failed: {0}")]
27 Journal(#[from] JournalError),
28 #[error("agent checkpoint failed: {0}")]
30 Checkpoint(#[from] CheckpointError),
31 #[error("agent effect failed: {0}")]
33 Effect(#[from] EffectExecutorError),
34 #[error("checkpoint contains an ambiguous in-flight turn {turn}")]
36 AmbiguousCheckpoint {
37 turn: u32,
39 },
40 #[error("invalid agent configuration: {0}")]
42 InvalidConfig(String),
43 #[error("agent protocol error: {0}")]
45 Protocol(String),
46 #[error("agent exceeded its local maximum of {max_turns} turns")]
48 MaxTurns {
49 max_turns: u32,
51 },
52 #[error("tool `{tool}` returned host-only output")]
54 ToolOutputNotVisible {
55 tool: String,
57 },
58}