In comparison to non-human animals, humans are highly flexible in cooperative tasks, which may be a result of their ability to understand a partner's role in such interactions. Here, we tested if wolves and dogs could flexibly adjust their behaviour according to whether they needed a partner to solve a cooperative loose string-pulling paradigm. First, we presented animals with a delay condition where a human partner was released after the subject so that the animal had to delay pulling the string to enable coordinated pulling with the human partner. Subsequently, we investigated whether subjects would recruit a partner depending on whether they could operate the apparatus alone, or help from a partner was required. Both wolves and dogs successfully waited in the delay condition in 88% of the trials. Experimental subjects were also successful in recruiting a partner, which occurred significantly more often in the cooperation trials than in the solo pulling condition. No species differences were found in either experiment. These results suggest that both wolves and dogs have some understanding of whether a social partner is needed to accomplish a task, which enables behavioural coordination and cooperation.