Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix load_from_dict and final_result crashing on incomplete history entries

Laith Weinberger39b911398e9d
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.py
index 142e0eb93..a7209378f 100644
--- a/browser_use/agent/views.py
+++ b/browser_use/agent/views.py
@@ -698,7 +698,7 @@ class AgentHistoryList(BaseModel, Generic[AgentStructuredOutput]):
h['model_output'] = output_model.model_validate(model_output)
else:
h['model_output'] = None
- state = h.get('state', {})
+ state = h.get('state') or {}
if 'interacted_element' not in state:
state['interacted_element'] = None
h['state'] = state