Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Agent conversation handling#45

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gabor-openai merged 5 commits intomainfromdev/steven/moderation_bug
Nov 7, 2025
Merged

Conversation

@steven10a
Copy link
Collaborator

@steven10asteven10a commentedNov 7, 2025
edited
Loading

Agent guardrail client was not properly extracting the last user message before sending to guardrails. Instead the entire conversation history was being passed. This caused an error with the moderation endpoint which expected a string.

The fix:

  • Agent client now extracts the latest user message and correctly passes that to guardrails via thedata field

Additionally updated the Agent response to include the full output info dict returned by the guardrails (seedocs for what each check returns)

  • Provides more informative metadata for the developer
  • Returns the same content as the other clients

Guardrail metadata can be accessed when not raised as an exception via the run response withresult.new_items[0].agent.input_guardrails or...output_guardrails

When triggered and raisedexc.guardrail_result.input or...output

Note: This is for accessing agent-level guardrail which are all guardrails exceptPrompt Injection Detection which is run as a tool-level guardrail. Currently, to access the tool-level guardrail results you can useresult.tool_output_guardrail_results[0].output.output_info orexc.output.output_info when raised. It will provide the full metadata when a guardrail is triggered. But if the guardrail passes it will only provide"<guardrail_name> check passed". Modifying that behavior will require a PR to the Agents SDK repo

CopilotAI review requested due to automatic review settingsNovember 7, 2025 20:47
Copy link

CopilotAI 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 refactors the guardrails agent integration to improve concurrency and consistency. The key change is moving from stage-based guardrail batching to individual guardrail execution, allowing the Agents SDK to run guardrails concurrently and improving observability.

  • Refactored_create_agents_guardrails_from_config to create one function per guardrail instead of one per stage
  • Added_extract_text_from_input helper to handle multiple input formats from the Agents SDK
  • Simplified stage names and improved error reporting consistency

Reviewed Changes

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

FileDescription
src/guardrails/agents.pyCore refactoring: creates individual guardrail functions instead of stage-based functions, adds text extraction helper, simplifies stage naming
examples/basic/agents_sdk.pyAdds PII guardrail example and debug code for testing guardrail metadata

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

Copy link

CopilotAI 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

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


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

Copy link

CopilotAI 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

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


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

Copy link

CopilotAI 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

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


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

Copy link

CopilotAI 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

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


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

Copy link
Collaborator

@gabor-openaigabor-openai left a comment

Choose a reason for hiding this comment

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

TY

@gabor-openaigabor-openai merged commitf95ae68 intomainNov 7, 2025
9 checks passed
@gabor-openaigabor-openai deleted the dev/steven/moderation_bug branchNovember 7, 2025 22:34
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@gabor-openaigabor-openaigabor-openai approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@steven10a@gabor-openai

[8]ページ先頭

©2009-2025 Movatter.jp