Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
add memory to some ActionResult objects
mertunsall8c0ac3782d47
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 90380f509..9da67880f 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1524,7 +1524,7 @@ class Agent(Generic[Context]):if orig_target_hash != new_target_hash:msg = f'Element index changed after action {i} / {len(actions)}, because page changed.'logger.info(msg)- results.append(ActionResult(extracted_content=msg, include_in_memory=True))+ results.append(ActionResult(extracted_content=msg, include_in_memory=True, memory=msg))breaknew_path_hashes = {e.hash.branch_path_hash for e in new_selector_map.values()}@@ -1532,7 +1532,7 @@ class Agent(Generic[Context]):# next action requires index but there are new elements on the pagemsg = f'Something new appeared after action {i} / {len(actions)}'logger.info(msg)- results.append(ActionResult(extracted_content=msg, include_in_memory=True))+ results.append(ActionResult(extracted_content=msg, include_in_memory=True, memory=msg))breaktry:@@ -1611,7 +1611,7 @@ class Agent(Generic[Context]):if not is_valid:logger.info(f'❌ Validator decision: {parsed.reason}')msg = f'The output is not yet correct. {parsed.reason}.'- self.state.last_result = [ActionResult(extracted_content=msg, include_in_memory=True)]+ self.state.last_result = [ActionResult(extracted_content=msg, include_in_memory=True, memory=msg)]else:logger.info(f'✅ Validator decision: {parsed.reason}')return is_valid