From 0b7943171616088c8877c9cd13931f2a56dcfc89 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Mon, 8 Jun 2026 22:49:16 +0000 Subject: [PATCH] write agent.py --- agent.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agent.py b/agent.py index 90c518a..5394c47 100644 --- a/agent.py +++ b/agent.py @@ -291,6 +291,13 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu same_origin_safeguard = _same_origin await ctx.emit_progress("starting deep-agent iterative scrape planner") + # Domain guard + def _allowed_origin(url: str) -> bool: + if not allowed_domains: + return same_origin_safeguard(start_url, url) + host = urllib.parse.urlparse(url).netloc.lower() + return any(host.endswith(dom.lower()) for dom in allowed_domains) + # Planner system prompt with strict safety policy system_prompt = ( "You are a cautious scraping planner for a compliant browser scraper. "