Enhance exception guide in docs #1321
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request aims to significantly improve the clarity and understanding of
Agents SDK
exceptions within the documentation. I have updated the definitions for all core exceptions (found inagents.exceptions
) to be more precise, comprehensive, and easier for beginners to grasp.Why these changes are important:
Previously, some exception definitions might have been concise but lacked the detailed explanation necessary for new users to fully understand when and why a particular exception is raised. The goal here is to make the documentation more beginner-friendly by:
Agents SDK
.Specific improvements for each exception:
AgentsException
: Clarified its role as the base class for all SDK exceptions.MaxTurnsExceeded
: Explicitly mentions all relevantRunner
methods (run
,run_sync
,run_streamed
) wheremax_turns
can be exceeded.ModelBehaviorError
: Detailed the common scenarios such as "Malformed JSON" and "Non-existent Tools", which are crucial for understanding unexpected model output.UserError
: Emphasized that this exception is for errors made by the developer using the SDK, due to incorrect implementation or configuration.InputGuardrailTripwireTriggered
/OutputGuardrailTripwireTriggered
: Provided clearer explanations of what guardrails are and their purpose (checking inputs before processing, and checking outputs before delivery, respectively).These updated definitions will be a valuable asset to the SDK's documentation, making it much easier for anyone, regardless of their prior experience, to understand and handle errors effectively.
I believe this update will directly contribute to a smoother learning curve and a better overall experience for all
Agents SDK
users.