write agent.py
This commit is contained in:
8
agent.py
8
agent.py
@@ -393,8 +393,16 @@ class SeleniumbaseWebsiteScraper(A2AAgent[SeleniumbaseWebsiteScraperConfig, NoAu
|
||||
warnings.extend(run.get("warnings") or [])
|
||||
saved_paths.extend(run.get("saved_paths") or [])
|
||||
|
||||
step_logs.append({
|
||||
"plan": plan_note,
|
||||
"action": {"url": current_url, "selectors": current_selectors, "max_pages": max_pages},
|
||||
"observations": {"status": status, "items_this_pass": len(items), "pages": run.get("pages_visited") or []},
|
||||
"safety": {"robots": bool(respect_robots)},
|
||||
"decision": None,
|
||||
})
|
||||
if status in {"challenge_detected", "manual_intervention_required", "blocked", "blocked_by_robots_txt", "browser_runtime_unavailable"}:
|
||||
warnings.append(f"step {step} stopped due to status={status}")
|
||||
step_logs[-1]["decision"] = {"stop": True, "reason": status}
|
||||
break
|
||||
if len(all_items) >= int(min_items):
|
||||
decisions.append({"step": step, "action": "stop", "reason": "min_items reached", "confidence": 1.0})
|
||||
|
||||
Reference in New Issue
Block a user