Hi Victor,
It could happen that the script may not work for created event. You can write the script in Agreement save or validate target. Once the toolbar script calls save event while running the script, the collection which you want will be locked.
The script which is creating Agreement from the project toolbar should call the save event of Agreement.
Kumud