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.
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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`
- 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
- 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
- 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