Skip to content

Enhance exception guide in docs #1321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 31, 2025

Conversation

MuhammadHamidRaza
Copy link
Contributor

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 in agents.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:

  • Providing Clearer Context: Each definition now offers more context on the circumstances that lead to the exception.
  • Actionable Understanding: Users will better understand the root cause of the error, helping them to debug and implement agents more effectively.
  • Improved Onboarding: A clear understanding of error handling from the outset will greatly enhance the onboarding experience for developers new to the Agents SDK.

Specific improvements for each exception:

  • AgentsException: Clarified its role as the base class for all SDK exceptions.
  • MaxTurnsExceeded: Explicitly mentions all relevant Runner methods (run, run_sync, run_streamed) where max_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.

@seratch seratch added the documentation Improvements or additions to documentation label Jul 31, 2025
@seratch seratch changed the title Enhance and clarify Agents SDK exception definitions for improved beginner-friendliness Enhance exception guide in docs Jul 31, 2025
@seratch seratch merged commit 12102e6 into openai:main Jul 31, 2025
6 checks passed
vcshih pushed a commit to veris-ai/openai-agents-python that referenced this pull request Aug 15, 2025
Co-authored-by: muhammadhamidrazasidtechno <160109562+muhammadhamidrazasidtechno@users.noreply.github.com>
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants