All real estate agents must adhere to a code of ethics that requires them to protect and promote the best interest of their clients. That doesn’t necessarily mean that they do, however, and like any business, there are bad actors.
The best way to ensure you’re working with a trustworthy real estate agent is to speak to other people who have worked with them, research their transaction history, and speak up if you feel they’re not looking out for you. Generally, a good reputation is the most important tool in a real estate agent’s arsenal, so it’s in an agent’s best interest to be trustworthy and work hard for their clients.