docs: add tool guardrails documentation#2218
docs: add tool guardrails documentation#2218TasmeerJamali wants to merge 1 commit intoopenai:mainfrom
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.
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.
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.
There was a problem hiding this comment.
can you simplify the code using the new options by #2227?
|
|
||
|
|
||
| # Attach the guardrail to the tool | ||
| get_user_data.tool_output_guardrails = [block_sensitive_data] |
|
This PR is stale because it has been open for 10 days with no activity. |
|
Thanks again for sending this. The tool guardrail documentation is now available by #2307 |
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