For an algorithmic system, i.e. a system that can be described completely by a formal theory, there is no such thing as action or purpose. The category of purpose is not applicable to systems with fixed laws that are describable completely by a finite set of rules. An algorithm just behaves; it behaves the way it has been programmed.
A creative system, on the other hand, can act. It may define a purpose before it contains the knowledge necessary to achieve that purpose, before it knows the way. A purpose can then be used to select those new bits of information acquired from the world that may be helpful to achieve the purpose. It can act to achieve purposes.
The world of purposes, intentions and actions only arises with the emergence of creativity and the incompleteness connected to it.
(The picture is from https://commons.wikimedia.org/wiki/File:Uni-facial_Stone_Tool_LACMA_M.80.202.244.jpg)