Commit Graph

75 Commits

Author SHA1 Message Date
Gregor Žunič a75b950dc7 Fix prerelease version upgrade check 2026-06-08 13:35:20 -07:00
Magnus Müller 1474c60da1 Merge remote-tracking branch 'upstream/main' into magnus/browser-use-rust-core-integration
# Conflicts:
#	browser_use/__init__.py
#	browser_use/agent/service.py
#	browser_use/browser/watchdogs/downloads_watchdog.py
#	browser_use/code_use/utils.py
#	browser_use/llm/models.py
#	browser_use/tokens/service.py
#	browser_use/utils.py
2026-06-04 16:14:57 +00:00
Magnus Müller 91705e22b7 Sanitize direct-start URL candidates 2026-06-04 08:51:39 +00:00
Magnus Müller f644efbcad Record Rust eval Laminar summaries 2026-06-04 04:10:20 +00:00
Laith Weinberger 65f87b7fca fix sensitive_data redaction order to prevent substring leaks 2026-04-11 18:16:24 -04: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
hacking-racoon 38703d5ad7 perf: lazy import for openai and reportlab to reduce startup latency
- agent/views.py: Move RateLimitError import inside format_error() function
  to avoid loading openai SDK (~800ms) at module level
- llm/messages.py: Replace openai.BaseModel with pydantic.BaseModel directly
  to remove unnecessary openai dependency
- filesystem/file_system.py: Move reportlab imports inside sync_to_disk_sync()
  to avoid ~40ms startup cost when PDF generation is not used
- utils.py: Convert OpenAIBadRequestError and GroqBadRequestError to lazy
  loaders to avoid loading SDKs at module level

This improves import time for users who don't use OpenAI provider,
especially when using Anthropic, Google, or other providers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 01:48:47 +09:00
mertunsall a64c82ef2c sanitize everything now 2025-11-14 11:13:57 -08:00
reformedot bc8407ac8d refactor: refine exception propagation in create_task_with_error_handling
- Introduced a variable to hold exceptions for re-raising outside the try-except block, ensuring proper propagation to the event loop.
- Updated comments for clarity on the exception handling process in background tasks.
2025-11-12 20:46:06 -08:00
reformedot e7b8f2987c refactor: improve exception handling in create_task_with_error_handling
- Updated the logging behavior for exceptions in background tasks to log at warning level and re-raise exceptions for better propagation to the event loop's exception handler.
- Enhanced clarity in comments regarding exception retrieval and handling.
2025-11-12 20:36:47 -08:00
reformedot 77d7f161fb refactor: enhance session management and error handling in BrowserSession
- Improved the `create_task_with_error_handling` function to allow for better exception logging and retrieval based on the `suppress_exceptions` parameter.
- Updated `SessionManager` to implement event-driven recovery for stale agent focus, replacing polling with efficient event handling.
- Refactored session retrieval methods to ensure focus validation and recovery are handled automatically.
- Enhanced logging for recovery processes and session management to provide clearer insights into state changes and errors.
- Adjusted various watchdogs to utilize the new session management methods, ensuring they correctly handle focus validation and session retrieval.
2025-11-12 19:42:24 -08:00
reformedot b4e9ffa984 refactor: implement error handling for asyncio tasks across various components
- Introduced a utility function `create_task_with_error_handling` to manage asyncio tasks with proper exception logging and suppression options.
- Updated multiple components, including `SessionManager`, `BrowserSession`, and various watchdogs, to utilize the new error handling mechanism for background tasks.
- Enhanced overall robustness of asynchronous operations by ensuring exceptions are logged and handled appropriately, improving maintainability and debugging capabilities.
2025-11-11 17:27:54 -08:00
Cursor Agent c4ed783a2b Refactor: Make version check async and use httpx
Co-authored-by: mamagnus00 <mamagnus00@gmail.com>
2025-09-19 04:12:48 +00:00
Gregor Žunič b5aebf0b03 shorten super long URLs 2025-09-05 15:42:41 -07:00
Nick Sweeting 95e9049faf Update browser_use/utils.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-08-04 22:57:56 -04:00
Nick Sweeting 659c5145f6 more event-driven refactoring 2025-08-01 02:42:01 -07:00
Alezander9 87ab3c20fb address cubic comments 2025-07-30 17:31:22 -07:00
Alezander9 18876f222e add helper function for getting agent trace, remove references to deprecated gpt-4o 2025-07-29 18:11:56 -07:00
Nick Sweeting 48086d0cdd use retry decorator from bubus 2025-07-08 03:16:22 -07:00
Nick Sweeting 11b187576e fix multiprocess semaphore scope stale 2025-07-08 02:54:13 -07:00
Nick Sweeting b2a84b2296 fix tests and other improvements 2025-07-08 02:32:03 -07:00
Nick Sweeting 28ca11319c add overload warnings 2025-06-27 01:59:38 -07:00
Nick Sweeting 1415562d6e add portalocker multiprocess semaphore 2025-06-26 23:53:28 -07:00
Nick Sweeting 4b2d7c270b fix tests 2025-06-26 07:30:03 -07:00
Nick Sweeting fc075c0152 use retry decorator for locking and timeouts instead ofmanual logic 2025-06-26 07:07:13 -07:00
Gregor Žunič 7a10ae0c96 Squashed commit langchain to native 2025-06-24 12:26:55 +02:00
Nick Sweeting 6c695d0a42 more lint and hint fixes 2025-06-21 05:39:17 -07:00
Nick Sweeting 340bafdd29 move old tests to old folder 2025-06-21 04:47:46 -07:00
Nick Sweeting 3cf9f3410c fix config issues 2025-06-21 04:03:58 -07:00
Nick Sweeting f4b1987761 fixes 2025-06-21 03:43:37 -07:00
Nick Sweeting 6ede8842e5 Update browser_use/utils.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-06-21 06:38:57 -04:00
Nick Sweeting 49e9fd4ff2 move env var config to utils file 2025-06-21 03:14:46 -07:00
Magnus Müller ad446f5769 Merge branch 'main' into mert/new_everything 2025-06-19 23:45:41 +02:00
Nick Sweeting 36c88b760c Consolidate sync related code (#2009) 2025-06-19 07:41:28 -07:00
Nick Sweeting 778536a3ce move all sync code into sync dir 2025-06-19 01:28:22 -07:00
Magnus Müller 0b6ebea431 Merge branch 'main' into mert/new_everything 2025-06-19 09:49:43 +02:00
Yasith Jayawardana e2e11966d3 Merge branch 'main' into typing-improvements 2025-06-18 21:20:47 -04:00
Nick Sweeting 474476f0ae switch to external bubus lib 2025-06-18 01:41:16 -07:00
mertunsall 0c34c399db Merge branch 'main' into mert/new_everything 2025-06-17 11:19:06 +02:00
yasithdev 8ea4b4c71a centralize playwright/patchwright imports, and update typing/checks to reduce lint errors 2025-06-16 22:57:20 -04:00
Nick Sweeting eb2807e779 fix unbound logger 2025-06-10 02:24:27 -07:00
Nick Sweeting 930a7aa4de use self.logger for timing log lines 2025-06-10 00:24:50 -07:00
Magnus Müller d998e95ac0 Improve error handling in LLM API calls by appending exception messages to LLMException. This change enhances the clarity of error logs in both utils.py and service.py, facilitating better debugging and traceability. 2025-06-09 22:47:03 +02:00
Magnus Müller 52d4191ba9 Merge branch 'main' into mert/new_everything 2025-06-07 17:58:09 +02:00
Nick Sweeting 885e3bcfba dont prepent v to version numbers 2025-06-05 22:47:16 -07:00
Nick Sweeting cf6a0d9fbf improve chrome launch error handling when user_data_dir is bad 2025-06-05 18:22:02 -07:00
Nick Sweeting a2b97b64a9 lint fixes 2025-06-05 02:33:57 -07:00
Nick Sweeting 8593eebf7a Update browser_use/utils.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-06-05 05:30:30 -04:00
Nick Sweeting 8f6f907247 use async lock to protect BrowserSession.start from race conditions 2025-06-05 02:24:07 -07:00
Magnus Müller 3a9788c1d5 Implement centralized LLM error handling in utils.py and update agent service to utilize this new functionality, improving error management and code clarity. 2025-06-02 15:16:31 +02:00