In an effort to stem a tide of safety crises, 18 automakers reached a voluntary agreement with federal regulators on principles designed to improve safety.