The FBI would be the one to investigates internal affairs, the NSA and CIA are supposed to be tasked for foreign investigations. The FBI at one point did an outstanding job of discovering corruption in our politicians at one point but they did such a good job congress made sure to neuter them so they could never do it again. It was called Operation Abscam if you want to look it up.
I suppose it depends on what or whom is being investigated, but I imagine or at least hope they would cooperate and the FBI would investigate the individual and the NSA/CIA the foreign entity.