write agent.py

This commit is contained in:
a2a-cloud
2026-06-08 23:05:58 +00:00
parent 2ebc3b1228
commit 6c3d10fd2d

View File

@@ -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})