Skip to content

Commit ac9682c

Browse files
authored
Merge pull request #1601 from newrelic/sgoel/fixed_tool_type_bug
[Draft] Fixed tool type bug for strands
2 parents c31c334 + ac6eb5f commit ac9682c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

newrelic/hooks/mlmodel_strands.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,10 @@ async def aclose(self):
416416

417417
def wrap_ToolRegister_register_tool(wrapped, instance, args, kwargs):
418418
bound_args = bind_args(wrapped, args, kwargs)
419-
bound_args["tool"]._tool_func = ErrorTraceWrapper(bound_args["tool"]._tool_func)
419+
tool = bound_args.get("tool")
420+
421+
if hasattr(tool, "_tool_func"):
422+
tool._tool_func = ErrorTraceWrapper(tool._tool_func)
420423
return wrapped(*args, **kwargs)
421424

422425

0 commit comments

Comments
 (0)