diff --git a/src/strands/tools/tools.py b/src/strands/tools/tools.py index 9e1c0e608..48b969bc3 100644 --- a/src/strands/tools/tools.py +++ b/src/strands/tools/tools.py @@ -189,6 +189,15 @@ def tool_spec(self) -> ToolSpec: """ return self._tool_spec + @property + def supports_hot_reload(self) -> bool: + """Check if this tool supports automatic reloading when modified. + + Returns: + Always true for function-based tools. + """ + return True + @property def tool_type(self) -> str: """Identifies this as a Python-based tool implementation. diff --git a/tests/strands/tools/test_registry.py b/tests/strands/tools/test_registry.py index ca3cded4c..f0759ea07 100644 --- a/tests/strands/tools/test_registry.py +++ b/tests/strands/tools/test_registry.py @@ -124,8 +124,16 @@ def function() -> str: def test_register_tool_duplicate_name_without_hot_reload(): """Test that registering a tool with duplicate name raises ValueError when hot reload is not supported.""" - tool_1 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None) - tool_2 = PythonAgentTool(tool_name="duplicate_tool", tool_spec=MagicMock(), tool_func=lambda: None) + # Create mock tools that don't support hot reload + tool_1 = MagicMock() + tool_1.tool_name = "duplicate_tool" + tool_1.supports_hot_reload = False + tool_1.is_dynamic = False + + tool_2 = MagicMock() + tool_2.tool_name = "duplicate_tool" + tool_2.supports_hot_reload = False + tool_2.is_dynamic = False tool_registry = ToolRegistry() tool_registry.register_tool(tool_1) diff --git a/tests/strands/tools/test_tools.py b/tests/strands/tools/test_tools.py index b305a1a90..60460f464 100644 --- a/tests/strands/tools/test_tools.py +++ b/tests/strands/tools/test_tools.py @@ -487,7 +487,7 @@ def test_tool_type(identity_tool): @pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True) def test_supports_hot_reload(identity_tool): - assert not identity_tool.supports_hot_reload + assert identity_tool.supports_hot_reload @pytest.mark.parametrize("identity_tool", ["identity_invoke", "identity_invoke_async"], indirect=True)