For humans going to school is mandatory. And typically humans have to take lots of exams before they can work in various fields.
So, let's make that mandatory for AI too. Let government agencies design the exams. Of course, the creator of the AI has to pay for this.
And of course, the tests should be carefully designed and should also include a psychological test as we don't want to unleash psychopathic AI onto the masses. Also keep in mind that an AI that spreads false information can be harmful to society.