Commit Graph

1506 Commits

Author SHA1 Message Date
laithrw 8fcbe9f2fa Merge branch 'main' into fix/step-timeout-counter-and-stale-history 2026-03-25 19:22:19 -04:00
laithrw 4f268e4390 Merge branch 'main' into override-price-config 2026-03-25 18:20:20 -04:00
laithrw 4f33289c48 Merge branch 'main' into clawoss/fix/signal-handler-opt-out-4385 2026-03-25 16:19:49 -04:00
matt-greathouse 1c5020050c feat(tokens): allow overriding model pricing URL 2026-03-23 07:52:48 -04:00
warren618 c0a11dc61e fix: move state clear to after _prepare_context per review feedback
_prepare_context passes last_model_output/last_result to the message
manager for the "previous action result" prompt section. Clearing
them before context preparation drops this context.

Move the clear to after _prepare_context but before _get_next_action,
so prompt assembly still sees the previous step's output while
preventing stale data on timeout during the LLM call or action phase.
2026-03-23 11:42:11 +08:00
warren618 909e80a1b3 fix(agent): prevent stale history and stuck step counter on timeout
Two related bugs when step() is cancelled by timeout:

1. step() does not clear last_model_output/last_result at the start,
   so if timeout occurs before _get_next_action, _finalize() sees
   stale values from the previous step and records a duplicate history
   entry with wrong step numbers.

2. _finalize() early-returns when last_result is falsy, skipping the
   n_steps increment. On timeout, this means the while loop retries
   the same step number repeatedly.

Fix: clear last_model_output and last_result at step() entry, and
ensure _execute_step increments n_steps after a timeout if _finalize
did not already do so.
2026-03-23 11:25:37 +08:00
Saurav Panda 6d86be3a6b fix: detect skeleton screens and retry navigation for blank SPA pages 2026-03-19 18:48:47 -07:00
Saurav Panda befc7155ad Merge branch 'main' into fix-done-action-hallucination 2026-03-18 18:08:01 -07:00
Saurav Panda cb75bf846a Merge branch 'main' into fix-compaction-hallucination 2026-03-18 17:54:14 -07:00
Saurav Panda 42e9c101fd Update browser_use/agent/system_prompts/system_prompt_flash.md
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-03-18 17:51:54 -07:00
Saurav Panda 70ced22b7b fixed system prompt for data grounding 2026-03-18 17:39:17 -07:00
Saurav Panda cc3cc8fea7 Merge branch 'main' into fix-done-action-hallucination 2026-03-18 16:11:31 -07:00
Saurav Panda 179d526786 added better data grounding in done action 2026-03-18 16:08:00 -07:00
Saurav Panda 653d795f15 changed default compaction to 25 steps 2026-03-17 17:17:20 -07:00
Saurav Panda 0dea9480ee Merge branch 'main' into fix-compaction-hallucination 2026-03-17 15:43:11 -07:00
Saurav Panda 02349f1d9c fix: prevent compaction hallucination 2026-03-17 15:39:35 -07:00
BillionClaw 1147daef92 fix(utils): add option to disable SignalHandler for host app signal control
Add disabled parameter to SignalHandler class to allow opting out of
signal handling. This enables browser-use to be embedded in applications
like uvicorn/FastAPI that need to manage their own signal lifecycle.

Add enable_signal_handler parameter to Agent class (default True for
backward compatibility). When set to False, the Agent will not register
signal handlers, allowing the host application to control graceful
shutdown and signal handling.

Fixes #4385
2026-03-17 09:59:49 +08:00
Saurav Panda 8044181443 Merge branch 'remove-read-long-content-action' of https://github.com/browser-use/browser-use into remove-read-long-content-action 2026-03-12 12:56:48 -07:00
Saurav Panda b3ea4d82b7 Fix prompt guidance for find_elements 2026-03-12 12:56:36 -07:00
Saurav Panda 2e394a9482 Merge branch 'main' into add-current-date-to-judege 2026-03-11 17:52:24 -07:00
Saurav Panda 3546b3777d added current date to the judge 2026-03-11 17:51:55 -07:00
Saurav Panda 3e767437d3 tighten data grounding to verbatim cop 2026-03-11 11:34:54 -07:00
Saurav Panda 00748baa92 made prompt bit more linient 2026-03-11 11:00:20 -07:00
Saurav Panda bbd5bf56c7 Merge branch 'main' of https://github.com/browser-use/browser-use into add-better-data-grounding 2026-03-11 10:45:48 -07:00
Saurav Panda 360f5842f5 improved scrolling instruction for agent 2026-03-10 20:58:18 -07:00
Saurav Panda bda29e6c4e fix: prevent false success reporting on unresolved blocking error 2026-03-10 20:32:46 -07:00
Saurav Panda 347904198c Merge branch 'main' into fix-hallucination-ssies 2026-03-10 18:57:29 -07:00
Saurav Panda 032ee15c19 fix: add strict data grounding rules to prevent hallucination 2026-03-10 18:51:13 -07:00
Saurav Panda 990e0ce828 Merge branch 'main' into fix-duplicate-extraction 2026-03-10 16:22:10 -07:00
Saurav Panda ce25884751 fix: prevent duplicate items in multi-page extraction via already_collected parameter 2026-03-10 16:12:46 -07:00
Saurav Panda 081e4ee94f added check for hard constraints 2026-03-10 12:45:02 -07:00
Saurav Panda 2895720eb0 fix: remove unused variable assignments 2026-03-07 14:37:31 -08:00
sudhanshu112233shukla d864bd7a8e fix(agent): disable json escaping in conversation history (#3090) 2026-03-01 14:11:02 -05:00
Laith Weinberger e3ca7ea550 use cleaner example for browser state format 2026-03-01 10:23:32 -05:00
Mr-Neutr0n 66b857959c docs: fix browser state format documentation in system_prompt.md (#3782)
The system_prompt.md incorrectly documented the browser state format as:
  [index]<type>text</type>
  Example: [33]<div>User form</div>

But the actual serializer output format is:
  [index]<tagname attribute=value />
  With text content as child nodes on separate lines

This update:
- Corrects the format description to match actual DOMTreeSerializer output
- Updates examples to show realistic tree structure
- Documents |SCROLL| prefix for scrollable containers
- Documents |SHADOW(open/closed)| prefix for shadow DOM elements

Fixes #3782
2026-03-01 10:23:32 -05:00
Saurav Panda 08bf06f734 Merge branch 'main' into websocket-connection-issues 2026-02-24 17:18:33 -08:00
Saurav Panda 719d0361e5 Fix reconnection wait timeout to cover full auto-reconnect window
The circuit breaker and agent error handler were using a hardcoded 20s
timeout, but the worst-case auto-reconnect window is ~48s (3 attempts *
15s + 7s delays). Handlers would raise ConnectionError while reconnection
was still in progress. Now both use BrowserSession.RECONNECT_WAIT_TIMEOUT
(54s) derived from the actual reconnect parameters.
2026-02-23 17:47:52 -08:00
Saurav Panda abd0326a6f Add WebSocket reconnection for remote browser CDP connections 2026-02-23 16:34:21 -08:00
reformedot ed28e50806 feat: added automatic captcha solver handling via CAPTCHA watchdog 2026-02-23 10:51:02 -08:00
Saurav Panda adf3bf9f43 fixed ruff formatting issues 2026-02-21 09:42:20 -08:00
Saurav Panda cb6fce4d1c remove simple judge 2026-02-20 19:10:02 -08:00
Saurav Panda 0184d8d5ae Merge branch 'main' into cookie-accept-issue 2026-02-17 20:47:28 -08:00
Magnus Müller ae3ad7244b Merge branch 'main' into cursor/agent-event-output-truncation-bd60 2026-02-17 17:36:10 -08:00
Magnus Müller 868db5e657 Update MAX_STRING_LENGTH to 500000
Increased the maximum string length from 100K to 500K characters.
2026-02-17 17:33:50 -08:00
Cursor Agent e03a18935e Fix UnboundLocalError for action_name in multi_act exception handler
Move action_name extraction before the try block so it's always
defined when the except block references it. Previously, if
_check_stop_or_pause() raised InterruptedError before action_name
was assigned, the exception handler would fail with:

  UnboundLocalError: cannot access local variable 'action_name'
  where it is not associated with a value

Also reuse the action_data dict for the 'done' action check since
it's now available earlier in the loop.

Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
2026-02-18 01:24:06 +00:00
Cursor Agent cc4e5185d5 fix: truncate done_output to max length in UpdateAgentTaskEvent.from_agent()
The done_output field has max_length=100000, but agent.history.final_result()
can return arbitrarily long strings (e.g., large data extractions). This caused
Pydantic validation errors when constructing UpdateAgentTaskEvent at the end of
agent.run(), crashing the entire run even though the task itself succeeded.

Truncate done_output to MAX_STRING_LENGTH before passing to the constructor.

Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
2026-02-18 01:21:41 +00:00
laithrw e9c7061187 Merge branch 'main' into keep-alive-eventbus-fix 2026-02-17 16:51:54 -05:00
Saurav Panda 7833fcd137 added cookie overlay fix 2026-02-17 11:47:23 -08:00
Cursor Agent 270e418cea feat(agent): expose max_clickable_elements_length as Agent parameter
- Add max_clickable_elements_length parameter to Agent.__init__ with default 40000
- Add max_clickable_elements_length to AgentSettings
- Pass parameter through MessageManager to AgentMessagePrompt
- Bump version to 0.11.10a2

Co-authored-by: Magnus Müller <MagMueller@users.noreply.github.com>
2026-02-17 02:07:09 +00:00
Laith Weinberger 3de7f1d9c8 fix keep-alive hang 2026-02-16 19:56:41 -05:00