An air pump regulates airflow by using a combination of valves and a motorized mechanism to control the amount of air being pumped into a system. The valves open and close to allow air to enter or exit, while the motor adjusts the speed and pressure of the pump to regulate the flow of air.