write agent.py
This commit is contained in:
16
agent.py
16
agent.py
@@ -248,15 +248,16 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
|
|||||||
grant_write_prefixes=(OUTPUT_DIR,),
|
grant_write_prefixes=(OUTPUT_DIR,),
|
||||||
grant_run_timeout_seconds=900,
|
grant_run_timeout_seconds=900,
|
||||||
)
|
)
|
||||||
async def iterate_scrape_goal(
|
async def iterative_scrape_goal(
|
||||||
self,
|
self,
|
||||||
ctx: RunContext[NoAuth],
|
ctx: RunContext[NoAuth],
|
||||||
goal: str,
|
goal: str,
|
||||||
url: str,
|
start_url: str,
|
||||||
selectors: dict[str, str] | None = None,
|
allowed_domains: list[str] | None = None,
|
||||||
min_items: int = 10,
|
seed_selectors: dict[str, str] | None = None,
|
||||||
max_iterations: int = 5,
|
max_steps: int = 2,
|
||||||
per_pass_max_pages: int = 1,
|
max_pages: int = 1,
|
||||||
|
max_runtime_seconds: int = 600,
|
||||||
wait_seconds: float = 3.0,
|
wait_seconds: float = 3.0,
|
||||||
output_format: Literal["json", "csv"] = "json",
|
output_format: Literal["json", "csv"] = "json",
|
||||||
headless: bool = True,
|
headless: bool = True,
|
||||||
@@ -264,10 +265,9 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
|
|||||||
respect_robots: bool = True,
|
respect_robots: bool = True,
|
||||||
rate_limit_seconds: float = 1.0,
|
rate_limit_seconds: float = 1.0,
|
||||||
screenshot: bool = False,
|
screenshot: bool = False,
|
||||||
allow_selector_updates: bool = True,
|
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Use an LLM planner to refine selectors/pagination until the goal is met or a stop condition occurs."""
|
"""Use an LLM planner to refine selectors/pagination until the goal is met or a stop condition occurs."""
|
||||||
start_url = str(url or "").strip()
|
start_url = str(start_url or "").strip()
|
||||||
if not start_url:
|
if not start_url:
|
||||||
return {"status": "invalid_input", "items": [], "saved_paths": [], "warnings": ["url is required"], "screenshots": []}
|
return {"status": "invalid_input", "items": [], "saved_paths": [], "warnings": ["url is required"], "screenshots": []}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user