We investigate whether "binding agreements" can provide a solution to the social dilemma that arises in the presence of pure public goods. Signing a binding agreement can prevent players to free ride on the contributions to the public good. However, a well known theoretical result is that the outcome of the endogenous formation of agreements is not necessarily efficient. In our setting, the individual level of contribution to the public good increases with the size of the coalition reaching an agreement and the global agreement is always the socially optimal structure. Agreements form sequentially. The equilibrium outcome is an asymmetric structure, which consists of two coalitions of different sizes, the small one free riding on the contributions of the bigger one. In our experiment, we propose two treatments which differ in the degree of strategic uncertainty with which the subjects are faced. The results lend force to the theoretical conclusion that outcomes may be inefficient. The average gains achieved are sub-optimal. They are even lower than predicted by the equilibrium agreement structure in the treatment in which the strategic uncertainty is high. They are larger than predicted in the treatment in which the strategic uncertainty is limited. However, it seems that subjects "learn to cooperate" over time and reach the global agreement more often towards the end of sessions.