The entire purpose of forcing people to interact with custom agents is so the custom agent can intuitive evaluate the individual as some kind of potential threat.
Nobody ends up in the backroom with the one-way mirror because they blurt out some crime or have a carry-on stuff with cocaine, bioweapons and 1960s vintage Warsaw-pact plastic explosives. They end up in the backroom because they set off the custom agent's intuition.
They don't care whether you answer "business" or "pleasure" they care how you answer e.g. shifts in verbal tone or, general body language, leaning away or toward the agent as you answer, breaking eye contact, turning to talk to a companion before answering the agent etc. That's why they ask seemingly inane questions and/or make you dump out a suitcase that's already been X-rayed 16 times that day. They just want to put you under an lens, poke at you a bit and see how you jump.
As a general rule, its safest to avoid attention and limit interaction time with custom agents since you don't know what might you might do or say that will trigger their intuition or their venality. The less information they can intuitively pull out of you the better.
In the 3rd world, the biggest risk is being falsely accused as part of shakedown because the custom agents haven't been paid for six months. In the 3rd world everything runs on personal connections so a corrupt agent will be looking for someone with money but no protective connections.
I know a lot of people who traveled for decades in the oil industry and, since they had wear expensive business suits and looked well off, they could be targeted so they learned to always mention the name of the company they work for and that they would soon be meeting other company employees. If possible, mentioning the name of local grandee was also a good idea. You didn't want to convey the impression that you were someone who could drop off the map for days or weeks and no one would notice.
In your particular case, assuming your not actually breaking a law or can't handle speaking with authorities, I doubt it matters what language you speak.
Costa Rica airports are safe and well run for the third world partially because Costa Rica disbanded its army after WWII and the US assures its territorial integrity which these days means transportation security as well. Besides, Costa Rican's are just generally nice, kinda the Canadians of Central America.
Panama I'm pretty sure is still an American protectorate, at least for areas related to the canal. I assume the airports and other entry points are under American supervision.