Skip to content

Add missing guardrail exception import to quickstart #1161

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 3 commits into from
Jul 18, 2025

Conversation

slubbers-openai
Copy link
Contributor

docs: add missing InputGuardrailTripwireTriggered import to quickstart example

Fixes NameError when handling guardrail exceptions by including the required import in the docs.

…t example

Fixes NameError when handling guardrail exceptions by including the required import in the docs.
@seratch seratch added the documentation Improvements or additions to documentation label Jul 16, 2025
@seratch
Copy link
Member

seratch commented Jul 16, 2025

The full version is covered at https://openai.github.io/openai-agents-python/guardrails/ and this quick start page keeps things as simple as possible. Having the complete code for guardrail use cases in quick start too would be fine, but in the case, try/except clauses should be added too (the current code snippet in the quick start page does not use the exception at all).

@slubbers-openai
Copy link
Contributor Author

Thanks for the feedback @seratch! Good catch. I’ve now added the full try/except block (when I was working through this example having the exception handling made the outputs much easier to read and navigate).

Understand if you’d prefer to keep the quickstart as simple as possible though, so feel free to accept or discard this addition as you see fit.

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; @rm-openai let me know if you have any opinions here!

@seratch seratch requested a review from rm-openai July 18, 2025 00:07
@rm-openai rm-openai merged commit 9046577 into main Jul 18, 2025
5 checks passed
@rm-openai rm-openai deleted the doc/guardrail-exception-import branch July 18, 2025 16:11
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