Skip to content

Conversation

@steven10a
Copy link
Collaborator

@steven10a steven10a commented Oct 30, 2025

Fixes reported bug from rcatoen:

TypeError: GuardrailAgent.__new__() missing 1 required positional argument: 'instructions' when using prompt instead of instructions

Fix:

  • Typing for instruction was too strict required it to be a string
  • Functionality was already supported as we are simply a wrapper around Agent SDK

Also added support for users adding their own input and output guardrails via the Agent SDK.

  • These were silently suppressed and only guardrails via the config were run
  • We now merge the lists and run all of them

Deleted an old NSFW.md file that is not being used

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the GuardrailAgent class to support dynamic instructions and user-provided guardrails, while also removing outdated NSFW benchmark documentation.

  • Made the instructions parameter optional and support callable functions for dynamic generation
  • Added support for user-provided input_guardrails and output_guardrails that merge with config-based guardrails
  • Removed deprecated NSFW benchmark documentation file

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/guardrails/agents.py Enhanced GuardrailAgent.__new__() to accept optional/callable instructions and merge user-provided guardrails with config-based guardrails
docs/benchmarking/nsfw.md Removed entire file containing outdated NSFW benchmark results and documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@gabor-openai gabor-openai left a comment

Choose a reason for hiding this comment

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

LGTM thank you!

@gabor-openai gabor-openai merged commit 794ff02 into main Oct 30, 2025
3 checks passed
@gabor-openai gabor-openai deleted the dev/steven/agent_bug branch October 30, 2025 17:41
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.

3 participants