From 6c3d10fd2dc47abd576945c11473b95d80c28f15 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Mon, 8 Jun 2026 23:05:58 +0000 Subject: [PATCH] write agent.py --- agent.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agent.py b/agent.py index dc6cf26..6a6229f 100644 --- a/agent.py +++ b/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})