Skip to content

Conversation

abdullahimran49
Copy link
Contributor

Previously, the Agent class allowed dynamic instructions functions with any two parameters,
including meaningless dummy names (e.g., def f(wrapper, a)), which caused confusion and
allowed improper usage.

This commit adds strict signature checking in get_system_prompt to ensure the instructions
callable accepts exactly two parameters (context and agent), enforcing correct usage.

If the function signature does not have exactly two parameters, a clear TypeError is raised.

This prevents dummy or incorrect parameter usage, improving API correctness and developer
experience.

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

The change itself looks good to me. Once all the CI jobs pass, we can merge this contribution.

@seratch
Copy link
Member

seratch commented Aug 12, 2025

It seems the tests are still failing

@seratch seratch merged commit 534e2d5 into openai:main Aug 13, 2025
5 checks passed
vcshih pushed a commit to veris-ai/openai-agents-python that referenced this pull request Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants