Private investigator

person (other than a police officer) hired to undertake investigatory law services

A private investigator (often shortened to PI and informally called a private eye), a private detective, or inquiry agent is a person who can be hired by people or groups to investigate legal matters. They often work for lawyers in civil and criminal cases.

Private detectives can perform surveillance work for people
Sherlock Holmes, the world's most famous fictional private investigator