If you want to buy a charming little house near a business district and turn the front parlor into a candle store, you need to know if the city will allow it. Typically, an experienced real estate agent is familiar enough with local zoning ordinances to make sure you don't buy the wrong house.
By the same token, if you want to build a fence in the backyard or add a bedroom, an agent should be able to make sure you're buying a property where the city allows it. Also, some cities may require expensive upgrades on older properties when they sell. For example, if a house isn't connected to the city's sewer system, and a buyer will be required to spend tens of thousands of dollars to connect the property, the real estate agent will make sure that requirement is disclosed before the deal goes very far.