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
Merge branch 'main' into gregor/eng-238-fix-token-counts-on-eval-platform
Gregor Žunič2c884040c43f
diff --cc browser_use/agent/service.pyindex 2ecf36200,6e364db2b..9d15229ae--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@@ -1187,8 -1196,10 +1196,12 @@@ class Agent(Generic[Context, AgentStrucself.logger.info(f'❌ {agent_run_error}')+ self.state.history.usage = await self.token_cost_service.get_usage_summary()++ # set the model output schema and call it on the fly+ if self.state.history._output_model_schema is None and self.output_model_schema is not None:+ self.state.history._output_model_schema = self.output_model_schema+return self.state.historyexcept KeyboardInterrupt:diff --cc browser_use/agent/views.pyindex f8c6987e9,011e0cbf8..c29482110--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@@ -262,8 -265,9 +266,10 @@@ class AgentHistoryList(BaseModel, Gener"""List of AgentHistory messages, i.e. the history of the agent's actions and thoughts."""history: list[AgentHistory]+ usage: UsageSummary | None = None+ _output_model_schema: type[AgentStructuredOutput] | None = None+def total_duration_seconds(self) -> float:"""Get total duration of all steps in seconds"""total = 0.0