Skip to content

error

Error types for the Agent SDK

This module provides unified error handling for the SDK, wrapping underlying A2A protocol errors and adding SDK-specific error types.

type SdkResult = Result<T, SdkError>;

Result type for SDK operations

SDK-specific error types

Wraps underlying A2A protocol errors and adds SDK-specific error cases for better error handling and user experience.

Variants

VariantDescription
A2AProtocol(error::A2AError)A2A protocol error
Configuration { ... }Configuration error
AgentInitialization { ... }Agent initialization error
SkillRegistration { ... }Skill registration error
MethodExecution { ... }Method execution error
Serialization(serde_json::Error)Serialization error
Io(Error)IO error
Generic(anyhow::Error)Generic error
FeatureNotEnabled { ... }Feature not enabled
InvalidInput { ... }Invalid input

Methods

fn configuration<impl Into<String>>(details: impl Into) -> Self

Create a configuration error

fn agent_initialization<impl Into<String>>(reason: impl Into) -> Self

Create an agent initialization error

fn skill_registration<impl Into<String>, impl Into<String>>(skill: impl Into, reason: impl Into) -> Self

Create a skill registration error

fn method_execution<impl Into<String>, impl Into<String>>(method: impl Into, details: impl Into) -> Self

Create a method execution error

fn feature_not_enabled<impl Into<String>>(feature: impl Into) -> Self

Create a feature not enabled error

fn invalid_input<impl Into<String>>(details: impl Into) -> Self

Create an invalid input error

fn is_recoverable(&self) -> bool

Check if error is recoverable

fn category(&self) -> &''static str

Get error category for monitoring/logging