You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the tool implementation assumes that all tools for agents are implemented at compile-time as pre-defined Python functions. It automatically generates a FunctionSchema based off the input function. If we supported a custom function_schema, it would allow for more advanced used cases such as defining tools at runtime (e.g. MCP)
Unfortunately this keeps getting wiped when registering the tool with the Agent. I've narrowed it down to the replace functionality here. I tried a few tweaks such as attempting to make function_schema a private/public attribute of Tool and wasn't able to get it to work correctly without breaking a bunch of tests. I haven't had a chance to troubleshoot further than this.
classAgent(Generic[AgentDepsT, ResultDataT]):
...
def_register_tool(self, tool: Tool[AgentDepsT]) ->None:
"""Private utility to register a tool instance."""iftool.max_retriesisNone:
# noinspection PyTypeCheckertool=dataclasses.replace(tool, max_retries=self._default_retries)
The text was updated successfully, but these errors were encountered:
Resolved the above issue -- I was being silly and accidentally copy-pasted = field(init=False) so it wasn't automatically passing the parameter with dataclasses.replace(). Opened a tentative PR for this feature.
Currently, the tool implementation assumes that all tools for agents are implemented at compile-time as pre-defined Python functions. It automatically generates a
FunctionSchema
based off the input function. If we supported a customfunction_schema
, it would allow for more advanced used cases such as defining tools at runtime (e.g. MCP)I've attempted a naive fix for this as follows:
Unfortunately this keeps getting wiped when registering the tool with the Agent. I've narrowed it down to the
replace
functionality here. I tried a few tweaks such as attempting to makefunction_schema
a private/public attribute ofTool
and wasn't able to get it to work correctly without breaking a bunch of tests. I haven't had a chance to troubleshoot further than this.The text was updated successfully, but these errors were encountered: