Skip to content

Why does Agent.name accept non-string values at runtime? #1504

@Mohsin-Raza-developer

Description

@Mohsin-Raza-developer

Hi team,

In the OpenAI Agents SDK, the Agent class has a name parameter with type str. However, if I pass a non-string value like an integer or a list, the code still runs without any error:

from agents import Agent, Runner

agent = Agent(name=123, instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)

Why is this possible? Shouldn't the SDK enforce that name must be a string at runtime?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions