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
fix(agent): guard last_action() against empty action list
itxaiohangloverd41448e485ca
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.pyindex dbec9a534..4dde414b3 100644--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@ -701,7 +701,9 @@ class AgentHistoryList(BaseModel, Generic[AgentStructuredOutput]):def last_action(self) -> None | dict:"""Last action in history"""if self.history and self.history[-1].model_output:- return self.history[-1].model_output.action[-1].model_dump(exclude_none=True, mode='json')+ actions = self.history[-1].model_output.action+ if actions:+ return actions[-1].model_dump(exclude_none=True, mode='json')return Nonedef errors(self) -> list[str | None]: