Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Exceptions

RunErrorDetailsdataclass

Data collected from an agent run when an exception occurs.

Source code insrc/agents/exceptions.py
@dataclassclassRunErrorDetails:"""Data collected from an agent run when an exception occurs."""input:str|list[TResponseInputItem]new_items:list[RunItem]raw_responses:list[ModelResponse]last_agent:Agent[Any]context_wrapper:RunContextWrapper[Any]input_guardrail_results:list[InputGuardrailResult]output_guardrail_results:list[OutputGuardrailResult]def__str__(self)->str:returnpretty_print_run_error_details(self)

AgentsException

Bases:Exception

Base class for all exceptions in the Agents SDK.

Source code insrc/agents/exceptions.py
classAgentsException(Exception):"""Base class for all exceptions in the Agents SDK."""run_data:RunErrorDetails|Nonedef__init__(self,*args:object)->None:super().__init__(*args)self.run_data=None

MaxTurnsExceeded

Bases:AgentsException

Exception raised when the maximum number of turns is exceeded.

Source code insrc/agents/exceptions.py
classMaxTurnsExceeded(AgentsException):"""Exception raised when the maximum number of turns is exceeded."""message:strdef__init__(self,message:str):self.message=messagesuper().__init__(message)

ModelBehaviorError

Bases:AgentsException

Exception raised when the model does something unexpected, e.g. calling a tool that doesn'texist, or providing malformed JSON.

Source code insrc/agents/exceptions.py
classModelBehaviorError(AgentsException):"""Exception raised when the model does something unexpected, e.g. calling a tool that doesn't    exist, or providing malformed JSON.    """message:strdef__init__(self,message:str):self.message=messagesuper().__init__(message)

UserError

Bases:AgentsException

Exception raised when the user makes an error using the SDK.

Source code insrc/agents/exceptions.py
classUserError(AgentsException):"""Exception raised when the user makes an error using the SDK."""message:strdef__init__(self,message:str):self.message=messagesuper().__init__(message)

InputGuardrailTripwireTriggered

Bases:AgentsException

Exception raised when a guardrail tripwire is triggered.

Source code insrc/agents/exceptions.py
classInputGuardrailTripwireTriggered(AgentsException):"""Exception raised when a guardrail tripwire is triggered."""guardrail_result:InputGuardrailResult"""The result data of the guardrail that was triggered."""def__init__(self,guardrail_result:InputGuardrailResult):self.guardrail_result=guardrail_resultsuper().__init__(f"Guardrail{guardrail_result.guardrail.__class__.__name__} triggered tripwire")

guardrail_resultinstance-attribute

guardrail_result:InputGuardrailResult=guardrail_result

The result data of the guardrail that was triggered.

OutputGuardrailTripwireTriggered

Bases:AgentsException

Exception raised when a guardrail tripwire is triggered.

Source code insrc/agents/exceptions.py
classOutputGuardrailTripwireTriggered(AgentsException):"""Exception raised when a guardrail tripwire is triggered."""guardrail_result:OutputGuardrailResult"""The result data of the guardrail that was triggered."""def__init__(self,guardrail_result:OutputGuardrailResult):self.guardrail_result=guardrail_resultsuper().__init__(f"Guardrail{guardrail_result.guardrail.__class__.__name__} triggered tripwire")

guardrail_resultinstance-attribute

guardrail_result:OutputGuardrailResult=guardrail_result

The result data of the guardrail that was triggered.


[8]ページ先頭

©2009-2025 Movatter.jp