You should understand from the beginning of your relationship with your real estate agent what type of relationship exists. In most states, real estate agents (both brokers and sales associates alike) are required by law to let consumers know whether they represent the buyer or the seller.
In the past, real estate agents represented the seller exclusively, whether the agent helped a seller to market and sell the home or helped a buyer find and purchase the home. In other words, agents were at one time legally bound to represent the seller in a residential real estate transaction. In that same scenario, the seller paid both the listing agent and the agent who brought the buyer.
However, in today's real estate market, you may find that you can choose between a wide variety of options for representation. If you want to sell a home, you can work with a "seller's agent". If you are purchasing a home, you can work with a subagent of the seller's agent and, in many areas, you can engage an exclusive "buyer's agent".
An additional situation in some states is dual agency. This type of agency exists when the buyer decides to have the seller's agent prepare the offer on the buyer's behalf. A buyer who elects this situation, and all additional parties to a transaction, should receive full disclosure of representation. In some states, dual agency also affects the real estate professional's fiduciary responsibilities to the seller.
Keep in mind that real estate laws differ from state to state and even from locale to locale. And within this framework of variety, laws can change. For more in-depth answers for your specific situation, talk with a knowledgeable real estate professional and ask about local practices. Be sure that you understand and are comfortable with the options involved when you engage the services of a real estate agent.