Skip to content

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

Update browser_use/agent/cloud_events.py

Nick Sweetingb3ed9cbbbabf
diff --git a/browser_use/agent/cloud_events.py b/browser_use/agent/cloud_events.py
index 718aab433..3d751b226 100644
--- a/browser_use/agent/cloud_events.py
+++ b/browser_use/agent/cloud_events.py
@@ -42,7 +42,7 @@ class UpdateAgentTaskEvent(BaseEvent):
stopped=agent.state.stopped if hasattr(agent.state, 'stopped') else False,
paused=agent.state.paused if hasattr(agent.state, 'paused') else False,
done_output=done_output,
- finished_at=datetime.utcnow() if agent.state.history.is_done() else None,
+ finished_at=datetime.utcnow() if agent.state.history and agent.state.history.is_done() else None,
agent_state=agent.state.model_dump() if hasattr(agent.state, 'model_dump') else {},
# user_feedback_type and user_comment would be set by the API/frontend
# gif_url would be set after GIF generation if needed