How to heal a broken path
When paths break
Section titled “When paths break”Websites change. Endpoints move. Forms get redesigned. When a worker call fails, the path is marked as broken.
The heal tool fixes it automatically.
Trigger a heal
Section titled “Trigger a heal”curl -X POST https://your-unsurf-url.workers.dev/tools/heal \ -H "Content-Type: application/json" \ -d '{ "pathId": "your-broken-path-id", "error": "POST /api/contact returned 404" }'The error field is optional but helps the heal process understand what changed.
What heal does
Section titled “What heal does”- Retry — attempts the original path with exponential backoff (3 attempts)
- Re-scout — if retries fail, runs a fresh scout on the same site with the same task
- Diff — compares old endpoints with new ones to identify what changed
- Update — saves the new path and marks it as
active - Verify — executes the updated path to confirm it works
Automatic healing
Section titled “Automatic healing”When the worker tool encounters a transient error (network timeout, 502, etc.), it retries automatically with exponential backoff before failing.
For permanent errors (404, schema mismatch), the worker returns a PathBrokenError. Your agent can then call heal explicitly.
Monitoring path health
Section titled “Monitoring path health”Query a path’s status:
curl https://your-unsurf-url.workers.dev/sites/{siteId}/pathsEach path includes:
status—active,broken, orhealingfailCount— consecutive failureshealCount— how many times this path has been healedlastUsedAt— when the worker last executed this path