-
Notifications
You must be signed in to change notification settings - Fork 1.9k
enhancement: Add tool_name to ToolContext to support shared tool handlers #1043
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
enhancement: Add tool_name to ToolContext to support shared tool handlers #1043
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.
Thanks for quickly working on this!
… tool_context.from_agent_context, Aligned formatting in _run_impl.py
Thanks for the thoughtful feedback @seratch! I've pushed an update that addresses it..if any changes are needed further, please lmk! |
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.
Once the added ### Tool context
document section is deleted and #1048 gets merged, this looks good to me.
@rm-openai Can you take a quick look and share thoughts if you have any?
Co-authored-by: Kazuhiro Sera <seratch@openai.com>
This adds a
tool_name
field toToolContext
, which gets passed into theon_invoke_tool
handler. Helpful for scenarios where we dynamically register multiple tools that all share a single generic handler e.g.in multi-agent setups.As such, by including the name of the tool that was invoked, the handler can now easily branch logic or route requests accordingly.
Resolves #1030
All tests pass. and here is a script to test it out https://gist.github.com/vrtnis/ca354244f7a5ecd9a73c0a2d34cb194b