I am not aware of any written or verbal agreement between the two sides to keep the monastery free of military forces. The Germans had given assurances to the Vatican that they would not occupy the building but that information does not seem to have been passed to the Allies. The Allies made no such guarantee.
In any event many senior Allied commanders were convinced that the Germans were using the building as an observation post or as a firing post for artillery. Others said it made no difference, that the monastery should be bombed anyway to prevent it's inevitable use by the Germans. The few voices that argued against the bombing were ignored or overruled.
Hindsight tells us both that the Germans were not in fact using the building (though they were probably close to it) and that the ruins were far more useful to them than the original building was. Apparently the lessons that the Soviets learned at Stalingrad a year or more earlier about how to use rubble in defensive positions had not reached the Allied command in February 1944.
Actually, only the Germans declared it was a neutral zone. A variety of Allied commanders were of the opinion that they had seen German troops or evidence of troops near the abbey. One commander, Francis Tuker, whose troops would've launched the assault, was of the opinion that even if it wasn't occupied at the moment, there was nothing to stop the Germans from moving into the abbey, and if so, that his troops didn't have any way to defeat its fortifications short of airborne bombing. This was further compounded by what was a likely attempt by air commanders to really showcase Allied airpower. Nearly 300 planes attacked the abbey, dropping some 1000 tons of bombs, which for comparison was about half the amount used in the pre-Normandy bombing raids on Caen.
In any event, it was quite stupid, both because the Germans used the destruction as a propaganda tool, and the now rubble-strewn destroyed abbey was now a defender's paradise which the elite paratroops defending the area quickly moved into. Tanks were unable to navigate the rubble, depriving the infantry of support, and further bombing was ineffective given the rubble everywhere.