Consider the the popular mid-00s "To Catch a Predator" segments on Dateline NBC, which allowed Chris Hansen to interview men caught in pedophile stings to provide better understanding of the mindset behind the people. Most entries into the series will have a very early on walk through of the basic sting operation: A citizen group would set up fake profiles of underage children (normally in their early or pre-teens) and would go into local area chat rooms... normally just to talk in public space or just lurk, they would be contacted privately by the suspect in the chat room, and would keep logs as the discussion turned lewd... at some point, the suspect and the decoy would arrange a face to face meeting (and the decoy would often ask for certain distinct gifts such as brand name alcoholic drinks or in some cases when the suspect would offer, that the suspect enter the decoy house naked).
It's important to note that, prior to even showing up, the lewd conversation with a minor over the internet was a criminal offense... showing up just shows that the criminal was intending to commit a more serious crime and the specified gift requests were further identifying the person didn't happen to be a case of wrong place wrong time. But it's always fun to seen them leave and get tackled and arrested on camera.
This is a sting and not entrapment and what makes it a sting is that the decoy actors never once initiated contact with the suspect. In every case, the suspect first reached out to the decoy child and made their intentions known. In many longs, the suspect would admit it that they know what they are doing is even illegal but they didn't care... and at least one even references the show to the decoy, which the decoy actor was amused by.
Entrapment would have happened if the decoy actor initiated the conversation with a "suspect" and continued on the conversation's topics until the suspect broke the law at which point they were now arrestable. By seeding the idea in the criminal's mind, the police are now actively encouraging the lawlessness, rather than the other way around... The guilty mind existed prior to any knowledge of the suspect by the cop and the crime only occured because the cop told the suspect to commit the crime.
Once the intent to offend is established by undercover police, however, they can remain "in character" in so far as they can appear only to facilitate the crime, not influence it (i.e. they can provide "explosives" or bomb making skills to an unsuspecting terrorist in so long as they aren't helping pick the target or encouraging a bomb attack. Or they can make purchases from a drug dealer so long as they aren't selling the drugs for them.). The reason behind this is that the criminal is already committed to the illegal action (bombing something, selling illegal drugs) and that in the event the cops cannot arrest by the time the suspect completes the goal, they at least are preventing the bad thing happening by removing the threat (the bomb won't work... had they not facilitated help, the terrorist would find a legit bomb maker and that's a big problem. SImilarly, had the dealer not sold, that substance would just be sold to someone else. And in the example from the Sting, had the offender not talked to the decoy, they would have found a real child... in fact, there were a few examples where Dateline had repeat offenders, the first being an early segment (at the time they were handing over the evidence after the shooting of the segment wrapped) where the suspect was let go and went back into the same chat room and hit on a second decoy. A later example would have a suspect show up who turned out to have been awaiting trial for appearing on a Dateline sting prior to the current appearance.).