Commit Graph

4200 Commits

Author SHA1 Message Date
Magnus Müller 6c53f20d11 feat: add extract_data action and save_to_file for efficient data extraction
- Add new `extract_data` action that uses CSS selectors (querySelectorAll) to
  extract structured data directly from the page without LLM cost. Supports
  extracting text, href, src, or any HTML attribute from matching elements.
  Returns structured JSON and optionally saves to CSV/JSONL/JSON files.

- Add `save_to_file` parameter to existing `extract` action so LLM-extracted
  content can be written directly to a file instead of consuming context window
  tokens. Enables accumulating data across multiple pages.

- Update both system prompts with a new `<data_extraction>` section that guides
  the agent on when to use extract_data vs extract vs evaluate, and documents
  the multi-page extraction pattern (extract → click Next → extract → repeat
  with save_to_file appending to same file).

These changes address the core data extraction inefficiency where the agent was
forced to output all extracted tokens through the LLM, making bulk extraction
(100+ items, multi-page scraping) slow and expensive.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 00:06:18 -08:00
Magnus Müller 3ba50e68b0 Increase MAX_MEMORY_LENGTH from 1000 to 10000 chars
When evaluate or extract returns results longer than MAX_MEMORY_LENGTH,
the full data is placed in extracted_content (shown only once via
read_state) and long_term_memory gets a useless summary. This causes
the agent to lose access to the data in later steps and hallucinate
placeholder text like "JSON_STRING_FROM_STEP_6".

Increasing the threshold 10x means most real-world results will stay
in long_term_memory and persist across steps.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 00:27:55 -08:00
Magnus Müller e072135590 fix: add file validation for uploads and dynamic text extension list
- Add 0-byte file check in upload_file handler to catch empty files early
  with a clear error message instead of silently passing them to websites
- Add 0-byte file check in CDP upload watchdog before setFileInputFiles
  to prevent uploading empty files that cause cascading failures
- Replace hardcoded text extension list in read_file_structured() with
  dynamic derivation from _file_types, so new text-based file types
  are automatically supported for external file reading

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 00:25:36 -08:00
Saurav Panda 7a32885644 Merge branch 'main' into feat/cdp-url-cli-support 2026-01-29 11:13:15 -08:00
Magnus Müller 3c927b4f9b Merge branch 'main' into increase-step-timeout-180 2026-01-29 02:06:24 -08:00
Magnus Müller 7d66592a0c Increase default step_timeout from 120s to 180s
Production data analysis (24h) shows:
- 36.5% of consecutive failures are AsyncIO CancelledError in browser state retrieval
- Complex pages can take 30-60s for DOM extraction + 30-60s for LLM call
- 120s was too tight for complex pages with slow network

180s (3 min) gives ~50% more buffer while still catching stuck steps.
This is the per-step timeout, not the total task timeout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 01:07:08 -08:00
Magnus Müller 40336731d5 Remove specific timeout for 'browser-use' model 2026-01-29 00:39:05 -08:00
Magnus Müller 3b2b213dd3 Increase LLM timeout to 75s for gemini and browser-use models
Based on production data analysis showing:
- gemini-3-pro-preview has 48% timeout rate with median 23s/step
- browser-use-2.0 timeout tasks have 74% slower time per step (10.7s vs 6.0s)
- Most timeouts occur on steps 11-20 where tasks are making progress

The 45s default was too aggressive. 75s provides ~3x the median step time
as buffer while still catching genuinely stuck tasks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 00:35:56 -08:00
Laith Weinberger be6873636e clear agent eventbus, not just browser session's 2026-01-28 20:28:14 -05:00
Laith Weinberger b00ffd5380 lint 2026-01-27 18:28:53 -05:00
laithrw 5a3f8b4d54 Merge branch 'main' into fix/respect-use-vision-in-judge-fix 2026-01-27 18:22:06 -05:00
Saurav Panda c011c529fc feat: add bu-2-0 pricing 2026-01-27 10:35:41 -08:00
Marcin 9a1fb547d3 fix(cli): use 'cdp-default' session name when --cdp-url is provided
This prevents conflicts when switching between browser modes. Session parameters
(browser mode, cdp_url, etc.) are set at creation time and cannot be changed.
Without this fix, an existing 'default' session using chromium mode would be
silently reused when the user specifies --cdp-url, causing the CDP connection
to be ignored.

The same issue would occur switching between any browser modes (e.g., --browser
chromium to --browser real), but CDP is the most common case where users expect
to connect to a specific existing browser instance.

The session remap is placed early in main() before any command handling (server,
sessions, close --all) so those commands also target the correct session.

Users can still override with explicit --session flag if needed.
2026-01-27 09:00:38 +01:00
laithrw c62ceafa25 Merge branch 'main' into fix/3889-draftjs-first-char 2026-01-26 19:51:08 -05:00
Laith Weinberger ca049c67a1 clean comments 2026-01-26 19:28:45 -05:00
Saurav Panda ee35b53b12 Merge branch 'main' into saurav/change-gemini-thinking-to-auto 2026-01-26 12:46:52 -08:00
Saurav Panda 6d54f521cf set default gemini thinking to auto 2026-01-26 12:44:51 -08:00
laithrw 7cf8575e4a Merge branch 'main' into main 2026-01-26 15:24:11 -05:00
laithrw 7bacbbbfa2 Merge branch 'main' into 3538 2026-01-26 15:15:27 -05:00
zhongzhenyu b1fad345d6 style: remove trailing whitespace 2026-01-25 22:05:01 -08:00
zhongzhenyu f13d8246e9 fix: Fix Draft.js space prepending to only apply when clear=True 2026-01-25 21:58:18 -08:00
Laith Weinberger e1c4eeef35 fix(#3538): always index scrollable dropdown containers regardless of interactive descendants 2026-01-25 17:05:10 -05:00
Laith Weinberger 6f8c077932 lint 2026-01-25 15:49:49 -05:00
Laith Weinberger 64ada81915 fix(#2867): verify dropdown selection and retry if reverted
addresses select_dropdown silently claiming success even when frameworks intercepted and reverted the selection
2026-01-25 15:40:22 -05:00
Saurav Panda acd05e30e0 removed duplicate --headed flag from skill cli 2026-01-25 11:34:09 -08:00
laithrw d1a53a158e Merge branch 'main' into main 2026-01-25 12:31:43 -05:00
laithrw 468d149588 Merge branch 'main' into fix/3292-table-row-clickability 2026-01-25 10:48:47 -05:00
laithrw 794b68b448 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-25 10:43:27 -05:00
Laith Weinberger 0b8aa55d54 Merge branch 'main' into fix/label-span-interactive-antd 2026-01-24 17:19:38 -05:00
Laith Weinberger 1794849886 don't mutate page
instead of writing markers to DOM, collect element references in JS, resolve them to internal Chrome node IDs via CDP, and store those IDs in Python
2026-01-24 16:36:14 -05:00
Laith Weinberger 20f51c7fef detect JS event listeners for clickable elements
uses CDP Runtime.evaluate with includeCommandLineAPI to access getEventListeners() and mark elements with click/mousedown/pointerdown listeners before DOM snapshot capture
2026-01-24 14:44:08 -05:00
Marcin 965bc68195 style: format ensure_server function signature 2026-01-24 08:56:07 +01:00
Marcin 1791462de1 feat(cli): add --cdp-url flag to connect to existing browser via CDP
This adds support for connecting to an existing browser instance via
Chrome DevTools Protocol (CDP) URL in the skill_cli commands.

## Why

The current skill_cli only supports three browser modes:
- chromium: Launches a new Playwright-managed Chromium
- real: Launches users Chrome with profile
- remote: Uses Browser-Use Cloud

However, many use cases require connecting to an already-running browser:
- Remote browser automation via SSH tunnels
- Connecting to browsers in Docker containers
- Reusing authenticated browser sessions
- Integration with Claude Code on remote servers

The BrowserSession class already supports cdp_url, but it was not
exposed through the skill_cli. The TUI mode has this option, but the
simple CLI commands did not.

## Changes

- main.py: Added --cdp-url argument and pass-through to server
- server.py: Accept and store cdp_url, pass to session registry
- sessions.py: Handle cdp_url in session creation (takes precedence)

## Usage

browser-use --cdp-url http://localhost:9222 open https://example.com
browser-use --cdp-url http://localhost:9222 state
browser-use --cdp-url http://localhost:9222 click 5

## Testing

Tested with Chrome remote debugging over SSH tunnel - successfully
controlled a local macOS Chrome browser from a remote Linux server.

Vibe coded with Claude Opus 4.5

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 08:21:11 +01:00
Magnus Müller 6b23672c3c Merge branch 'main' into cache-anthropic 2026-01-23 18:10:11 -08:00
Magnus Müller 80a08a4a03 Merge branch 'main' into #3557 2026-01-23 18:06:47 -08:00
Magnus Müller d9dec964be Merge branch 'main' into fix/3889-draftjs-first-char 2026-01-23 16:24:34 -08:00
Saurav Panda b63ae37008 Merge branch 'main' into gemini-add-thinking-level 2026-01-23 15:21:17 -08:00
Saurav Panda 2774be5cc6 Merge branch 'main' into fix/cli-chatbrowseruse-support 2026-01-23 15:18:19 -08:00
Saurav Panda bb3b1e8cf5 added minimal model for gemini 3 flash 2026-01-23 15:11:13 -08:00
Saurav Panda 041d03a93f feat: updated the thinking budget 2026-01-23 14:42:59 -08:00
Saurav Panda 5b06f4edd9 set default thinking to 0 for gemini-3 models 2026-01-23 13:44:29 -08:00
Laith Weinberger a75fa14d14 increase char limit for extraction 2026-01-23 16:38:38 -05:00
Laith Weinberger f85bbb49c8 pass model_name to SystemPrompt 2026-01-23 16:33:28 -05:00
Laith Weinberger 2f24f53900 use longer prompts for opus/haiku 4.5 to allow caching 2026-01-23 16:20:25 -05:00
Saurav Panda f3aad3c145 Added browser use 2-0 support 2026-01-23 13:17:56 -08:00
Saurav Panda 37586c9e9f Added support for new browser use model 2026-01-23 12:39:10 -08:00
BouquetAntoine 1a01e5dff7 feat(cli): add ChatBrowserUse support for BROWSER_USE_API_KEY
The CLI 'run' command now supports BROWSER_USE_API_KEY as an LLM option,
using ChatBrowserUse which is optimized for browser automation tasks.

This aligns the CLI behavior with the documented supported models at
https://docs.browser-use.com/supported-models which shows ChatBrowserUse
as a valid LLM option using BROWSER_USE_API_KEY.

Changes:
- Add ChatBrowserUse as first LLM option in get_llm() when BROWSER_USE_API_KEY is set
- Update error message to mention BROWSER_USE_API_KEY
2026-01-22 17:18:08 +01:00
Gregor Žunič b6bdc17bcb addresses cubic 2026-01-21 22:17:07 -08:00
Gregor Žunič 5fc3a428c7 better remote session management 2026-01-21 22:12:51 -08:00
Gregor Žunič c7c5cae20e remote browser fixes + readme 2026-01-21 21:49:26 -08:00