Commit Graph

145 Commits

Author SHA1 Message Date
Nick Sweeting
6bc1f7985f more type hint fixes 2025-06-21 04:56:27 -07:00
Nick Sweeting
340bafdd29 move old tests to old folder 2025-06-21 04:47:46 -07:00
Nick Sweeting
b67be37490 fix type hint errors 2025-06-21 04:35:24 -07:00
Mert Unsal
97bd9fb3d2 Update browser_use/agent/message_manager/service.py
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-06-20 21:31:51 +02:00
mertunsall
f3b406f42a Quick Fix to History 2025-06-20 21:28:06 +02:00
mertunsall
9ae6354b76 - Change reasoning rules in system prompt
- Flatten AgentOutput to get rid of current_state
- Add agent initialization in history.
- Update the example tool call.
- Add a current_state property to AgentOutput for compatibility.
2025-06-20 18:55:04 +02:00
Magnus Müller
907867f976 Refactor agent history update logic to handle None model_output case, ensuring proper logging and description formatting for failed parsing scenarios. 2025-06-20 09:28:23 +02:00
Magnus Müller
eda5140363 Improve error logging in message manager by appending ellipsis to truncated error messages for better clarity in action results. 2025-06-20 08:27:46 +02:00
Magnus Müller
3af0a37e71 Rename step information 2025-06-20 07:47:35 +02:00
Magnus Müller
8b93dc626f Only show task once 2025-06-20 07:35:02 +02:00
Magnus Müller
2ee381d283 Refactor message_manager tests to use a temporary file system path, enhancing isolation and reliability of test cases. 2025-06-20 00:18:48 +02:00
Magnus Müller
831682e2a3 Add FileSystem dependency to message_manager tests 2025-06-20 00:13:06 +02:00
Magnus Müller
90ae26316e Refactor ActionResult to standardize the inclusion of extracted content, replacing update_only_read_state with include_extracted_content_only_once across multiple services. This change enhances clarity in memory management and ensures consistent handling of extracted content. 2025-06-19 23:18:30 +02:00
Magnus Müller
ce880e5e35 Refactor ActionResult handling across multiple services to standardize the use of long_term_memory, replacing memory references. Update related logic to ensure extracted content is consistently managed for improved clarity and error handling. 2025-06-19 23:11:55 +02:00
Magnus Müller
477ec27a86 Refactor action result handling in service.py to improve clarity and logic flow. Update conditions for including extracted content and memory in action results. 2025-06-19 22:43:00 +02:00
Magnus Müller
cdd1bd7f1c Update agent_history_description format in service.py to include user_request tags for improved clarity in message logging. 2025-06-19 18:52:08 +02:00
mertunsall
927b286d71 Handle sensitive data in agent state and handle user request being visible in agent history in case of update 2025-06-18 15:53:35 +02:00
mertunsall
463f147e6a Refactor add_new_task method in service.py to update agent history description with new user requests, removing the previous message creation logic. 2025-06-18 14:30:04 +02:00
mertunsall
f7a8e99f13 Enhance user guidance in data extraction: add reminder to save information during read state and refine instructions for structured data extraction to clarify usage and file saving practices. 2025-06-17 15:10:07 +02:00
mertunsall
34d2894d56 Refactor MessageManager initialization: remove unnecessary agent history description, adjust message formatting, and clean up commented-out code for clarity. 2025-06-17 14:49:03 +02:00
mertunsall
0c34c399db Merge branch 'main' into mert/new_everything 2025-06-17 11:19:06 +02:00
Nick Sweeting
3c65acf225 improve conversation saving 2025-06-13 17:02:29 -07:00
Nick Sweeting
582c039c15 make save_context and other file operations async, setup traces and other dirs on startup 2025-06-12 18:38:12 -07:00
Magnus Müller
e8f2467ab2 Refactor action result handling in message_manager and controller services
Updated the logic for processing action results in service.py files. Changed the conditional check for memory in message_manager to use 'elif' for clarity. In controller, modified the return statement to handle errors more effectively by returning an ActionResult with the error message instead of memory, improving error logging and debugging capabilities.
2025-06-11 11:36:06 +02:00
Magnus Müller
18a97acf76 Enhance agent state representation and update system prompt documentation
Refactored the agent state output in prompts.py to include XML-like tags for user requests, file system details, and state descriptions, improving structure and readability. Updated system prompt documentation to clarify memory tracking instructions, emphasizing the importance of counting pages visited and items found for better progress tracking.
2025-06-10 08:51:04 +02:00
Magnus Müller
1875c34416 Refactor argument naming and enhance success message in service.py
Updated the key from 'arguments' to 'args' for consistency in the tool call structure. Revised the success message to specify that data was written to 'todo.md' and 'github.md', improving clarity and user feedback.
2025-06-10 08:04:02 +02:00
Magnus Müller
1c7b41eacd Update argument naming and message content in service.py
Changed the key 'args' to 'arguments' for clarity in the tool call structure. Additionally, updated the success message to reflect that data was written to both 'todo.md' and 'github.md', improving the accuracy of feedback provided to users.
2025-06-10 07:59:35 +02:00
Magnus Müller
c0df2feb11 Enhance system prompt and message formatting in service.py
Updated the system prompt documentation to clarify user request handling and added specific instructions for open-ended tasks. Modified message formatting in service.py to include XML-like tags for context, sensitive data, and user requests, improving structure and readability of messages. This change aims to enhance the clarity of communication between the agent and users.
2025-06-10 07:51:12 +02:00
Magnus Müller
8481e2cc04 Add control character handling in JSON extraction utility
Enhance the `extract_json_from_model_output` function to fix control characters in JSON strings before parsing. Introduced a new helper function, `_fix_control_characters_in_json`, to ensure valid JSON formatting by escaping control characters within string values. This improves the robustness of JSON parsing and error handling in the utility.
2025-06-09 23:11:46 +02:00
Magnus Müller
543ee984b3 Improve error handling in JSON parsing by including the exception message in the ValueError. Added debug logging for successful model output parsing in utils.py to enhance traceability and debugging. 2025-06-09 18:47:37 +02:00
Magnus Müller
469e859647 Enhance JSON extraction in utils.py to support function parameter retrieval. Added logic to extract the value of 'params', 'args', 'kwargs', or 'parameters' when the 'function' key is present, improving the handling of model outputs. 2025-06-09 18:38:39 +02:00
Magnus Müller
90a4d858f1 Enhance JSON extraction in utils.py to handle stray characters and ensure valid JSON parsing. Added logic to count braces and trim content to the last valid JSON position if necessary, improving robustness in JSON handling. 2025-06-09 11:47:19 +02:00
Magnus Müller
52d4191ba9 Merge branch 'main' into mert/new_everything 2025-06-07 17:58:09 +02:00
Anirudha619
380475e4d3 remove print statement 2025-06-06 00:12:20 +05:30
Anirudha619
5033d643cc fix domain based sensitive_data 2025-06-06 00:04:33 +05:30
Anirudha619
8a1d3a6245 temp fix domain based sensitive data 2025-06-05 01:18:40 +05:30
mertunsall
73a13bc2d9 further limit the error message 2025-06-03 18:47:28 +02:00
mertunsall
d426c53c1b update to system prompt and agent state 2025-06-03 18:17:05 +02:00
mertunsall
5e44c9b191 small fixes, change system prompt 2025-06-03 16:18:21 +02:00
Magnus Müller
3018f59654 Enhance JSON extraction in model output by supporting BaseMessage type and improving HTML tag removal 2025-06-02 14:19:53 +02:00
Magnus Müller
77ff34ea64 Limit error message length in action results to 400 characters for improved logging clarity 2025-06-02 14:19:20 +02:00
mertunsall
b505ac87cb bugfix for ActionResult when the page changes, update examples 2025-06-01 12:27:24 +02:00
mertunsall
bcdc522ade Nuke it all 2025-05-31 17:30:21 +02:00
Nick Sweeting
78a1bef57a more test cleanups 2025-05-26 19:07:25 -07:00
Nick Sweeting
c41cb56fae replace example output in history log with placeholder to avoid confusion 2025-05-26 17:36:25 -07:00
Nick Sweeting
08726575ac simplify close messages 2025-05-23 22:05:19 -07:00
Nick Sweeting
bad374ba68 make logging more error resilient 2025-05-23 21:36:53 -07:00
Nick Sweeting
f6ca4e13a3 massively improve logging experience and add loading animation on browser startup 2025-05-23 00:48:52 -07:00
Nick Sweeting
fbf52be11b improve logging and use scheme matching for google urls 2025-05-22 23:25:17 -07:00
Nick Sweeting
6b8360c475 better logging 2025-05-22 23:17:21 -07:00