You have to be an informed consumer of the travel industry's product. The list of permitted/prohibited items on TSA's website changes at least weekly. It is in your best interest to read the list each time before you travel.
It is also in your best interest to know what your rights are. If those agents were not behaving in a professional, traveller-centered manner, you are within your rights to speak to a supervisor. If the supervisor is also not behaving professionally, you have a right to file a complaint with the TSA, including the name and badge numbers of any offending screeners or supervisors. I have had occasion to file 6 such complaints, plus an additional two complaints for the way TSA handled my primary complaints. I forwarded all the correspondence to my congressmen and senators, and let them know that I was not happy with my tax dollars going to pay the salaries of pompous jerks who are NOT making air travel safe, but simply harrassing passengers unduly. Just because they wear a badge, that does NOT give them the right to treat you like a prisoner.
By the way, 3 of those original 6 complaints were over a TSA screener just grabbing my bag and walking away, without saying anything at all to me. One of those times, I called out to the guy and told him he was NOT allowed to leave with my bag. He ignored me, so I went after him, and another agent grabbed me (a bit roughly, I might add.) You do have the right to be treated with respect. Don't let anyone tell you otherwise.