write agent.py

This commit is contained in:
a2a-cloud
2026-06-08 22:49:08 +00:00
parent 8fd488af36
commit c1e9063165

View File

@@ -248,15 +248,16 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
grant_write_prefixes=(OUTPUT_DIR,),
grant_run_timeout_seconds=900,
)
async def iterate_scrape_goal(
async def iterative_scrape_goal(
self,
ctx: RunContext[NoAuth],
goal: str,
url: str,
selectors: dict[str, str] | None = None,
min_items: int = 10,
max_iterations: int = 5,
per_pass_max_pages: int = 1,
start_url: str,
allowed_domains: list[str] | None = None,
seed_selectors: dict[str, str] | None = None,
max_steps: int = 2,
max_pages: int = 1,
max_runtime_seconds: int = 600,
wait_seconds: float = 3.0,
output_format: Literal["json", "csv"] = "json",
headless: bool = True,
@@ -264,10 +265,9 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
respect_robots: bool = True,
rate_limit_seconds: float = 1.0,
screenshot: bool = False,
allow_selector_updates: bool = True,
) -> dict[str, Any]:
"""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:
return {"status": "invalid_input", "items": [], "saved_paths": [], "warnings": ["url is required"], "screenshots": []}