Skip to content

Conversation

@TasmeerJamali
Copy link

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:

  • The difference between agent-level and tool-level guardrails
  • How to use @tool_input_guardrail and @tool_output_guardrail decorators
  • The three behavior types: allow, reject_content, and raise_exception
  • How to attach guardrails to tools and handle exceptions

Test plan

  • Verified documentation builds successfully with uv run mkdocs build
  • All code examples use valid Python syntax with correct imports
  • Formatting is consistent with existing documentation style

Issue number

Closes #1830

Checks

  • I've added new tests (if relevant) - N/A (documentation only)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add #1792 tool guardrails to the guardrails document page

1 participant