write agent.py
This commit is contained in:
12
agent.py
12
agent.py
@@ -353,13 +353,21 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
|
||||
current_url = start_url
|
||||
current_selectors = selectors or {"title": "title"}
|
||||
|
||||
for iteration in range(1, int(max_iterations) + 1):
|
||||
hard_cap_steps = max(1, min(int(max_steps), 3))
|
||||
hard_cap_runtime = max(30, min(int(max_runtime_seconds), 840))
|
||||
started_at = datetime.now(timezone.utc)
|
||||
|
||||
for step in range(1, hard_cap_steps + 1):
|
||||
# Runtime budget check
|
||||
if (datetime.now(timezone.utc) - started_at).total_seconds() > hard_cap_runtime:
|
||||
warnings.append("max_runtime_seconds reached; stopping")
|
||||
break
|
||||
# Execute one browser pass
|
||||
run = await self.scrape_website(
|
||||
ctx=ctx,
|
||||
url=current_url,
|
||||
selectors=current_selectors,
|
||||
max_pages=per_pass_max_pages,
|
||||
max_pages=max_pages,
|
||||
wait_seconds=wait_seconds,
|
||||
output_format=output_format,
|
||||
headless=headless,
|
||||
|
||||
Reference in New Issue
Block a user