openai/openai-agents-python

Add maximum length validation for Agent.name

Closed this issue · 1 comments

Please read this first

  • Have you read the docs?Agents SDK docs yes
  • Have you searched for related issues? yes

Describe the feature

Right now, Agent.name only has a type check to ensure it's a string, but there's no limit on how long that string can be. This allows very large or unwieldy names (hundreds of characters), which can cause issues:

  • UI overflow or layout problems when names are displayed
  • Logging or database storage problems if names are stored or indexed
  • Hard to read or manage in dashboards or tracing outputs

Proposed Feature

  • Add a default max length (for example, 64 or 100 characters) for Agent.name.
  • Throw a clear error if someone tries to instantiate an agent with a name exceeding that limit.
  • Optionally, allow configuring this limit (e.g. via SDK settings or a parameter) so users can override if they need longer names (though that should be rare).

Benefit

  • Prevents accidental misuse / very long names
  • Improves maintainability, readability and consistency in tools, UIs, logs
  • Consistent developer experience

Check if Already Reported

I checked existing issues on the OpenAI Agents SDK (Python) and found no issue specifically about name length or validation.
So this would be a new enhancement.

The length validation may be introduced on the server side in the future, but right now there is not limit for the property. Either way, we'd like to avoid having custom logic on the client side but it could cause gap between the server and client app code.

Thanks for the suggestion!