You asked,
In short, is the agency friend or foe?
Neither - they're more like lawful neutral.
They will generally follow whatever path has the best outcome for them. Sometimes, in a perfect world, that path also has a good outcome for the employer and the candidate. But in other situations, the three parties' objectives may not perfectly align, and some recruiters will take advantage of those situations in whatever way benefits them.
Of course, some (good) recruiters realize that their reputation is at stake, and they may be willing to have an okay outcome from one deal (instead of a great outcome if they had been more selfish) if it means it helps them build a better reputation with clients or candidates. Ultimately, recruiters are just connection-makers. They have no tangible work product. They depend on working with other parties to have an income.
With that in mind, you need to be the one who looks out for your own best interests. Follow standard negotiating technique, and don't allow anyone to pressure you into something that you don't like. When you're interviewing, make sure you take the time to evaluate the employer yourself, instead of just taking the recruiter's word about how they just know deep in their heart that this employer is an awesome once in a lifetime opportunity that's just perfect for you in every way. This cannot be over-emphasized - take the time to prepare your own questions for your potential employer, based on the things that are important to you, and make sure you ask the employer those questions during the interview.
Further, if you're being courted by several recruiters, or a recruiter contacts you out of the blue, you can ask the recruiter some questions to get an idea for how reliable they are:
- How long have you been working with this employer?
- How many candidates have you placed with this employer?
- How flexible is this employer on salary? What is their negotiating process like?
- Do you know anything about my competition for this position?
- Can you describe why you think this opportunity would be a good fit for me?
Other than the first two questions, the actual content of the recruiter's answers are somewhat unimportant - again, you should make up your own mind about how good of a fit the company is, and you should be your own advocate when negotiating. But, you can judge the recruiter's relationship with the employer based on how they answer - if they give you a generic answer with a lot of buzzwords, they might not have a good relationship with the employer and might be making things up on the spot. But if they can go into specific detail they might be able to show that they actually know the employer well (which is a good thing, of course).
In short, a recruiter might be friend or foe depending on the circumstances, and their own personal business approach. But, you can put some effort in and do a little research to help you frame up how the relationship will work (or not) for you as a candidate, rather than just blindly proceeding.