NPCs are discernible by their comms chatter when you scan them with the K-Warrant scanner [Nav Beacons], pull them out of supercruise [FSD Interdictor] and Pirates
scan you [Nav Beacons].
Pirates: "Let's see what you're carrying then!" - "Ugh, nothing useful."
Traders [Pulled out of SC or when scanned using K-Warrant]. Some/most will run away when scanned, since it's a hostile action: "Please God no! I only have my passengers!" or "I have no interesting cargo!" Something like that.
Bounty Hunters: "I have enough trouble with the police without you getting in my way!"
That is pretty much all paraphrased, but you get the idea

I hope this helps!