Commit Graph

8459 Commits

Author SHA1 Message Date
Saurav Panda 9cfec600d4 fixed broken links in docs (#3841)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Fixed broken links in the docs to restore navigation and remove 404s.
Addresses Linear 3836.

- **Bug Fixes**
  - Agent basics: updated Supported Models link to /supported-models.
- CodeAgent basics: linked ChatBrowserUse to /supported-models and
updated API key URL to https://cloud.browser-use.com/new-api-key.
- MCP server: replaced v2 API Reference link with
https://docs.cloud.browser-use.com.

<sup>Written for commit 75b5a0dffd.
Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2026-01-05 10:47:47 -08:00
Saurav Panda 75b5a0dffd fixed broken links in docs 2026-01-05 10:45:14 -08:00
Larsen Cundrič 630f85dd05 Remove search from v1 (#3834) 2026-01-03 14:28:20 +01:00
LarsenCundric 10b2623f17 Remove search from v1 2026-01-03 14:26:57 +01:00
Saurav Panda 6b4ed25347 refactor: Replace print with logger.debug in actor/page.py (#3814)
## Background
The page.py file in the browser_use/actor directory was using a print
statement for debugging purposes, which is inconsistent with the
project's logging strategy. The project already has a centralized
logging system using Python's logging module, configured through
browser_use/logging_config.py .

## Changes
1. File Modified : browser_use/actor/page.py
2. Change : Replaced the debug print statement on line 134 with a
logger.debug call
3. Logger Used : The existing logger imported from browser_use
4. Log Level : debug (matching the original debug print intent)
## Benefits
- Unified Logging : Aligns with the project's existing logging system
- Flexible Configuration : Debug logs can be easily enabled/disabled via
environment variables or code configuration
- Better Context : Logs include component name and timestamp when
configured
- Structured Output : Consistent log format across the project
- Reduced Console Clutter : Users can control log verbosity based on
their needs
- Improved Debugging : Better integration with logging tools and
services
## Impact
- No Breaking Changes : This is a refactoring change that preserves
functionality
- Minimal Scope : Only affects one debug statement in a single file
- Backward Compatible : Existing functionality remains unchanged
## Testing
- ✅ Python syntax check passed ( python -m py_compile
browser_use/actor/page.py )
- ✅ No other print statements left in the file (verified via grep )
- ✅ Uses existing project logger (no new dependencies)
- ✅ Log level appropriately set to debug for debugging purposes

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Switched the debug print in browser_use/actor/page.py to logger.debug to
align with the project’s logging system. This keeps behavior the same
while providing structured logs and configurable verbosity.

<sup>Written for commit 6b77410683.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-26 13:07:45 -08:00
kalil0321 49a345fb19 Lint 2025-12-25 18:56:30 +01:00
kalil0321 1a96cf7ef0 Improve HAR Watchdog
Obtaining playwright har 1-1 parity might require more work, the missing elements are related to requests timing
2025-12-25 17:44:49 +01:00
kalil0321 038ae4bc8d Merge branch 'main' into kalil0321/har_watchdog 2025-12-25 17:10:05 +01:00
constx1337 6b77410683 refactor: Replace print with logger.debug in actor/page.py 2025-12-25 14:39:05 +08:00
Saurav Panda 310bc12c3e feat: added exp backoff retry and minimum element load (#3808)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds exponential backoff retries to rerun_history and an opt-in wait for
a minimum number of DOM elements before actions that need element
matching. This improves reliability on dynamic/SPAs and avoids tight
retry loops.

- **New Features**
- Exponential backoff for step retries: 5s base, doubles each retry,
capped at 30s.
- Optional wait_for_elements: waits for a minimum element count before
click/input/hover/select/drag; count inferred from action indices
(capped at 50), with polling and timeout.
- Continues with the last known state if the minimum isn’t reached
within the timeout.

<sup>Written for commit 1073fc9e7a.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-23 20:22:52 -08:00
Saurav Panda 1073fc9e7a Merge branch 'main' into rerun-history-add-exp-retry 2025-12-23 20:16:27 -08:00
Saurav Panda 9c90ff0081 feat: add support for openai responses model (#3805)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Add Azure OpenAI Responses API support with auto-detection and
structured output, so Codex and computer-use-preview models work with
api_version 2025-03-01-preview. Addresses Linear 3771.

- **New Features**
- Route ainvoke to Responses API when use_responses_api is True or
'auto' for supported models; fallback to Chat Completions otherwise.
- Added ResponsesAPIMessageSerializer to convert existing message types
(text, images, assistant) to Responses API input.
- Structured output via text.format + JSON schema, with optional schema
injection into the system prompt and support for
dont_force_structured_output.
- Usage mapping and robust error handling (rate limits,
connection/status errors). Updated docs, example, and tests.

- **Migration**
- For Codex/computer-use models, set api_version to 2025-03-01-preview;
'auto' will use Responses API.
  - Override behavior with use_responses_api = True/False/'auto`.

<sup>Written for commit 2f6a18a64e.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-23 19:31:18 -08:00
Saurav Panda 319d0acd45 fixed the edge case for handling max index 2025-12-23 19:29:43 -08:00
Saurav Panda 2f6a18a64e Merge branch 'main' into 3771-feature-request-add-support-for-openai-responses-api-for-azure-openai 2025-12-23 19:28:17 -08:00
Saurav Panda fe6e8d47e1 fixed azure openai chat with gpt-5.1-codex 2025-12-23 18:04:30 -08:00
Saurav Panda 2aa23f01dc fixed backend_node_id based element counting. 2025-12-23 17:25:38 -08:00
Saurav Panda 0da9457f6b feat: added exp backoff retry and minimum element load 2025-12-23 17:02:28 -08:00
Saurav Panda a25bd42124 feat: remove redundant retry step from history (#3807)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Skips redundant retry steps during history reruns when the previous step
already succeeded on the same element and action. This avoids replay
failures after navigation and speeds up reruns.

- **New Features**
- Detect redundant retries by matching element (hash/stable_hash/xpath)
and action type.
- Track previous step success and skip the duplicate, adding a “Skipped
- redundant retry of previous step” result.
  - Added tests for rerun behavior and the detection helper.

<sup>Written for commit bb13679f85.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-23 16:31:21 -08:00
Saurav Panda bb13679f85 feat: remove redundant retry step from history 2025-12-23 16:25:52 -08:00
Saurav Panda 29c9f1a416 feat: add support for openai responses model 2025-12-22 22:16:56 -08:00
Saurav Panda 1849730d9f fix: resolve Gemini API error on empty action schemas (#3804)
Fixes #3786.

When using the Gemini API (via LiteLLM or directly), the request fails
with a `BadRequestError`. This is because Gemini's API strictly enforces
that any parameter defined as `type: OBJECT` in the `response_schema`
must have a non-empty `properties` map.

The `go_back` action (and others using `NoParamsAction`) previously
generated an empty object schema (`{"type": "object", "properties":
{}}`), causing this validation failure.

**Error Message:**
> `GeminiException BadRequestError - *
GenerateContentRequest.generation_config.response_schema.properties["action"].items.any_of[3].properties["go_back"].properties:
should be non-empty for OBJECT type`

## Changes
- Modified `NoParamsAction` in `browser_use/tools/service.py` to include
an optional `description` field.
- This ensures Pydantic generates a valid schema (e.g., `{"properties":
{"description": {"type": "string"}}}`) instead of an empty one.
- The new field is optional (`None` by default) and is explicitly
ignored by the action logic (`_`), ensuring no side effects on existing
functionality.

- Verified that `NoParamsAction.model_json_schema()` now produces a
schema with properties, satisfying the Gemini API requirement.





<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Prevent Gemini BadRequestError by ensuring actions with no params
produce a non-empty object schema. Adds an optional description field to
NoParamsAction so Pydantic includes properties in the response_schema.

- **Bug Fixes**
- Added description: str | None = Field(None, ...) to NoParamsAction in
browser_use/tools/views.py to satisfy Gemini’s OBJECT-type schema
requirement.
- Field is optional and ignored by action logic, so behavior remains
unchanged.

<sup>Written for commit bd6c1d76e2.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-22 19:40:22 -08:00
nitesh-77 bd6c1d76e2 style: use single quotes to satisfy ruff formatter 2025-12-23 06:06:33 +05:30
nitesh-77 d17f10fe45 fix: use str | None type hint to satisfy linter 2025-12-23 06:00:22 +05:30
nitesh-77 285995ecce fix: resolve Gemini API error on empty action schemas 2025-12-23 05:48:12 +05:30
Enzo Biondo c4c5875ad0 Merge branch 'main' into feat/multi-tab-recording 2025-12-22 09:28:00 -03:00
Saurav Panda 30c441ac04 fix: use correct MIME type for images in Google serializer (#3798)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Use the correct image MIME type from ImageURL when building image parts
in the Google serializer instead of hardcoding JPEG. This fixes Linear
3740 where ActionResult images broke after the Google Gen AI bump.

- **Bug Fixes**
- Set mime_type from part.image_url.media_type in Part.from_bytes so
non-JPEG images (e.g., PNG, WEBP, GIF) render correctly.

<sup>Written for commit 221d85744e.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-21 09:49:45 -08:00
Saurav Panda 221d85744e fix: use correct MIME type for images in Google serializer 2025-12-21 09:45:09 -08:00
Saurav Panda c05f390237 fix: expose prohibited_domains in BrowserSession (#3770)
fixes #3737

### Summary
Added
[prohibited_domains](cci:1://file:///home/akram/browser-use/tests/ci/security/test_domain_filtering.py:294:1-316:67)
parameter to `BrowserSession.__init__` to match documentation.

### Changes
- Added
[prohibited_domains](cci:1://file:///home/akram/browser-use/tests/ci/security/test_domain_filtering.py:294:1-316:67)
parameter to all 3
[__init__](cci:1://file:///home/akram/browser-use/browser_use/browser/session.py:219:1-361:3)
overloads in
[session.py](cci:7://file:///home/akram/browser-use/browser_use/browser/session.py:0:0-0:0)
- Added integration test in
[test_domain_filtering.py](cci:7://file:///home/akram/browser-use/tests/ci/security/test_domain_filtering.py:0:0-0:0)

### Testing
All existing tests pass. The parameter is correctly passed to
[BrowserProfile](cci:2://file:///home/akram/browser-use/browser_use/browser/profile.py:526:0-1204:123)
via the existing `locals()` pattern.





<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Exposed the prohibited_domains parameter in BrowserSession.__init__
across all overloads to match the docs and enable session-level domain
blocking.

<sup>Written for commit fc4c017076.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-21 09:20:38 -08:00
Saurav Panda fc4c017076 Merge branch 'main' into fix/add-prohibited-domains-to-browser-session 2025-12-21 09:10:27 -08:00
Saurav Panda 64e702e2ae fix: include shadow DOM form elements in selector_map even without sn… (#3793)
…apshot data

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Include shadow DOM form elements in selector_map and assign action
indices even when DOMSnapshot lacks layout data. Fixes missed
interactions in web components and login forms, with added targeted
logging for easier debugging.

- **Bug Fixes**
- Detect shadow DOM by walking parent chain to find a document-fragment
shadow root.
- Mark inputs, buttons, selects, textareas, and links inside shadow DOM
as interactive even without snapshot_node; include them in selector_map.
- Preserve existing behavior for file inputs and scrollable containers.
- Add focused logs in agent, snapshot builder, serializer, and DOM
service to trace element search/matches and missing snapshot data.

<sup>Written for commit 07b7a6d8c0.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-19 18:40:15 -08:00
Saurav Panda 07b7a6d8c0 fix: include shadow DOM form elements in selector_map even without snapshot data 2025-12-19 18:32:40 -08:00
Saurav Panda 085a43e268 fetch all skills available for agent (#3792)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds wildcard and pagination to skill fetching so agents load the right
skills without overloading tools. Wildcard returns the first 100
finished skills; explicit IDs paginate until all are found or limits are
hit.

- **New Features**
- Support "*" to load the first 100 enabled, finished skills; warn if
more exist.
- Paginate for explicit IDs (page_size=100) up to 5 pages; stop when all
requested IDs are found or last page.
- Filter only finished skills (is_enabled filtered by API) and add
clearer debug/warning logs.

<sup>Written for commit e8366536c4.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-19 16:24:16 -08:00
Saurav Panda e8366536c4 fetch all skills available for agent 2025-12-19 13:51:19 -08:00
Saurav Panda 195f61a70d add support for external skillservice (#3790)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds an optional skill_service parameter to the agent so you can inject
an external SkillService. If provided, the agent uses it; otherwise it
builds one from skill_ids.

- **New Features**
  - New optional parameter: skill_service.
- Precedence: use injected skill_service; fallback to
SkillService(skill_ids) when skill_ids are set.

<sup>Written for commit cf0894ff8d.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-18 19:35:20 -08:00
Saurav Panda cf0894ff8d add support for external skillservice 2025-12-18 19:10:47 -08:00
Mert Unsal f698abf531 Simplify Sandbox Structured Output Example (#3789) 2025-12-18 19:06:47 -08:00
mertunsall 5e5c84c81c simplify 2025-12-19 04:06:00 +01:00
Saurav Panda 7d48e71326 fix: change max_step_interval to 45s (#3788)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Increase the default max_step_interval from 5s to 45s to prevent rerun
timeouts when original steps had long LLM delays. Also make reruns more
reliable with better skipping, error recording, and cleanup.

- **Bug Fixes**
  - Cap saved step_interval at 45s and update docs.
- When skip_failures=True, skip steps that errored in the original run;
when False, attempt them.
- Always record a final error result after max retries so the summary
counts failures; only raise when skip_failures=False.
- Ensure resources are closed with try/finally; add clearer
element-matching diagnostics and focused tests for skipping, cleanup,
and error accounting.

<sup>Written for commit b9c8346499.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-18 16:49:03 -08:00
Saurav Panda b9c8346499 fix: change max_step_interval to 45s 2025-12-18 16:45:21 -08:00
Saurav Panda e62fc5242b Merge branch 'main' into fix/add-prohibited-domains-to-browser-session 2025-12-18 15:56:24 -08:00
Saurav Panda 84261a9f7c added gemini 3 flash preview model (#3785)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds the gemini-3-flash-preview model to the supported Google models
list, enabling clients to use the new Gemini 3 Flash preview. No changes
to existing behavior.

<sup>Written for commit eb2382c7c4.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-18 12:25:02 -08:00
Saurav Panda eb2382c7c4 added gemini 3 flash preview model 2025-12-18 11:25:23 -08:00
Saurav Panda 28d31b3f54 added BROWSER_USE_DISABLE_EXTENSIONS env var to disable extension (#3784)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Add BROWSER_USE_DISABLE_EXTENSIONS to let users disable built-in browser
extensions via environment variables. Defaults stay enabled; useful for
CI and WSL2 setups where extensions should not load.

- **New Features**
- New env var: BROWSER_USE_DISABLE_EXTENSIONS (true/1/yes/on disables;
false/0/no/off enables; unset keeps enabled).
- BrowserProfile and BrowserSession respect the env var; explicit
enable_default_extensions still overrides it.
- Added CI tests for defaults, parsing, overrides, and session
propagation.

<sup>Written for commit 88420e4fcd.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-17 18:10:41 -08:00
Saurav Panda 88420e4fcd Merge branch 'main' into 3780-bug-environment-variables-completely-invalid-on-wsl2 2025-12-17 17:48:25 -08:00
Saurav Panda 2ccc7942b3 Fix glob pattern for Playwright browser paths (#3778)
playwright 1.57.0 installs chromium to
`$playwright_path/chromium-*/chrome-linux64/`, causing the existing
paths to fail to find the browser. globing `chrome-linux*` will allow
watchdog to find playwright installed 32-bit and 64-bit chromium.





<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Updated Playwright Chromium path globs from `chrome-linux` to
`chrome-linux*` to match v1.57.0’s chrome-linux64 layout. This restores
browser detection in the local watchdog for both 32-bit and 64-bit
Chromium and headless shell.

<sup>Written for commit f8cfe587fc.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-17 17:37:09 -08:00
Saurav Panda 556d1bc022 added BROWSER_USE_DISABLE_EXTENSIONS env var to disable extension 2025-12-17 17:31:46 -08:00
Saurav Panda f8cfe587fc Merge branch 'main' into playright-new-chromium-path 2025-12-17 14:21:36 -08:00
Saurav Panda f37130faac feat: added Unique attribute match and better error logging for rerun (#3783)
<!-- This is an auto-generated description by cubic. -->
## Summary by cubic
Adds unique attribute matching to history reruns and improves error
logging. This makes element mapping more reliable and easier to debug,
especially with older history files.

- **New Features**
- Added Level 4 matching via unique attributes (name, id, aria-label)
when EXACT/STABLE/XPATH fail.
- More informative error messages with element details, page element
count, and strategies tried.
- Debug logs at each match stage and a helper to format elements for
logs.

<sup>Written for commit afa5b71747.
Summary will update automatically on new commits.</sup>

<!-- End of auto-generated description by cubic. -->
2025-12-17 11:30:34 -08:00
Saurav Panda afa5b71747 feat: added Unique attribute match and better error logging for rerun 2025-12-17 11:20:46 -08:00
Steven Beverly 7fbbf7beb2 Merge branch 'main' into playright-new-chromium-path 2025-12-17 08:18:23 -07:00