How is the gate agent searching your checked luggage, which has been checked in long before you get to the gate? If you mean the check-in agent, they don't normally get to search your luggage either. Something is strange about this story.
At best they could ask "Are you carrying any food?" although I have not even experienced that. If so, "food" is shorthand for non-permitted items, and the answer should have been that no, you are not carrying any "food". They are not qualified or authorized to enforce US Customs rules.