Commit Graph

363 Commits

Author SHA1 Message Date
Magnus Müller
ec68a7e28e Edit result object 2025-07-08 10:32:17 +02:00
Magnus Müller
81e5fb49a2 Remove logging 2025-07-08 10:27:01 +02:00
Magnus Müller
6e7880f0fc Scrolling in container works 2025-07-08 10:13:22 +02:00
Cursor Agent
168719561e Add element-specific scrolling with optional index parameter
Co-authored-by: mamagnus00 <mamagnus00@gmail.com>
2025-07-08 07:56:57 +00:00
Daniel T.
25a40fb179 Removes redundant scrolling instruction
Eliminates the guideline about scrolling with num_pages parameter
from the browser usage prompts to simplify navigation instructions.

Refactors parameter handling in registry action validation by removing
unnecessary parameter cleaning, streamlining the process.
2025-07-07 23:05:09 +02:00
Daniel T.
c5a3c0cf2e Refines dynamic page state calculations
Replaces static page statistics with dynamic calculations for
viewport and scroll position metrics. Simplifies code logic in
scroll handling by removing unnecessary defaults for page
scrolling. Improves readability and reliability of page
scroll operations by requiring explicit num_pages parameter.

Enhances page-view consistency and user interaction handling.
2025-07-07 21:22:12 +02:00
Daniel T.
f6b45837e9 Removes redundant return statement after retry
Eliminates an unnecessary return check for action_result
after evaluating the window height, simplifying the code
and ensuring the correct flow of the scroll retry logic.
2025-07-07 19:12:57 +02:00
Daniel T.
55c392a8a3 Merge remote-tracking branch 'upstream/main' into enhancement/improved-scroll-action 2025-07-07 19:04:35 +02:00
Daniel T.
539274a7d4 Updates scroll functionality to use page units
Replaces pixel-based scrolling with page unit determination, allowing for more intuitive scroll actions by specifying the number of pages. Adjusts related documentation, examples, and tests to reflect this change for improved code consistency and user experience.
2025-07-07 18:21:37 +02:00
Daniel T.
b5d0d6577c Handles params conflict in action model creation
Removes special parameters from params to avoid
double keyword argument conflicts by utilizing
a separate special_context mechanism. This ensures
only essential parameters are validated in the Pydantic
action model, enhancing robustness and readability.
2025-07-07 18:00:04 +02:00
Daniel T.
a6dc763f82 Removes redundant whitespace in action result
Streamlines code by eliminating unnecessary line
breaks in action result construction for clarity.
2025-07-07 17:39:06 +02:00
Daniel T.
eb7c7fa2bc Enhances scroll action testing
Removes unnecessary Field description in ScrollAction to streamline code.

Implements additional test cases for varying scroll amounts, improving test coverage and validation of scrolling behavior in the integration tests.
2025-07-07 17:34:57 +02:00
Daniel T.
610419c9d7 Enhances scroll functionality with pixel control
Introduces ability to scroll by a specific number of pixels
via a new 'amount' parameter, defaulting to one page height
if unspecified. Updates relevant documentation and examples
to reflect these changes, enhancing navigation precision.

Improves user experience by allowing finer control over page
scrolling actions.

Relates to user feedback on scroll improvements.
2025-07-07 17:19:59 +02:00
Magnus Müller
e05cf50646 Update error msg 2025-07-07 16:50:04 +02:00
Magnus Müller
da22746577 Increase multi act timeouts 2025-07-07 16:44:15 +02:00
Magnus Müller
ea481972b1 Merge branch 'main' into better-error-handling-and-lmnr-inclusion 2025-07-07 15:33:08 +02:00
Magnus Müller
84d7504c5e Add error handling for action execution in service.py
- Wrapped the action execution call in a try-except block to catch exceptions and return an ActionResult with the error message.
- Ensured that Laminar's output is set only if it is not None, improving the robustness of the function.
2025-07-07 15:21:26 +02:00
mertunsall
daf1754d58 move tests 2025-07-07 13:43:03 +02:00
Magnus Müller
ab36dd8feb Comment out error handling and logging in Registry class to reduce verbosity during action retries. 2025-07-07 13:39:21 +02:00
Magnus Müller
569944eecb Merge remote-tracking branch 'origin/main' into include-lmnr 2025-07-07 12:22:05 +02:00
Magnus Müller
d03196c09c Merge remote-tracking branch 'origin/main' into include-lmnr 2025-07-06 23:42:14 +02:00
AI Christianson
a5e3634900 Fix linter errors. 2025-07-06 17:32:04 -04:00
AI Christianson
8430f21cf6 Fix linter errors. 2025-07-06 17:28:41 -04:00
AI Christianson
051054decd Fix bug where schema optimizer was stripping the title field from our output schema. 2025-07-06 17:28:41 -04:00
Magnus Müller
d4576bb128 Update browser_use/controller/service.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-06 21:18:46 +02:00
Magnus Müller
78be7f9a8e update extract_structured_data description 2025-07-06 21:14:45 +02:00
Magnus Müller
ef36632ccf Refactor observability imports to maintain consistency across modules 2025-07-05 23:12:05 +02:00
Magnus Müller
a4c9b992ba Add observability module for browser-use with optional lmnr integration and debug mode support 2025-07-05 23:08:00 +02:00
Magnus Müller
ba11502ac5 Fix import 2025-07-05 18:13:14 +02:00
Magnus Müller
05eeaf877a Raise errors instead of actionResult to track with laminar 2025-07-05 18:01:10 +02:00
Magnus Müller
af0487ee38 Observe execute_action with lmnr 2025-07-05 17:35:47 +02:00
Magnus Müller
09d336556f Update error logging to not confuese agent when site is not available 2025-07-05 16:03:27 +02:00
Magnus Müller
99ef62748f Add lmnr tracing 2025-07-05 15:23:38 +02:00
Magnus Müller
face6a599b Enhance observability in browser and agent services
- Added `@observe` decorators to various methods in `service.py`, `session.py`, and `controller.py` to improve tracking of actions and state changes.
- Updated method signatures to include observability features for better debugging and monitoring.
- Adjusted retry logic for certain actions to enhance reliability and performance.
2025-07-05 14:44:43 +02:00
mertunsall
550a2a2552 feat: enhance file handling capabilities with JSON and CSV support
- Added new file types: JsonFile and CsvFile to the file system.
- Updated read_file method to handle external files with .json and .csv extensions.
- Modified write_file action to allow .json and .csv file extensions in addition to .md and .txt.
- Introduced pypdf dependency for PDF file handling.

This update improves the flexibility of file operations within the application.
2025-07-05 01:36:04 +02:00
Magnus Müller
680b7e7346 refactor: enhance error handling in action execution
- Updated retry logic to handle page errors more effectively by capturing the current page context before retrying the action.
- Improved error messaging to provide clearer feedback when actions fail due to page navigation or closure.
2025-07-04 17:10:59 +02:00
Magnus Müller
22f89efae4 refactor: reduce timeouts for various operations to improve responsiveness
- Updated timeouts for action execution, step processing, and screenshot operations to more aggressive values (e.g., reduced from 60s to 20s for actions, 30s to 10s for DOM processing).
- Adjusted retry logic and timeout settings for screenshot and iframe content extraction to enhance performance and reduce potential hangs.
- Improved logging for timeout events to provide clearer feedback on operation failures.
2025-07-04 14:30:54 +02:00
Magnus Müller
2045ad747c Improve logging 2025-07-04 13:22:38 +02:00
Magnus Müller
b40402e162 Improved timeout for extract data 2025-07-04 13:03:10 +02:00
Magnus Müller
3dc6b44e03 Implement timeout protection for content extraction and LLM calls
- Added timeout handling for page content extraction with a 30-second limit, returning an error message on timeout.
- Introduced timeout protection for iframe content extraction with a 10-second limit, logging a warning on timeout.
- Implemented a 60-second timeout for LLM calls, logging a warning if the call exceeds this duration.
- Enhanced error handling to provide clearer feedback on extraction failures.
2025-07-04 11:14:49 +02:00
Magnus Müller
db67c1e4ff Refactor error handling in Registry class
- Commented out retry logic for page errors to simplify error handling.
- Maintained the raise of the original exception for clarity in error reporting.
2025-07-04 00:18:04 +02:00
Magnus Müller
c53cc4d2d1 Refactor error handling in ActionResult
- Simplified the return statement for site unavailable errors by removing redundant parameters while maintaining functionality.
- Improved code readability and consistency in error handling.
2025-07-03 23:22:34 +02:00
Magnus Müller
6d28b23f6a Enhance error handling in action execution
- Reintroduced action retry mechanism to handle transient errors during action execution.
- Added logging for failures and implemented a retry attempt with context preservation for better resilience.
2025-07-03 22:12:27 +02:00
Magnus Müller
f20022b6c7 Remove action retry 2025-07-03 21:05:38 +02:00
Cursor Agent
ee2c1d2ad0 Remove optional xpath from ClickElementAction model
Co-authored-by: mailmertunsal <mailmertunsal@gmail.com>
2025-07-02 07:43:21 +00:00
Cursor Agent
c24d5b4320 Remove optional xpath parameter from InputTextAction model
Co-authored-by: mamagnus00 <mamagnus00@gmail.com>
2025-07-01 21:51:05 +00:00
mertunsall
ef30980fe9 add extract_links to structured data 2025-07-01 10:34:23 +02:00
mertunsall
649b2d5277 Refactor URL navigation and scrolling actions
- Updated GoToUrlAction to include a new_tab parameter for opening URLs in a new tab or navigating in the current tab.
- Removed the OpenTabAction as its functionality is now integrated into GoToUrlAction.
- Enhanced scroll action to allow scrolling up or down based on a boolean parameter.
- Cleaned up commented-out code related to accessibility tree retrieval for better readability.
2025-06-29 22:48:40 +02:00
mertunsall
dd0f65b956 Merge branch 'main' into mert/remove_save_pdf 2025-06-29 21:57:41 +02:00
mertunsall
e9b8cfb9f7 remove the default save_pdf option 2025-06-29 21:51:56 +02:00