pub enum AgentsError {
Show 13 variants
OpenAIError(OpenAIError),
MaxTurnsExceeded {
max_turns: usize,
},
InputGuardrailTriggered {
message: String,
},
OutputGuardrailTriggered {
message: String,
},
ToolExecutionError {
message: String,
},
HandoffError {
message: String,
},
ModelBehaviorError {
message: String,
},
UserError {
message: String,
},
SessionError(String),
SerializationError(Error),
IoError(Error),
DatabaseError(Error),
Other(String),
}Expand description
The main error enum for the Agents SDK.
AgentsError consolidates all possible errors that can occur within the
SDK into a single, comprehensive type. This allows for robust and centralized
error handling.
Variants§
OpenAIError(OpenAIError)
An error originating from the underlying async-openai crate.
MaxTurnsExceeded
Indicates that the maximum number of turns for an agent run has been exceeded, preventing infinite loops.
InputGuardrailTriggered
An input guardrail was triggered, indicating that the user’s input violated a predefined constraint.
OutputGuardrailTriggered
An output guardrail was triggered, indicating that the agent’s response violated a predefined constraint.
ToolExecutionError
An error occurred during the execution of a tool.
HandoffError
An error occurred during a handoff between agents.
ModelBehaviorError
An error indicating unexpected or invalid behavior from the LLM.
UserError
An error caused by invalid user input or configuration.
SessionError(String)
An error related to session management, such as a failure to read or write to the session store.
SerializationError(Error)
An error that occurred during JSON serialization or deserialization.
IoError(Error)
An I/O error, typically related to file system operations.
DatabaseError(Error)
An error from the database, used by persistent session stores.
Other(String)
A catch-all for any other type of error.
Trait Implementations§
Source§impl Debug for AgentsError
impl Debug for AgentsError
Source§impl Display for AgentsError
impl Display for AgentsError
Source§impl Error for AgentsError
impl Error for AgentsError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for AgentsError
impl From<Error> for AgentsError
Source§impl From<Error> for AgentsError
impl From<Error> for AgentsError
Source§impl From<Error> for AgentsError
impl From<Error> for AgentsError
Source§impl From<OpenAIError> for AgentsError
impl From<OpenAIError> for AgentsError
Source§fn from(source: OpenAIError) -> Self
fn from(source: OpenAIError) -> Self
Auto Trait Implementations§
impl Freeze for AgentsError
impl !RefUnwindSafe for AgentsError
impl Send for AgentsError
impl Sync for AgentsError
impl Unpin for AgentsError
impl UnsafeUnpin for AgentsError
impl !UnwindSafe for AgentsError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.