Exceptions
RunErrorDetailsdataclass
Data collected from an agent run when an exception occurs.
Source code insrc/agents/exceptions.py
AgentsException
Bases:Exception
Base class for all exceptions in the Agents SDK.
MaxTurnsExceeded
Bases:AgentsException
Exception raised when the maximum number of turns is exceeded.
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
UserError
Bases:AgentsException
Exception raised when the user makes an error using the SDK.
InputGuardrailTripwireTriggered
Bases:AgentsException
Exception raised when a guardrail tripwire is triggered.
Source code insrc/agents/exceptions.py
guardrail_resultinstance-attribute
guardrail_result:InputGuardrailResult=guardrail_resultThe 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
guardrail_resultinstance-attribute
guardrail_result:OutputGuardrailResult=guardrail_resultThe result data of the guardrail that was triggered.
ToolInputGuardrailTripwireTriggered
Bases:AgentsException
Exception raised when a tool input guardrail tripwire is triggered.
Source code insrc/agents/exceptions.py
guardrailinstance-attribute
guardrail:ToolInputGuardrail[Any]=guardrailThe guardrail that was triggered.
outputinstance-attribute
output:ToolGuardrailFunctionOutput=outputThe output from the guardrail function.
ToolOutputGuardrailTripwireTriggered
Bases:AgentsException
Exception raised when a tool output guardrail tripwire is triggered.
Source code insrc/agents/exceptions.py
guardrailinstance-attribute
guardrail:ToolOutputGuardrail[Any]=guardrailThe guardrail that was triggered.
outputinstance-attribute
output:ToolGuardrailFunctionOutput=outputThe output from the guardrail function.