You guys are amusing. Not sure the legality of ag searches, but I know custom searches are legal and there's no way to avoid them, if asked. Found that out in preparation for our first trip into Canada, which we did with the TT.
Our crossing both ways was painless. Cross in MN south of Thunder Bay. Pulled up on a Thursday with rain, one lane open, nobody in line. Canadian customs agent asked for passports, what state lived in, and where we were going and how long, then a rapid fire set of "Do you have guns? Stun guns? Tazers?" and so forth. No no no were the answers. Then "welcome to Canada". Probably there a minute. I was expecting questions on food, there were none.
Coming back Saturday there were just a couple people ahead of us (going into Canada from the US had a LONG line of people with boats, good thing we were leaving and not coming in Saturday!). Pull up, and a customs agent crosses the road in front of us to the passenger side. I believe he was getting ready to do a search of the camper. Customs agent on the driver side takes the passports, asks where we went, if we bought anything. I say some toilet paper and bread. He looks at me for 10-15 seconds then hands the passports back and says welcome back. Guy who had crossed to the passenger side came back over to the box.
US side took longer than the Canadian side. Maybe two minutes instead of a minute. :D In both cases I had removed my sunglasses ahead of time, as had my wife, had my window rolled down, and was holding of our passports already. The Canadian agent asked me to roll down the driver's side rear window on our SUV (which is factory tinted), so on our way back into the US I pre-rolled that window down as well.
I would not refuse a customs search (obviously), and I don't think I would refuse an ag search. I've never had a LEO ask to search my vehicle in a standard traffic stop, but I would refuse that, if they asked. For normal traffic stops I've always been polite, pulled off onto a low traffic side street if I was able, had the window down, hands on steering wheel, and confirmed with them before moving my hands ("my registration and insurance is in the glovebox, can I get that?"). The stops I've had are always quick and I get my ticket or warning and I'm off and away. Haven't been stopped in years though, as I've slowed down since I was 18 (28 now), and gotten better organized (I buy yearly registration stickers via mail when they send the reminder notice 3 months ahead of expiration). I check trailer lights before each trip, and check my car lights on a regular basis. I've actually wanted to get pulled over for a light out just to see the LEO expression when I say "oh I've got a replacement bulb right here, can I change that right now so you don't have to write a warning?" I carry a full set of spare exterior light bulbs (every single exterior light) in my car so I never have a light burned out for long at all. Speaking of which, I actually don't have spare lights for the camper yet. I need to check what size those are and buy a full set of spares.