Mattel Inc. agreed yesterday to acquire the privately held Pleasant Company, the maker of the American Girl line of dolls, for $700 million. Pleasant, based in Middleton, Wis., also produces books, clothing, accessories and activity products. It has annual revenue of $300 million. Mattel, based in El Segundo, Calif., makes the Barbie and Fisher-Price toy lines. It had $4.83 billion in sales in 1997. Mattel also said yesterday that it expected its earnings for the second quarter to fall short of expectations, citing a change in the buying practices of Toys ''R'' Us Inc.