diff --git a/backend/python/app/agents/tools/wrapper.py b/backend/python/app/agents/tools/wrapper.py index 3f7ba0fcf9..742934c8a8 100644 --- a/backend/python/app/agents/tools/wrapper.py +++ b/backend/python/app/agents/tools/wrapper.py @@ -272,7 +272,9 @@ def _is_class_method(func: Callable) -> bool: Returns: True if function is a class method """ - return hasattr(func, '__qualname__') and '.' in func.__qualname__ + # This optimization avoids computing __qualname__ twice for each call. + qualname = getattr(func, '__qualname__', None) + return qualname is not None and '.' in qualname def _execute_class_method( self,