The primary purpose of an embassy is to assist American citizens who travel to or live in the host country. U.S. Foreign Service Officers also interview citizens of the host country who wish to travel to the United States for business, education, or tourism purposes.
Consulates provide passport, birth registration and many others services for visiting or resident American citizens in a country. They also have consular sections which issue visas for foreign citizens to visit, study and work in the United States.