Making Failure Safe: A Constrained, Verifiable Agent Framework for Open-Web Data Collection
This paper proposes a constrained, verifiable agent framework that replaces unreliable free-form LLM code generation with typed JSON collector configurations and static execution pipelines to achieve deterministic, low-cost, and reusable open-web data collection.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you need to hire a robot to go out and gather specific information from thousands of different websites every day. You could just tell the robot, "Go get the news," and hope it figures out how to do it. But as the paper explains, this "free-for-all" approach is like sending a child into a library with no instructions; they might grab the wrong books, trip over chairs, or come back with a jumbled mess of pages.
This paper proposes a new way to build these data-gathering robots (called "agents") that makes failure safe, predictable, and easy to fix. Here is how it works, broken down into simple concepts:
1. The Problem: The "Wild West" of Web Scraping
Currently, if you ask an AI to write code to scrape a website, it often tries to write a brand-new script from scratch every time.
- The Issue: Websites are messy and change often. If the AI guesses wrong about where a price tag is located on a page, the whole script breaks.
- The Result: You get errors, broken data, or scripts that stop working the moment a website updates its layout. It's like trying to build a house by guessing where the bricks go every single time you lay one.
2. The Solution: The "LEGO Kit" Approach
Instead of letting the AI write free-form code (like writing a novel), the authors force the AI to fill out a structured form (like filling out a LEGO instruction sheet).
The Taxonomy (The 6 Types): The system first asks, "What kind of job is this?" It categorizes tasks into six specific types, like a menu:
- Search: Finding links based on keywords.
- List: Walking through pages of items (like a news archive).
- Detail: Reading the full content of a single page.
- API: Asking a computer directly for data (like ordering from a menu).
- Interactive: Clicking buttons or typing on dynamic pages.
- File: Downloading PDFs or Excel sheets.
- Analogy: Instead of telling a chef to "make dinner," you tell them, "You are making a soup," and they only use the tools and recipes for soup. This stops them from trying to bake a cake when you wanted soup.
The Constraints (The Safety Rails): The AI isn't allowed to invent new code. It must pick from a pre-approved library of "utility functions" (pre-built tools) and fill in the blanks on a template.
- Analogy: Think of it like a "Mad Libs" game where the AI can only fill in the specific blanks provided, rather than writing the whole story itself. This ensures the output is always in a format the computer can understand.
3. The Process: The "Test Drive" Loop
The framework doesn't just send the robot out immediately. It uses a strict "Generate → Check → Fix" loop:
- Generate: The AI creates a configuration file (a JSON plan) based on the user's request.
- Test Drive (Validation): Before running the full job, the system runs a tiny, cheap test on just a few pages.
- The Quality Check (The Referee): A rule-based system (not an AI) checks the results. It asks: "Did we get the right fields? Is the data empty? Did we crash?"
- Crucial Point: If the test fails, the system doesn't just say "try again." It creates a specific "blacklist" of what not to do (e.g., "Do not look for the price in the footer").
- Fix: The AI tries again, but this time it is forced to avoid the mistakes it just made.
- Scale Up: Only when the test drive passes does the system run the full collection job.
4. The Results: Speed vs. Perfection
The authors tested this on 138 different data collection tasks. Here is what they found:
- One-Shot Quality: If you just want to grab data once right now, other methods that let the AI write free code might get slightly better results immediately (about 70% success vs. 50% for this method).
- The Trade-Off: However, the authors' method is much faster and much cheaper to run repeatedly.
- The Magic: Once the plan is made, the actual collection runs without using any AI at all. It just executes the pre-made plan.
- Analogy: Other methods are like hiring a human translator for every single sentence you read. This method is like hiring a translator once to write a dictionary, and then using that dictionary forever.
- Reliability: When the system failed, it didn't fail silently. It produced a clear error report, allowing the "Fix" loop to correct it. In their tests, this feedback loop turned a failing system (0% pass rate) into a perfect one (100% pass rate).
Summary
This paper argues that we shouldn't try to make AI "perfect" at guessing how to scrape the web. Instead, we should constrain the AI to follow strict rules, use pre-built tools, and run a "test drive" before doing the real work.
By trading a little bit of initial perfection for a system that is verifiable, reusable, and cheap to run, this framework makes automated data collection reliable enough for real-world, scheduled use (like gathering news or government data every morning) without needing a human to fix the code every time a website changes.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.