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

Add Runtime Validation forname Attribute inAgent Class#1050

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

Closed

Conversation

EngineerAbdullahIqbal

This pull request proposes adding runtime validation to theAgent class in theopenai-agents-sdk to ensure thename attribute is a non-empty string. This change addresses the issue where non-string types (e.g., integers or dictionaries) are currently accepted, despite thestr type annotation, which can lead to unexpected behavior. By implementing validation, we make the SDK more robust and user-friendly.

Proposed Change

The proposed solution adds a__post_init__ method to theAgent class to validate thatname is a string and not empty or whitespace-only. This approach is standard for Python dataclasses and does not affect other attributes or methods.

Why It Matters

This change prevents potential errors, aligns with type annotations, and improves the user experience by providing clear feedback on invalid inputs. It benefits the community by making the SDK more reliable, encouraging adoption, and reducing support overhead.

The__post_init__ method is the most suitable, as it is lightweight, aligns with Python dataclass conventions, and requires minimal changes to the existing codebase.

@seratchseratch added duplicateThis issue or pull request already exists enhancementNew feature or request feature:core labelsJul 10, 2025
@seratch
Copy link
Member

Thanks for sending this PR! but we're already working on this at#998; please feel free to add comments if you have any.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
duplicateThis issue or pull request already existsenhancementNew feature or requestfeature:core
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@EngineerAbdullahIqbal@seratch

[8]ページ先頭

©2009-2025 Movatter.jp