Agents are typically paid by the carrier. One advantage of using them over dealing directly with the local telephone company is that agents can select from a wide variety of services, some of which may not be offered by the local carrier, or are offered only by their competitors. You're stuck dealing with the agent. This is a company that specializes in running long-haul fiber links from city to city, and offers long distance service as well as connectivity to businesses. Examples are Wiltel or US Long Distance.
Carriers own the lines and can sell space on the lines to other, smaller alternative local telcos.
They can also act as agents for these companies. These companies also specialize in inter-country agreements with other phone companies in other countries. They generally don't provide local service, but often specialize in selling long distance service to residential customers. This is an individual or company, not affiliated with a local telco, who installs phone systems. They may sell systems themselves or install others that businesses may purchase themselves.