Although cooperation is widespread from amoebas to humans, the underlying mechanisms are still not well understood, which precludes a full understanding of how cooperation evolved, particularly the complex forms seen in both nonhuman and human primates. The diversity of forms and expressions of cooperation seen across species complicates this, a challenge that has been addressed empirically with studies of cooperation into the lab, where similar methods can be used across species, allowing us to determine what mechanisms are, or are not, shared across species. In the case of cooperation, these methods include joint-action tasks (such as the cooperative barpull) and economic games. With data from standardized lab tests, we can make predictions about how each species should respond in more species-typical, natural contexts. This process allows us to understand not only when mechanisms are shared that might not be obvious (i.e., because they manifest in different ways), but when similar outcomes are underpinned by dissimilar mechanisms. For instance, many primates coordinate, but results from economic games suggest that they do so using a variety of different mechanisms. In addition, we can use these results to identify situations in which cognitive abilities are present, but may not manifest, and to look for the environmental pressures that may inhibit their expression. For example, chimpanzees show evidence of many of the mechanisms necessary for trade and barter, but they do not manifest in all contexts, possibly due to the absence of third-party enforcement mechanisms. Ultimately, understanding cooperation requires recognizing the interplay between cognitive mechanisms and ecology, such that we identify not only how and in what contexts other primates cooperate, but also those situations in which primates do not cooperate, but might be expected to. In so doing, we also move closer to understanding both how humans cooperate, and why it sometimes breaks down so spectacularly.