Skip to content

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

Fix action names if no action is there

magmueller9700824546a4
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.py
index 003610d53..fcf50e31d 100644
--- a/browser_use/agent/views.py
+++ b/browser_use/agent/views.py
@@ -199,7 +199,12 @@ class AgentHistoryList(BaseModel):
def action_names(self) -> list[str]:
"""Get all action names from history"""
- return [list(action.keys())[0] for action in self.model_actions()]
+ action_names = []
+ for action in self.model_actions():
+ actions = list(action.keys())
+ if actions:
+ action_names.append(actions[0])
+ return action_names
def model_thoughts(self) -> list[AgentBrain]:
"""Get all thoughts from history"""