A human defines the checks (the mold) that give the agent the limits. They can be TLA+ definitions, linters, cyclomatic complexity checkers, unit tests, integration tests, end to end tests etc. And usually some written docs - made in a way that's specifically targeted at agents. Those define the limits the agent has to stay inside of.
There will always be work for human QA too, an AI can't determine if something feels off in an app's flow, it has no taste or concept of usability beyond the purely mechanical rules.
[0] Not talking about health, aerospace or nuclear stuff here naturally.