Commit Graph

1537 Commits

Author SHA1 Message Date
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
shudaizi1989 5b08613a27 Fix:mutable default argument. (#901) 2025-03-02 12:52:30 -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
Christian Clauss 4abfaa6213 pre-commit run pre-commit-hooks --all-files 2025-02-27 12:21:42 +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
Magnus Müller 84f5f1cf8b Instruction for unfinished tasks 2025-02-23 09:15:40 -08:00
Magnus Müller 88f018ad81 Update system prompt and service for task completion handling
- Modify system prompt to clarify done action usage when max steps are reached
- Update service to provide more descriptive action description for task completion
- Add explicit handling for task success status in done action
- Enhance documentation for done action to indicate task completion state
2025-02-23 09:03:59 -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
Magnus Müller b6e18197a5 Rename total_tokens to current_tokens in message history tracking 2025-02-22 22:31:37 -08:00
Magnus Müller e503f586f0 Add step metadata tracking with timing and token information 2025-02-22 22:29:07 -08:00
Magnus Müller 81aa4fc0cf Reorganize Agent initialization order and improve component setup 2025-02-22 22:04:13 -08:00
Magnus Müller c01acaacdf Modify errors method to track errors per step in agent history 2025-02-22 21:58:37 -08:00
Magnus Müller 31fe2cfcbb Add method to get number of steps in agent history 2025-02-22 21:55:43 -08:00
Magnus Müller 10d4070d54 Remove todo 2025-02-22 21:51:58 -08:00
Magnus Müller 268ac9a98b for models without tool calling, add available actions to context 2025-02-22 21:51:33 -08:00
Magnus Müller c2f35df9a7 Include TODO 2025-02-22 21:47:19 -08:00
Magnus Müller 1dfc72aac4 Wait function 2025-02-22 10:33:52 -08:00
Magnus Müller 1f5d8bf830 Spelling prompt 2025-02-22 08:11:13 -08:00
Magnus Müller 7c0df13a4d Remove [] for none interactive 2025-02-21 22:34:09 -08:00
Magnus Müller 8b1a292bec Dont use , 'detail': 'low' 2025-02-21 21:37:13 -08:00
Magnus Müller a47ea601fa Fix error in state if error ends with \n 2025-02-21 19:12:08 -08:00
Magnus Müller e3c2364ef1 Merge branch 'main' into System-prompt 2025-02-21 18:42:07 -08:00
Magnus Müller 2cfe937724 Include model for page_extraction_llm 2025-02-21 18:40:04 -08:00
Magnus Müller a219346cf0 Fixing json {} 2025-02-21 18:22:01 -08:00
Magnus Müller 080c605868 Reduced prompt by 300 tokens 2025-02-21 18:13:20 -08:00
Magnus Müller f205b727a0 New file for system prompt 2025-02-21 17:49:31 -08:00
Magnus Müller a35b4e02cc Improve input_format 2025-02-21 17:42:55 -08:00
Magnus Müller 925a47ed8f Remvoe default_action_description because its in the schema 2025-02-21 17:05:34 -08:00
Magnus Müller 6dfe07f1a3 Delete page_summary 2025-02-21 16:56:46 -08:00
Magnus Müller 758dd75bbe Make test compatible 2025-02-21 16:56:35 -08:00