Skip to content

fix: Enforce string type for Agent 'name' parameter #1340

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

Hafiz-Muhammad-Umar12
Copy link

This Pull Request addresses an inconsistency between the documentation and the runtime behavior of the Agent class.

The issue identified:

  • The documentation for the Agent class states that the name property is a required string.
  • However, the code did not strictly enforce this, allowing non-string values (e.g., integers) to be passed without raising an error. This could lead to unexpected behavior in downstream components and creates confusion for developers.

The solution:

  • A runtime check has been added to the __post_init__ method of the AgentBase class.
  • This check now strictly enforces that the name parameter must be a string, raising a TypeError if an invalid type is provided.

Why this is important:

  • Consistency: The code now accurately reflects what is stated in the documentation, making the SDK more reliable.
  • Clarity: Developers will receive an immediate and clear error message if they attempt to use an incorrect type, significantly

@seratch seratch added the duplicate This issue or pull request already exists label Aug 1, 2025
@seratch
Copy link
Member

seratch commented Aug 1, 2025

Thanks for sending this. We're going to resolve this issue by #998

@seratch seratch closed this Aug 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants