Which one should I use for this context ? With to or on ?
I think they will agree ......... the terms of our contract.
Agree on a plan suggests two or more people have the same idea about what should be done.
Agree with a proposal or another person when you accept that proposal or the person's point view because both are the same - yours and theirs.
Agree to often plus an infinitive as in: agree to do something as when you have volunteered to do something.
So, I think the best option is "agree with the terms"
When you rent an apartment and there is a contract to sign, you have to agree "to" the terms of the contract and sign your name before they will let you rent it. Most people don't read it in detail so we cannot really say the renter agrees "with" the terms of the contract.
Next time you download a software and there is a box to check. If you agree "to" the terms of the usage, check that box, and you can proceed with the download.