Commit Graph

6222 Commits

Author SHA1 Message Date
Osinachi Okpara
e9901ac886 Update installation command for MCP Server dependencies 2025-09-08 01:26:10 +01:00
Osinachi Okpara
8ac87537dd Merge branch 'main' into add-mcp-server-documentation 2025-09-08 01:15:01 +01:00
Osinachi Okpara
432849ee32 Apply suggestion from @cubic-dev-ai[bot]
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-09-08 01:11:37 +01:00
Osinachi Okpara
e8405ebc21 Update mcp-server.mdx 2025-09-08 01:10:13 +01:00
Osinachi Okpara
939c633aaa Update docs/customize/mcp-server.mdx
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-09-08 01:06:55 +01:00
Magnus Müller
de49d9eab2 add if main check to qwen example (#2999)
Auto-generated PR for: add if main check to qwen example
2025-09-07 17:03:04 -07:00
Magnus Müller
78184695a6 Merge branch 'main' into add-if-main-check-to-qwen-example 2025-09-07 17:02:56 -07:00
Magnus Müller
4fda18a564 add if main check to qwen example 2025-09-07 17:02:46 -07:00
Osinachi Okpara
77e98d9fba Merge branch 'main' into add-mcp-server-documentation 2025-09-08 01:02:17 +01:00
Osinachi Okpara
f6ab57367e Add MCP Server documentation
- Create comprehensive MCP Server documentation at docs/customize/mcp-server.mdx
- Add Integration group to navigation in docs.json
- Cover installation, Claude Desktop integration, available tools, and examples
- Address GitHub issue #2933 for missing MCP Server documentation
2025-09-08 00:49:34 +01:00
Magnus Müller
c0f9a8ef54 qwen support (#2997)
Auto-generated PR for: qwen support
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds first-class Qwen support via OpenAI-compatible API, with a working
example using qwen-vl-max and setup docs. Also tightens action schema
examples in prompts to improve output consistency.

- New Features - New features added
- Qwen support with example (examples/models/qwen.py) using qwen-vl-max,
vision enabled, and DashScope-compatible base_url.
- Documentation updates: Qwen guide, required ALIBABA_CLOUD env var, and
warning about smaller models returning incorrect action schemas.
- Prompt updates: replace generic action placeholder with a concrete
go_to_url example to enforce the correct nested schema.

<!-- End of auto-generated description by cubic. -->
2025-09-07 16:32:16 -07:00
Magnus Müller
84891e2f35 Update .gitignore to include all_github_issues.md file 2025-09-07 16:26:53 -07:00
Magnus Müller
870d72a4a7 Update Qwen model recommendations in documentation to clarify action schema format issues with smaller models. 2025-09-07 16:26:32 -07:00
Magnus Müller
1380b1e903 qwen support 2025-09-07 16:25:15 -07:00
Gregor Žunič
6fe3ec9afd 0.7.4 release (#2995)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Prepare 0.7.4 release by updating the project version in pyproject.toml. No other changes.

<!-- End of auto-generated description by cubic. -->
0.7.4
2025-09-07 12:23:18 -07:00
Gregor Žunič
bbd00c5792 bumped version 2025-09-07 12:11:44 -07:00
Magnus Müller
673705bf14 ignore asci for chinese letters (#2992)
Auto-generated PR for: ignore asci for chinese letters
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Preserves Chinese and other non-ASCII characters in extracted_content by
serializing JSON with ensure_ascii=False. Also updates .gitignore to
ignore Markdown files (*.md).

<!-- End of auto-generated description by cubic. -->
2025-09-06 22:06:44 -07:00
Magnus Müller
272353ecb6 Merge branch 'main' into ignore-asci-for-chinese-letters 2025-09-06 22:06:36 -07:00
Magnus Müller
bbbf62d208 Ignore file 2025-09-06 22:06:05 -07:00
Magnus Müller
25a033f0b0 Update .gitignore
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-09-06 22:05:06 -07:00
Magnus Müller
b629bc9dcc ignore asci for chinese letters 2025-09-06 19:43:35 -07:00
Saurav Panda
6d0d493f3d Magnus/eng 475 sync do not send data if not signed in (#2985)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Prevents syncing any events when the user isn’t authenticated and adds a
simple CLI auth flow so users can sign in and view runs in Browser Use
Cloud. Addresses ENG-475 by enforcing “no data without sign-in” and
providing a clear path to authenticate.

- **New Features**
- Added `browser-use auth` (device flow) that opens a session/task and
shows the Cloud URL.
  - Added `Agent.authenticate_cloud_sync()` to sign in after a run.
- Introduced `UpdateAgentSessionEvent` and updated docs for setup and
reset.

- **Bug Fixes**
- CloudSync now skips sending events when not authenticated; only sends
during the auth flow or when signed in. Uses real user_id only after
auth and temp ID otherwise.
- Starts background auth at session creation; allows session/auth events
during auth to preserve first-run data, otherwise drops them.
- `DeviceAuthClient` accepts empty session IDs; clearing auth now
deletes the config file.
  - Added a brief delay before first task to ensure the session exists.

<!-- End of auto-generated description by cubic. -->
2025-09-06 18:57:35 -07:00
Saurav Panda
4a41caaa9d fixed auth event creation 2025-09-06 18:22:02 -07:00
Saurav Panda
8a736c9dfa Merge branch 'main' into magnus/eng-475-sync-do-not-send-data-if-not-signed-in 2025-09-06 17:54:31 -07:00
Magnus Müller
149191793d fix-downloads-dedup-clean (#2989)
Auto-generated PR for branch: fix-downloads-dedup-clean
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Fixes duplicate local download events by ensuring each download is
dispatched once, and hardens download handling for both local and remote
sessions.

- **Bug Fixes**
- Add a “handled” guard to dedupe dispatch across CDP progress, JS
fetch, and polling paths.
- Disable JS fetch fallback for local downloads (behind a
_use_js_fetch_for_local flag) to avoid double-dispatch.
- Improve remote handling: emit completion using suggestedFilename when
filePath is missing; never touch local FS.
- Move CDP handlers outside try, track handler tasks, and clean up on
completion for better stability.

<!-- End of auto-generated description by cubic. -->
2025-09-06 16:25:10 -07:00
Magnus Müller
03de8840c9 Refactor exception handling in DownloadsWatchdog for improved robustness
This commit updates the DownloadsWatchdog class to specify exception types in the error handling logic, replacing broad exception catches with more precise ones (AssertionError, KeyError, AttributeError). Additionally, it adds a warning log when no downloads path is configured, ensuring better error visibility and handling during download operations.
2025-09-06 16:05:36 -07:00
Magnus Müller
495804389c Refactor download_file example to use updated Browser class
This commit modifies the `download_file.py` example to replace the `BrowserSession` and `BrowserProfile` with the new `Browser` class. The changes streamline the code and enhance clarity by directly utilizing the `Browser` for managing downloads. The download path remains set to a temporary directory for testing purposes.
2025-09-06 15:56:09 -07:00
Magnus Müller
a694501294 Enhance DownloadsWatchdog to expand and resolve download paths
This commit updates the DownloadsWatchdog class to ensure that the downloads directory path is properly expanded and resolved to an absolute path. The changes include:

- Expanding the downloads path using `expanduser()` and `resolve()` methods to handle user home directories correctly.
- Updating the download behavior settings to use the expanded path.
- Ensuring that the downloads directory is created with the resolved path.

Additionally, the example feature for downloading files has been modified to use a temporary downloads path for testing purposes.
2025-09-06 15:53:16 -07:00
Magnus Müller
a2264ab947 Merge remote-tracking branch 'origin/main' into fix-downloads-dedup-clean 2025-09-06 15:37:29 -07:00
Magnus Müller
ddf21719cb fix-disable-security-bug (#2988)
Auto-generated PR for branch: fix-disable-security-bug
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Fixes a bug where enabling disable_security overwrote --disable-features
and broke extensions. We now merge all --disable-features values,
de-duplicate them, and preserve order so both extension and security
flags are kept.

- **Bug Fixes**
- Merge all --disable-features args into a single flag; remove
duplicates while preserving order.
  - Keep existing dedupe logic for other args unchanged.
- Add CI tests to ensure extension-related flags are preserved and
duplicate disable-features are consolidated.

<!-- End of auto-generated description by cubic. -->
2025-09-06 15:34:02 -07:00
Magnus Müller
aac7bebdeb Merge branch 'main' into fix-disable-security-bug 2025-09-06 15:20:56 -07:00
Magnus Müller
9af4c91864 added playwright integration example (#2890)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Adds an advanced example that integrates Playwright with Browser-Use
over a shared Chrome DevTools Protocol session. Lets Browser-Use
orchestrate tasks while Playwright handles precise form filling,
screenshots, and text extraction via custom actions.

- **New Features**
- Starts Chrome with remote debugging and connects both tools to the
same session via CDP.
- Adds Playwright-backed actions: playwright_fill_form,
playwright_screenshot, playwright_get_text.
- Demonstrates a flow on httpbin: fill form, take screenshot, extract
title, submit.
- Includes dependency checks, robust cleanup, and optional JPEG quality
for screenshots.

<!-- End of auto-generated description by cubic. -->
2025-09-06 15:20:46 -07:00
Magnus Müller
84db72b555 Merge commit 'ad68c577c27cafb22270b811fbe9a0b9f4fcd521' into fix-disable-security-bug 2025-09-06 15:19:59 -07:00
Magnus Müller
1892888ca0 Fix JSON formatting in documentation file by adding a newline at the end of docs.json. This ensures proper file termination and adheres to best practices for JSON files. 2025-09-06 15:15:11 -07:00
Magnus Müller
95ccbe5115 Refine Playwright integration example documentation
This commit updates the Playwright integration example in `playwright_integration.py` to provide a clearer overview of its key features. The previous detailed description has been condensed into a more concise format, highlighting the main functionalities of sharing a Chrome instance via CDP and the ability to perform actions with both Playwright and Browser-Use.

- **Documentation Update**
- Simplified the example description for better clarity and focus on key features.
2025-09-06 15:14:36 -07:00
Magnus Müller
73fa4b56db Add Playwright integration example to documentation
This commit adds a new example demonstrating the integration of Playwright with Browser-Use, showcasing how to utilize Playwright for form filling, taking screenshots, and extracting text. The example is linked in the documentation and includes installation instructions and a comprehensive code sample.

- **New Documentation**
- Added a new Playwright integration example in `playwright-integration.mdx`.
- Updated `docs.json` to include the new example in the documentation index.
- Enhanced the `add.mdx` file with references to the Playwright integration example.

This enhances the usability of Browser-Use by providing clear guidance on leveraging Playwright's capabilities alongside it.
2025-09-06 15:13:52 -07:00
Magnus Müller
b956c11567 Add advanced Playwright integration example
This commit introduces a new example demonstrating the integration of Playwright with Browser-Use. The example showcases how to start Chrome with CDP enabled, create custom actions for form filling, taking screenshots, and extracting text using Playwright's capabilities. It includes necessary dependency checks and a main function to orchestrate the workflow using an AI agent.

- **New Features**
- Implemented custom actions: `playwright_fill_form`, `playwright_screenshot`, and `playwright_get_text`.
- Added error handling and dependency checks for required libraries.
- Provided detailed documentation within the code for clarity on usage and functionality.
2025-09-06 14:54:52 -07:00
Magnus Müller
6495408168 Ignore input 2025-09-06 14:50:54 -07:00
Magnus Müller
b32a79a063 Merge branch 'main' into added-playwright-browser-use-example 2025-09-06 14:41:17 -07:00
Saurav Panda
0c1577debf Merge branch 'main' into magnus/eng-475-sync-do-not-send-data-if-not-signed-in 2025-09-06 13:50:00 -07:00
Magnus Müller
ad68c577c2 fix(gemini): Correct invalid schema by removing 'title' from required list (#2856)
This patch ensures that if 'title' is present in the 'required' list, it
is correctly removed, thus restoring the functionality of the native
Gemini integration for structured output. This ensures that 'Response'
and 'Page summary' are two different objects.

    
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Fixes invalid JSON schema for Gemini by removing 'title' from the
required list during schema cleanup. Prevents validation errors when
properties are replaced with a placeholder.

- **Bug Fixes**
- Update clean_schema to drop 'title' from required arrays, avoiding
"required references missing property" errors in
browser_use/llm/google/chat.py.

<!-- End of auto-generated description by cubic. -->
2025-09-06 13:20:58 -07:00
Magnus Müller
6fe2afde21 Merge branch 'main' into main 2025-09-06 13:20:14 -07:00
Magnus Müller
27ead3aa24 enable StorageStateWatchdog if user_data_dir provided (#2987)
Auto-generated PR for: enable StorageStateWatchdog if user_data_dir
provided
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Enable StorageStateWatchdog when storage_state or user_data_dir is set,
so sessions with persistence configured save storage on shutdown with
safe defaults. Adds clear debug logs to show when it’s enabled.

- **New Features**
- Automatically attaches StorageStateWatchdog if storage_state or
user_data_dir is provided.
- Uses conservative defaults: auto_save_interval=60s and
save_on_change=false (saves on shutdown).
- Adds debug messages showing enable/disable status and which options
triggered it.

<!-- End of auto-generated description by cubic. -->
2025-09-06 13:19:00 -07:00
Magnus Müller
12c47d77ff Merge branch 'main' into enable-storagestatewatchdog-if-userdatadir-provided 2025-09-06 13:18:53 -07:00
Magnus Müller
0507aa49a2 fix: improve StorageStateWatchdog lifecycle management (#2853)
## Fix StorageStateWatchdog lifecycle management

### Problem
StorageStateWatchdog continues monitoring after browser closes, causing
CDP connection errors in logs.

### Solution
- Add `BrowserStopEvent` handler to cleanly stop monitoring when browser
closes
- Await `LoadStorageStateEvent` dispatch to ensure storage loads before
navigation
- Properly cancel monitoring task to prevent post-close errors

### Impact
- No impact while `StorageStateWatchdog` is commented out in
`attach_all_watchdogs()`
- No more error logs after browser session ends
- Ensures authentication/cookies are fully loaded before navigation
begins
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Stop StorageStateWatchdog when the browser closes and await storage load
on connect. This prevents CDP connection errors after shutdown and
ensures cookies/auth are loaded before navigation.

<!-- End of auto-generated description by cubic. -->
2025-09-06 13:18:47 -07:00
Magnus Müller
350d6ff101 Merge branch 'main' into fix/storage-watchdog-stop-monitoring 2025-09-06 13:18:22 -07:00
Magnus Müller
402c040512 fix codec error while writing log (#2854)
fix codec error while writing log, below is the detailed error message
```
--- Logging error ---
Traceback (most recent call last):
  File "D:\IDE\Python\Python312\Lib\logging\__init__.py", line 1163, in emit
    stream.write(msg + self.terminator)
UnicodeEncodeError: 'gbk' codec can't encode character '\U0001f4be' in position 63: illegal multibyte sequence
Call stack:
  File "D:\WorkHome\git\gitee\azhengzz\browser-use\example_one.py", line 147, in <module>
    asyncio.run(main())
  File "D:\IDE\Python\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
  File "D:\IDE\Python\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "D:\IDE\Python\Python312\Lib\asyncio\base_events.py", line 673, in run_until_complete
    self.run_forever()
  File "D:\IDE\Python\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
    super().run_forever()
  File "D:\IDE\Python\Python312\Lib\asyncio\base_events.py", line 640, in run_forever
    self._run_once()
  File "D:\IDE\Python\Python312\Lib\asyncio\base_events.py", line 1992, in _run_once
    handle._run()
  File "D:\IDE\Python\Python312\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "D:\WorkHome\git\gitee\azhengzz\browser-use\example_one.py", line 131, in main
    agent = Agent(
  File "D:\WorkHome\git\gitee\azhengzz\browser-use\browser_use\utils.py", line 330, in wrapper
    result = func(*args, **kwargs)
  File "D:\WorkHome\git\gitee\azhengzz\browser-use\browser_use\agent\service.py", line 267, in __init__
    self._set_file_system(file_system_path)
  File "D:\WorkHome\git\gitee\azhengzz\browser-use\browser_use\agent\service.py", line 512, in _set_file_system
    logger.debug(f'💾 File system path: {self.file_system_path}')
Message: '💾 File system path: C:\\Users\\Zheng\\AppData\\Local\\Temp\\browser_use_agent_068aff10-a1d9-7ee5-8000-803a64a9e569_1756360970'
Arguments: ()
```
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Force UTF-8 encoding for log file handlers to fix UnicodeEncodeError
when writing non-ASCII characters (e.g., emojis) to log files,
especially on Windows with GBK locales. Logs now write reliably without
crashing.

- **Bug Fixes**
- Set encoding='utf-8' on debug and info FileHandlers to prevent 'gbk'
codec errors.

<!-- End of auto-generated description by cubic. -->
2025-09-06 13:14:16 -07:00
Magnus Müller
8bd4f84cdf Merge branch 'main' into fix-logging-codec-error 2025-09-06 13:13:56 -07:00
Magnus Müller
4964d92776 Merge branch 'main' into fix/storage-watchdog-stop-monitoring 2025-09-06 13:13:12 -07:00
Magnus Müller
e24232b872 Merge branch 'main' into enable-storagestatewatchdog-if-userdatadir-provided 2025-09-06 13:11:41 -07:00