Exceptions - OpenAI Agents SDK
RunErrorDetails
dataclass
Data collected from an agent run when an exception occurs.
Source code in src/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't exist, or providing malformed JSON.
Source code in src/agents/exceptions.py
UserError
Bases: AgentsException
Exception raised when the user makes an error using the SDK.
ToolTimeoutError
Bases: AgentsException
Exception raised when a function tool invocation exceeds its timeout.
Source code in src/agents/exceptions.py
InputGuardrailTripwireTriggered
Bases: AgentsException
Exception raised when a guardrail tripwire is triggered.
Source code in src/agents/exceptions.py
guardrail_result
instance-attribute
The result data of the guardrail that was triggered.
OutputGuardrailTripwireTriggered
Bases: AgentsException
Exception raised when a guardrail tripwire is triggered.
Source code in src/agents/exceptions.py
guardrail_result
instance-attribute
The result data of the guardrail that was triggered.
ToolInputGuardrailTripwireTriggered
Bases: AgentsException
Exception raised when a tool input guardrail tripwire is triggered.
Source code in src/agents/exceptions.py
guardrail
instance-attribute
The guardrail that was triggered.
output
instance-attribute
The output from the guardrail function.
ToolOutputGuardrailTripwireTriggered
Bases: AgentsException
Exception raised when a tool output guardrail tripwire is triggered.
Source code in src/agents/exceptions.py
guardrail
instance-attribute
The guardrail that was triggered.
output
instance-attribute
The output from the guardrail function.