Thanks for requesting me.
Undercover stings are perfectly legal and they do not, if carried out correctly, constitute entrapment. Entrapment occurs when the police manipulate you into doing something that you wouldn't do except for the police actions.
So, for example, let's say you place an ad on Craigslist that you are looking for a woman 18 years or over for sex and an undercover officer calls you and sex that she's 18, that's NOT entrapment, because that's what you were looking for in the first place. On the other hand, if she tells you -- and she's an undercover officer -- that she's busy but her 14 year old sister can meet you, then you have a possible case for entrapment if you keep the date, assuming you don't say something like, "That's great. I think 14 year olds are hot too."
So like so much else in law, it all depends on the facts and circumstances. Some entrapment defenses succeed. Others don't.
Are you asking a hypothetical question or have you been charged with a sex crime involving a minor? What's the situation you're concerned about.