The problem
Mogean publishes a monthly dataset of US business locations. A large share of it comes from brands’ own store locators, and store locators break constantly. A site redesign, a new bot filter or a changed API can silently take a brand from 2,000 locations to 40.
With thousands of brands, some sources fail every week. Fixing each by hand does not scale, and a broken source that nobody notices is worse than one that fails loudly.
What I built
A repair loop with five steps: sweep for brands that look wrong, probe the source, suggest a fix, apply it, validate the result against a reference count.
Rules handle the common cases. Two AI agents handle the rest. One investigates individual failing brands. The other audits the largest brands every week, looking for problems the rules missed.
The design question was how much an agent may do on its own. The answer is three levels, and the code enforces them:
- Level A. The agent may apply a configuration change itself, but only after a clean test run against the live source.
- Level B. The agent opens a pull request. A person reviews it. It is never merged automatically.
- Level C. The agent stops and escalates to a person with a written diagnosis.
Around that sit limits the agents cannot move. Each run has a spending cap, and any setting that increases spend can only be changed by a person. An agent may dispute a reference count it thinks is wrong, but it cannot approve its own dispute.
The lesson that changed the design
A job’s exit status says the process finished. It does not say the work was done. A collection run can end cleanly having gathered a fraction of what the source holds.
So the definition of done changed. Success is measured against expected coverage, checked independently, before a run can be marked complete. Anything short of that appears in an admin screen as a worklist a person can act on, with the agent’s diagnosis attached.
Why it matters beyond data
Any company putting agents into operations faces the same question. The useful answer is not “trust the agent” or “never trust the agent”. It is a written, enforced list of what the agent may do alone, what it must propose, and what it must hand over.