A method for controlling a production process performed by collaborating machines, M i, of an automation system, wherein each collaborating machine, M i, of the automation system comprises an associated workflow execution context of said collaborating machine, M i, stored in a local memory of said collaborating machine, M i, wherein the workflow execution context of each collaborating machine, M i, includes a workflow, WF, of the respective collaborating machine, M i, and a precondition context associated with said workflow, WF, comprising preconditions for executing automated handling functions (AHFs) by the respective collaborating machine, M i, depending on the workflows, WFs, and automated handling functions (AHFs) of other collaborating machines, M i, of the automation system, wherein each collaborating machine, M i, of the automation system comprises a collaborative workflow processor having access to a shared database of the automation system to determine workflow states, s, wherein the shared database stores during operation of the automation system metadata about automated handling functions having been executed by the collaborating machines, M i, and workflow states, s, of the collaborating machines, M i, communicated by the collaborative workflow processors (CWPs) to the shared database of said automation system, wherein the shared sequence of completed automated handling function instances and workflow states, s, are processed by the collaborative workflow processors (CWPs) of the collaborating machines, M i, of said automation system to coordinate the automated handling functions (AHFs) between the collaborating machines, M i, during the production process. wherein each collaborating machine, M i, of the automation system comprises an associated workflow execution context of said collaborating machine, M i, stored in a local memory of said collaborating machine, M i, wherein the workflow execution context of each collaborating machine, M i, includes a workflow, WF, of the respective collaborating machine, M i, and a precondition context associated with said workflow, WF, comprising preconditions for executing automated handling functions (AHFs) by the respective collaborating machine, M i, depending on the workflows, WFs, and automated handling functions (AHFs) of other collaborating machines, M i, of the automation system, wherein each collaborating machine, M i, of the automation system comprises a collaborative workflow processor having access to a shared database of the automation system to determine workflow states, s, wherein the shared database stores during operation of the automation system metadata about automated handling functions having been executed by the collaborating machines, M i, and workflow states, s, of the collaborating machines, M i, communicated by the collaborative workflow processors (CWPs) to the shared database of said automation system, wherein the shared sequence of completed automated handling function instances and workflow states, s, are processed by the collaborative workflow processors (CWPs) of the collaborating machines, M i, of said automation system to coordinate the automated handling functions (AHFs) between the collaborating machines, M i, during the production process.