pub trait ToolErrorRecovery: Send + Sync {
// Required method
fn on_error(
&self,
_session_id: &SessionId,
_tool_names: &[String],
_error: &AgentError,
) -> AgentResult<ToolErrorAction>;
// Provided method
fn on_success(&self, _session_id: &SessionId, _tool_name: &str) { ... }
}Expand description
Recovery strategy after a tool execution failure
Defaults to StopOnError, following the lightweight kernel design of
conservative defaults and strategy injection.
Upper-layer agents can inject custom strategies such as RetryOnError.
Required Methods§
fn on_error( &self, _session_id: &SessionId, _tool_names: &[String], _error: &AgentError, ) -> AgentResult<ToolErrorAction>
Provided Methods§
Sourcefn on_success(&self, _session_id: &SessionId, _tool_name: &str)
fn on_success(&self, _session_id: &SessionId, _tool_name: &str)
Called when a tool executes successfully.
Default no-op. Strategies that track consecutive failures (e.g.
ConsecutiveFailureRecovery) override this to reset that tool’s counter so
the “consecutive” semantics hold: a success breaks the failure streak.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".