Browser agent blocked (CAPTCHA / 403)
AI agents are increasingly using a browser themselves (Playwright, Browser Use, Skyvern, Computer Use). All that’s needed is a “blocked” detector and a push.
async def page_health(page): title = await page.title() body = await page.evaluate("document.body.innerText") if any(k in body.lower() for k in ("captcha", "are you human", "cloudflare", "access denied", "blocked")): push("🚫 Browser-agent заблокирован", f"URL: {page.url}\nTitle: {title}\nFragment:\n{body[:500]}", priority=9) return False if any(k in title.lower() for k in ("403", "404", "rate")): push("🚫 HTTP-блок", f"URL: {page.url}\nTitle: {title}", 8) return False return True
def push(t, m, p): import os, requests requests.post(f"{os.environ['NOTIFLY_URL']}/message", params={"token": os.environ["NOTIFLY_TOKEN"]}, json={"title": t, "message": m, "priority": p}, timeout=5)A couple of useful additions:
- save the screenshot to S3 and put the link in extras;
- count how many times you get caught in an hour — if 5+, stop everything (see agent-stuck).