- Notifications
You must be signed in to change notification settings - Fork2.8k
Add custom_metadata property to all tool types#2048
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
base:main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When yousign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Uh oh!
There was an error while loading.Please reload this page.
seratch commentedNov 6, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks for sharing this idea! However, we'd like to hold off adding this option to the core module at this moment. Your current approach looks more explicit and it should work well. So, please start with your own module for now. EDITED: sorry my original sentence was unclear |
This pull request adds support for attaching optional custom metadata to all tool classes in
src/agents/tool.py. This metadata can be used to store arbitrary information relevant to each tool instance and is accessible during tool execution, including via agent hooks. Comprehensive tests are included to verify default behavior, metadata assignment, and propagation to hooks.Why?:
Current
New
Custom metadata support for tools:
custom_metadatafield to all tool classes (FunctionTool,FileSearchTool,WebSearchTool,ComputerTool,HostedMCPTool,CodeInterpreterTool,ImageGenerationTool,LocalShellTool) insrc/agents/tool.py, allowing arbitrary metadata to be attached to each tool instance.[1][2][3][4][5][6][7][8]Testing and validation:
tests/test_tool_custom_metadata.pywith tests to ensure thatcustom_metadatadefaults toNone, can be set, and is available in agent hooks during tool execution.