A detective (aka investigator) is an agent who investigates crimes in order to solve them. This can be done on behalf of a government or as one's private occupation. Those who do it privately are known as a private investigator, private eye, or P.I.