The Food and Drug Administration on Friday proposed two sweeping rules aimed at preventing the contamination of produce and processed foods, which has sickened tens of thousands of Americans annually in recent years.

The proposed rules represent a sea change in the way the agency polices food, a process that currently involves taking action after contamination has been identified. It is a long-awaited step toward codifying the food safety law that Congress passed two years ago.

Changes include requirements for better record keeping, contingency plans for handling outbreaks and measures that would prevent the spread of contaminants in the first place. While food producers would have latitude in determining how to execute the rules, farmers would have to ensure that water used in irrigation met certain standards and food processors would need to find ways to keep fresh food that may contain bacteria from coming into contact with food that has been cooked.

New safety measures might include requiring that farm workers wash their hands, installing portable toilets in fields and ensuring that foods are cooked at temperatures high enough to kill bacteria.