FreshDirect, which uses 150 diesel-powered trucks to deliver groceries that customers order over the Internet, is outfitting its fleet with shutoff systems that will keep the trucks from idling longer than permitted by city law.

But a FreshDirect senior vice president said the upgrade would not affect the equipment that has led to occasional complaints about the company — a smaller motor that runs refrigeration equipment to keep the food fresh. The new equipment will shut off only the engine that powers the drive train. The two operate separately.

The state attorney general, Andrew M. Cuomo, announced Friday that his office and FreshDirect, based in Long Island City, Queens, had reached an agreement on installing the shutoff equipment after an investigation into consumer complaints that FreshDirect trucks were violating anti-idling laws.

A statement from Mr. Cuomo said the investigation documented at least 30 cases of illegal idling by FreshDirect trucks. Under state law, trucks and buses cannot idle for more than five minutes at a time. New York City limits idling time to three minutes, and in areas near schools, it is no more than 60 seconds.

FreshDirect, which averages 7,000 deliveries a day, has agreed to pay a $50,000 penalty for violating state and city anti-idling laws, the statement said. It said the penalty had been $120,000, but $70,000 had been suspended contingent on the company’s compliance.

Mr. Cuomo said that besides affecting public health and the environment, idling wastes fuel: an average of 30,000 gallons of gasoline and 20,000 gallons of diesel fuel in the city every day.

Jim Moore, FreshDirect’s senior vice president for business affairs, said the company has had experience with engine-control technology. It has the equipment on 20 to 25 trucks, the newest in its fleet. The engine turns off if the vehicle remains in park for more than three minutes.

The company promised that any new trucks would come with the equipment.

Mr. Moore said the company had received complaints about idling since its trucks hit the streets in 2002. He said the company had looked into those complaints and concluded that they stemmed from noise made by the refrigeration engines. Those are not covered by the agreement with Mr. Cuomo.