Trawl

AI Features

Auto-fix repairs a scrap when the site changes, and AI Digest emails you a short summary of each run.

Auto-fix with AI

When a run fails (error or 0 items), or returns far fewer items than usual, Auto-fix sends the script and the error to the AI. The AI rewrites the script for the new page, Trawl saves it and runs the scrap again.

Turn it on in Settings → Auto-fix → Auto-fix with AI. With Alert on failure also on, you get one email once the fix ends: recovered or needs review (Alerts with Auto-fix).

It helps when a site changed its HTML, its navigation (a new cookie banner, a redirect) or how fast it loads, or when results dropped to a small part of the usual count.

Safety guardrails

Guardrail Value
Attempts per hour 6 at most
Failed attempts in a row After 3, automatic (scheduled) fix attempts stop for that scrap
Coming back The first fix that works clears the stop, and failed attempts older than 30 days no longer count
Short run Under 20 % of the usual item count, once the scrap has at least 3 recent successful runs with 5 items or more. It triggers Auto-fix, or a notification when Auto-fix is off

The stop never changes your Auto-fix setting. You see a notice in the scrap workspace while it lasts. Fix this still runs one attempt; if it works, automatic fixes start again. If you turned Auto-fix off yourself, Fix this is refused during the stop: turn Auto-fix back on to get that attempt.

What Auto-fix does not fix

Auto-fix rewrites the request script (selectors, waits, navigation), so it only helps when the page markup changed. It does not run when:

  • The site blocked the request, or the page could not be reached. Nothing in your script is wrong, and you get the ordinary failure email at once. If it keeps happening, the scrap gets paused for failing: the site refuses you, and that calls for another approach.
  • The run landed on a login page. When a run is redirected to a known login route (such as /accounts/login or /signin), Trawl says it is a login wall instead of "0 results". Attach your own session: trawl scraps account session capture <id> opens Chrome so you log in, trawl scraps account session set <id> -c cookies.json works in scripts and CI, or use Settings → Account (Account & sessions). A login form shown at the URL you asked for, with a normal 200, still reads as an empty run.

Fix one run by hand

After a failed run, click Fix in the workspace toolbar for a one-shot AI fix. It does not count against the hourly limit.

AI Digest

AI Digest emails an AI summary of each run. Turn it on in Settings → Notifications → AI Digest, write a prompt (what to focus on, 2,000 characters at most), pick a mode, and set a recipient if it is not the email results recipient.

It runs after every kind of run: scheduled, manual or API. It is skipped on an Auto-fix re-run, an empty or short run, a missing prompt, and in Only when changed mode when nothing changed.

Good prompts are specific:

  • "Highlight any price drops greater than 10%."
  • "Summarize the top 5 headlines. Flag anything about AI regulation."
  • "Alert me on any SKU below 50 units."

Test Digest previews the digest on the last successful run, with the current prompt and mode. It is charged like one digest when it calls the AI, and it sends no email and adds no run.

Pick a digest mode

Mode API value What you get
Latest data (default) latest A summary of this run's data
What changed changes New entries, entries gone, and values that changed (before → after) since the last successful run. "No change since the last run" when nothing changed
Only when changed changes_only Same as What changed, but no digest when nothing changed. The results email still goes out

In the two change modes, Trawl counts the changes itself, exactly, and the AI only writes them up. Rows are matched on id, _id, url or link; fields that only record when the row was scraped (scrapedAt, fetched_at, timestamp…) never count as a change. With no earlier run to compare to, the digest reads the latest data.

Change the digest settings

PUT /api/scraps/:id changes the digest settings of a scrap. It takes your web session, not an API key. Send only the keys you change, inside digest; the others keep their value.

Optional keys of digest: enabled (true or false), mode (a value from the table above), prompt (your text), recipient (an email address). <SCRAP_ID> is the id of the scrap in GET /api/scraps.

The answer: the whole scrap, here cut to its digest. Each run's own digest is on the run (Results & payload).


See also: Schedule · Notifications · Scraping · Account & sessions

Next step → Data quality

curl -X PUT https://api.trawl.me/api/scraps/<SCRAP_ID> \
  -H "Cookie: TOKEN=<YOUR_SESSION_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{ "digest": { "mode": "changes" } }'
Response
{
  "type": "success",
  "message": "scrap updated",
  "data": {
    "id": "507f1f77bcf86cd799439011",
    "digest": { "enabled": true, "mode": "changes", "prompt": "Summarize the new posts", "recipient": "me@example.com" }
  }
}