Joshua and Israel made an agreement with the Gibeonites to spare them in the conquest of the Land of Canaan, an agreement which should not have been made.
Nevertheless, Joshua and the leaders made the agreement, and the rest of the Israelites throughout history had to keep that agreement, but King Saul did not and killed some Gibeonites.
For that, the Lord sent a famine into the land during the days of King David. When he discovered the problem, he went to the Gibeonites to ask them what had to be done. “Then they answered the king, ‘As for the man who consumed us and plotted against us…let seven men of his descendants be delivered to us, and we will hang them before the LORD in Gibeah of Saul, whom the LORD chose.’ And the king said, ‘I will give them'” (2 Samuel 21:5, 6).
When an agreement has been broken, there is a penalty, and in this case, it was life for life.
Have you made an agreement with someone? Keep it, even if you realize later that you made a mistake.