write agent.py
This commit is contained in:
7
agent.py
7
agent.py
@@ -291,6 +291,13 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
|
|||||||
same_origin_safeguard = _same_origin
|
same_origin_safeguard = _same_origin
|
||||||
await ctx.emit_progress("starting deep-agent iterative scrape planner")
|
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
|
# Planner system prompt with strict safety policy
|
||||||
system_prompt = (
|
system_prompt = (
|
||||||
"You are a cautious scraping planner for a compliant browser scraper. "
|
"You are a cautious scraping planner for a compliant browser scraper. "
|
||||||
|
|||||||
Reference in New Issue
Block a user