-
Notifications
You must be signed in to change notification settings - Fork 3k
docs: add tool guardrails documentation #2218
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
base: main
Are you sure you want to change the base?
docs: add tool guardrails documentation #2218
Conversation
Add comprehensive documentation for tool input and output guardrails: - Explain difference between tool and agent-level guardrails - Document @tool_input_guardrail decorator with examples - Document @tool_output_guardrail decorator with examples - Add behavior types table (allow, reject_content, raise_exception) - Include exception handling examples Closes openai#1830
seratch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sending this improvement! The changes look good to me, but as mentioned in my comments, I'd like to make the dev experience more intuitive before publishing these document sections. I will update you once the feature enhancement is available.
|
|
||
|
|
||
| # Attach the guardrail to the tool | ||
| send_email.tool_input_guardrails = [validate_email_args] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this is the only way to pass tool guardrails but thinking of better developer experience, enabling to pass the same to the decorator would be better. I will come up with a pull request enhancing this.
|
|
||
|
|
||
| # Attach the guardrail to the tool | ||
| get_user_data.tool_output_guardrails = [block_sensitive_data] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
|
This PR is stale because it has been open for 10 days with no activity. |
Summary
Add comprehensive documentation for tool input and output guardrails to
docs/guardrails.md. This addresses the gap identified in #1830 where tool guardrails (implemented in PR #1792) were not documented in the main guides.The new documentation explains:
@tool_input_guardrailand@tool_output_guardraildecoratorsallow,reject_content, andraise_exceptionTest plan
uv run mkdocs buildIssue number
Closes #1830
Checks
make lintandmake format