They're often interchangeable and the difference is slight, but I personally understand them as follows:
"Setuju" is more passive. For example, if two friends are going out to lunch and one person suggests a place and the other one accepts the suggestion, you can say that he setuju/agrees with the suggestion. Or, where websites or software gives you a EULA, you can setuju/agree to the terms.
For "sepakat", the speaker has an opinion that happens to be the same as the other person. For example, one person says that we should try to protect the environment and should act today, the other person can say that he agrees/sepakat because he believes the same thing.