Commit Graph

969 Commits

Author SHA1 Message Date
Carlos A. Planchón 78be25ac83 Update browser_use/agent/service.py
Co-authored-by: Nick Sweeting <github@sweeting.me>
2025-03-27 18:49:21 -03:00
Nick Sweeting 26011fafbb verify LLM API keys work on startup 2025-03-27 14:45:52 -07:00
Carlos A. Planchón 345494f51a Merge branch 'browser-use:main' into direct_html_manipulation 2025-03-27 18:23:40 -03:00
Anish Hiranandani 45ab623bff moved llm api env vars dict to agent views 2025-03-27 09:03:56 -07:00
Anish Hiranandani 9ea07efdc4 support for reasoning models o1, o1-mini, etc for planner 2025-03-26 19:44:09 -07:00
Anish Hiranandani d6133380e7 Merge branch 'main' into feature/exception-handling-llm-call 2025-03-26 18:04:54 -07:00
Anish Hiranandani 732cedae57 Added LLMException to planner call 2025-03-26 18:00:47 -07:00
Daniele Roccaforte 1c7d543bfd Merge branch 'main' of https://github.com/browser-use/browser-use into ollama-failed-parsing-error
* 'main' of https://github.com/browser-use/browser-use: (269 commits)
  fix for follow_up_tasks example
  fix for current page detection grabbing a chrome extension service worker
  add support for close_tab action
  disable cross-origin iframes support for now
  fix: update hatch build includes for correct package structure
  fix the simple example
  typofix
  fix error: name 'browser_class' is not defined
  Updated readme
  streamlined to match other examples
  Added env variables in example
  Update custom-functions.mdx
  fix spaces vs tabs
  Update supported-models.mdx
  fix chrome connecting to extension context by accident
  fix broken BrowserConfig chrome_instance_path kwarg
  simplify test task
  fix removing contenteditable check by accident
  tweak salesforce test cross-origin iframe task
  ignore invisible and irrelevant cross-origin-iframes
  ...
2025-03-26 23:45:07 +01:00
Anish Hiranandani 74223fcf89 integrated check env in agent service 2025-03-26 15:20:40 -07:00
Anish Hiranandani 96456958fa Update browser_use/agent/service.py
change LLMException error message

Co-authored-by: Nick Sweeting <github@sweeting.me>
2025-03-26 14:39:36 -07:00
Anish Hiranandani b4c03a0328 Handles invalid and empty env variables for openai and azure openai 2025-03-25 22:48:40 -07:00
lynn ee6a625160 fix: Move HTTPX client cleanup from agent to browser close to avoid breaking multi-agent task 2025-03-24 12:55:00 +08:00
Magnus Müller 1559ea5695 Merge pull request #1054 from vonjackustc/vonjackustc-patch-1
Support QwQ-32b
2025-03-23 08:51:00 -07:00
Carlos A. Planchón 9b22a59f9d Merge branch 'browser-use:main' into direct_html_manipulation 2025-03-23 11:16:16 -03:00
Magnus Müller 514207a5bc Merge pull request #1108 from SmartManoj/browser
Simplify browser setup
2025-03-23 07:04:37 -07:00
Magnus Müller 7668fa15be Merge branch 'main' into fix-callbak-agent-not-working 2025-03-23 06:53:20 -07:00
மனோஜ்குமார் பழனிச்சாமி f7566b975e fix import 2025-03-23 11:26:08 +05:30
DarkPhoenix2704 71bc8ed0ba fix: allow callback to be sync functions 2025-03-23 09:24:06 +05:30
மனோஜ்குமார் பழனிச்சாமி f2a38ce326 Simplify browser setup 2025-03-23 07:48:29 +05:30
Magnus Müller 3e871c6359 Merge pull request #895 from adamdelezuch89/main
fix: close httpx connections to avoid memory leaks
2025-03-22 18:51:33 -07:00
vonjackustc 1b7fa09ccf Support QwQ-32b 2025-03-18 15:06:47 +08:00
Carlos Andrés Planchón Prestes f8c81376ce Updating to match upstream. 2025-03-14 22:13:15 -03:00
Carlos Andrés Planchón Prestes 6b76eb6ffe Adding before_step_func. 2025-03-14 21:25:52 -03:00
codenoid d68d1f5019 Clean up unused import and remove trailing whitespace
- Removed unused 're' import from message_manager/utils.py
- Removed trailing whitespace in agent/service.py
2025-03-11 12:24:27 +07:00
codenoid 10f0189049 Improve DeepSeek model handling and think tag removal
- Enhanced model name matching for DeepSeek models using 'in' operator
- Improved think tag removal to handle stray closing tags
- Updated message conversion and plan processing for DeepSeek models
2025-03-11 12:10:11 +07:00
takuto yuki d4b54c8e29 Update Add tokens logger 2025-03-08 20:15:02 +09:00
Alin Jiang f7f193a61d Detect index change caused by page change in multi_act 2025-03-05 00:45:20 -08:00
Eshwar Tangirala d5cab0a9e4 Fixed typo (#898) 2025-03-02 16:24:40 -08:00
shyanilMishra 2d448ccbc1 fix: correct method for adding max steps error to agent history 2025-03-02 23:39:33 +05:30
adamdelezuch89 14be261266 fix: close all resources to avoid memory leaks
Fixed an issue where the event loop was closing before all HTTPX connections were properly terminated, causing resource warnings and potential memory leaks. The problem occurred because browser-use was shutting down threads before Playwright had fully closed its HTTP connections. Now, before shutting down the agent, all HTTPX processes are explicitly closed, ensuring a clean shutdown and preventing unclosed transport warnings.
2025-02-27 14:44:54 +01:00
Carlos Andrés Planchón Prestes ded1addb95 Checking if after_step_func is None. 2025-02-24 01:26:34 -03:00
Magnus Müller 2a6416f272 Add flexible system prompt customization options
- Modify SystemPrompt class to support optional system message override and extension
- Update Agent and AgentSettings to include new system prompt customization parameters
- Update documentation and example to demonstrate new system prompt customization methods
- Remove deprecated system_prompt_class parameter
- Provide two ways to customize system prompt: extend or override completely
2025-02-23 12:25:33 -08:00
Magnus Müller 5f84512d74 Enhance last step warning message clarity
- Add example for setting success to false when task is not fully completed
- Provide more explicit guidance on reporting task completion status
- Improve readability of last step instructions
2025-02-23 09:56:41 -08:00
Magnus Müller 17fcfe2559 Refine last step warning message for agent service
- Update last step instructions to emphasize single action requirement
- Clarify guidance for using the "done" action
- Improve wording to highlight task completion and success status reporting
2025-02-23 09:53:19 -08:00
Magnus Müller 65e165c915 Simplify last step instructions for agent service
- Refactor last step warning message to be more concise and direct
- Clarify instructions for using the "done" function
- Improve guidance on task completion and success status reporting
2025-02-23 09:48:35 -08:00
Magnus Müller d129a7f27a Refine last step instructions and model testing configuration
- Update last step warning message in service.py to provide clearer, more explicit instructions for the "done" action
- Modify test_models.py to comment out DeepSeek model and adjust model testing configuration
- Enhance guidance on task completion, success status, and action requirements
2025-02-23 09:43:55 -08:00
Magnus Müller ac07642b6c Improve type safety and clarify task completion instructions
- Add type hints and type ignore comments in service.py for image message handling
- Update system prompt to provide clearer guidance on done action usage
- Refine action description for done action in controller service
- Enhance documentation for task completion scenarios
2025-02-23 09:31:01 -08:00
shyanilMishra 9e14269969 fix(agent): Add max steps error to agent history #439
- Adds error entry to history when max steps limit is reached
- Ensures consistent error tracking in Agent History List
- Improves error visibility for debugging purposes

Fixes #439
2025-02-23 22:26:54 +05:30
Magnus Müller 58cd755b8f Refine action parsing and validation in agent service
- Update service to conditionally limit actions based on max_actions_per_step
- Modify views to use json_schema_extra for action validation
- Improve action list handling to prevent unnecessary slicing
2025-02-23 08:29:21 -08:00
Magnus Müller 12ed8da8fa Removed parameter 2025-02-23 08:21:04 -08:00
Magnus Müller bdb59feab2 Refactor agent service tool calling and message handling
- Add support for 'raw' and 'json_mode' tool calling methods
- Introduce new methods for setting message context and tool calling method
- Modify input message conversion for specific model names
- Update tool calling method detection logic
- Extend ToolCallingMethod type to include new methods
2025-02-23 08:13:47 -08:00
Magnus Müller 601151d159 Refactor task completion logging in Agent service
- Extract common task completion logging into a new `log_completion()` method
- Simplify duplicate logging code in `run()` and `run_with_max_steps()` methods
- Maintain existing logging behavior for task completion status
2025-02-23 07:49:41 -08:00
Magnus Müller d881b9f61d Enhance agent task completion and max steps handling
- Add support for creating a done-only action model
- Modify logging to distinguish between successful and unfinished tasks
- Update agent to switch to done action model when max steps are reached
- Improve system prompt to clarify done action usage in max steps scenario
- Extend registry action model creation to support filtering actions
2025-02-23 07:46:21 -08:00
Magnus Müller cc34c45f65 Improve version detection
- Enhance browser-use version detection to prioritize git repository check
2025-02-23 07:24:14 -08:00
Magnus Müller e1b51196a0 Enhance agent history tracking
- Update telemetry event to include more comprehensive agent performance metrics
- Modify `AgentEndTelemetryEvent` to capture total input tokens and duration
- Refactor `is_successful()` method to return `None` if agent is not done
- Adjust `ActionResult` default success value to `None`
2025-02-23 07:18:30 -08:00
Magnus Müller 52e8c96d45 Track token count before model output generation
- Capture token count before generating model output
- Store tokens in a local variable to ensure accurate input token tracking
- Modify metadata logging to use the pre-computed token count
2025-02-23 07:07:31 -08:00
Magnus Müller ddd8648aaa Refactor message position handling and improve last step messaging
- Update `_add_message_with_tokens` and `add_message` methods to support `None` as default position
- Modify last step warning message in agent service
- Add logging for last step completion
- Improve type hints for message position parameters
2025-02-23 07:03:01 -08:00
Magnus Müller c07b5c9a94 Add last step warning and enhance action result tracking
- Introduce warning message for the last step in the agent
- Add `success` parameter to `ActionResult` and `DoneAction`
- Modify `AgentStepInfo` to check for last step
- Update `AgentHistoryList` methods to handle optional values and success status
2025-02-22 23:43:41 -08:00
Magnus Müller 5854644767 Rename tokens to input_tokens in agent history tracking 2025-02-22 22:39:29 -08:00
Magnus Müller b44afd5107 Add step number to metadata and enhance AgentHistoryList with token usage methods 2025-02-22 22:35:36 -08:00