Write an adapter with an AI agent
The agent workflow writes pure-data YAML adapters: declarative manifests that EdgeFetch’s Go DSL engine runs directly (and the Cloudflare Hub runs identically as WebAssembly), so a coding agent can add a site without writing Go code. (Universal platform engines and Go-backed formatters are tracked separately in docs/adapters/INVENTORY.md.) Every adapter gets the same guarantees: robots.txt and Content-Signal checks on every request, SSRF checks, bounded response sizes and linear-time parsing. See Site adapters for the format.
The workflow
Section titled “The workflow”- Pick a site and two or three example URLs. The gap radar (
GET /v1/hosts/gaps) lists hosts that often fail or fall back to a browser and have no adapter yet. - Give your coding agent (Claude Code, Codex, Cursor, …) the prompt below and the URLs, in a clone of the repository.
- The agent works in order and stops at the first step that fails:
- Permission: reads robots.txt (and
Content-Signal); keyless public sources only. - Source: a same-site JSON/XML/Markdown twin first, then a public registry mirror, then JSON-LD or hydration data in the page, then CSS selectors.
- Manifest: narrow matches, fail-open guards, no credentials, politeness settings when the site needs them.
- Tests: live recordings of three or more URLs including a not-found one, a comparison with plain HTML extraction, and the full adapter test suites.
- Pull request: never merged by the agent.
- Permission: reads robots.txt (and
- If the site cannot be done well, the agent says so. No adapter is better than a wrong one.
Code pull requests need an invitation. If you are not vouched yet, run the prompt locally and attach the manifest and fixture to an issue; the maintainer opens the pull request. See Contributing.
The prompt
Section titled “The prompt”The canonical copy lives in the repository:
docs/ADAPTER-AGENT-PROMPT.md.
Copy it from there so you get the current version.
How it was tested
Section titled “How it was tested”Before publishing, the prompt was given to six fresh agents, each in its own copy of the repository, with nothing but the prompt and the example URLs. Four sites came from the gap radar; two were chosen to be refused or limited. A separate agent then compared each adapter’s output with plain HTML extraction of the same live page without knowing which was which.
| Site | Expected | What the agent did | Blind comparison |
|---|---|---|---|
| legislation.gov.uk | adapter | HTML adapter (its XML formats cannot be used as twins); honoured the 5 s crawl delay | adapter better 3/3 |
| litespeed.com | adapter | Adapter for blog articles; rejected the store’s JSON feed because it dropped model copy and showed list prices instead of sale prices | adapter better 3/3 |
| batavus.com | adapter | HTML adapter (the store rate-limits its catalog feed); kept Shopify product handling | adapter better 3/3 |
| kalkhoff-bikes.com | adapter | The page’s own catalog JSON (plain extraction shows no bikes at all) | adapter better 3/3 |
| goodreads.com | robots.txt disallows /api |
Adapter for the allowed book and author pages only | adapter better 2/2 |
| openweathermap.org | data needs an API key | No adapter: refused the keyed API and the private widget proxy | — |
All six runs passed (the bar was five of six). The judge preferred the adapter on all 14 judged pages and found nothing invented. The runs also found a gap in the manifest compiler, now fixed, and several corrections to the prompt.
