Commit Graph

95 Commits

Author SHA1 Message Date
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
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
mertunsall
129590672d small update to descriptions 2025-06-19 14:09:06 +02:00
Magnus Müller
0b6ebea431 Merge branch 'main' into mert/new_everything 2025-06-19 09:49:43 +02:00
mertunsall
bbc8d26f63 - Updated ActionResult to include an attachments field for displaying files in the done message.
- Enhanced logging in the Agent class to inform users about available attachments after task completion.
- Revised system prompt guidelines to clarify the use of text and files_to_display in the done action.
2025-06-18 14:24:27 +02:00
Nick Sweeting
d0ec528802 fixed events 2025-06-17 22:38:59 -07:00
mertunsall
0c34c399db Merge branch 'main' into mert/new_everything 2025-06-17 11:19:06 +02: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
52d4191ba9 Merge branch 'main' into mert/new_everything 2025-06-07 17:58:09 +02:00
Nick Sweeting
3c1e2a59d1 remove save_playwright_script_path entirely 2025-06-05 02:06:23 -07:00
mertunsall
bcdc522ade Nuke it all 2025-05-31 17:30:21 +02:00
Nick Sweeting
75f14c4784 checkpoint 2025-05-24 20:41:44 -07:00
Nick Sweeting
90dad4a39a refactor to use new BrowserSession model 2025-05-17 04:54:13 -07:00
Nick Sweeting
3e66046046 linter 2025-05-13 17:18:50 -07:00
Nick Sweeting
2b71f33f7e Support Azure OpenAI API GPT-4 (#1532) 2025-05-02 09:58:20 -07:00
Nick Sweeting
66b3c26df5 add pyupgrade to lint rules 2025-05-02 15:21:23 +08:00
Max Comperatore
9289e0f7f2 Support Azure OpenAI API GPT-4 2025-05-01 14:09:43 +00:00
RogelioRichmanAstronaut
0e5c676504 fix: Apply pre-commit linting fixes and improve Playwright example script execution
- Applied automated linting suggestions from pre-commit hooks, primarily updating type hints (e.g., Dict -> dict) and organizing imports.
- Refactored Playwright script execution in examples/features/playwright_script_generation.py to use asyncio.create_subprocess_exec for asynchronous handling and real-time log streaming, resolving ASYNC221 lint error and improving output visibility.
2025-04-30 00:05:36 -05:00
RogelioRichmanAstronaut
c7fbc7e071 Chore: Remove unnecessary LLM comments
Remove comments automatically added by the LLM in agent-related files.

Removed comments from:
- browser_use/agent/playwright_script_generator.py
- browser_use/agent/service.py
- browser_use/agent/views.py

These comments were redundant and cluttered the code.
2025-04-29 20:23:44 -05:00
Nick Sweeting
51f09b85aa Merge branch 'main' into feat/playwright-script-generation 2025-04-28 20:11:41 -07:00
Nick Sweeting
85586ef821 Merge branch 'main' into mathisarends-viadee/extend-system-prompt-for-planner-llm 2025-04-21 11:03:05 -07:00
Nick Sweeting
8b165d5997 fix ruff errors in other files 2025-04-21 10:56:06 -07:00
Nick Sweeting
738508d413 Merge branch 'main' into mathisarends-viadee/extend-system-prompt-for-planner-llm 2025-04-21 10:17:33 -07:00
Nick Sweeting
2b4397f1b8 Merge pull request #1417 from qkfang/azureopenai_env 2025-04-21 10:11:28 -07:00
RogelioRichmanAstronaut
71400d93e6 feat: Add Playwright script generation from agent history
Implement the ability to generate executable Playwright scripts from an Agent's run history (`AgentHistoryList`).

This introduces the `PlaywrightScriptGenerator` class which translates recorded agent actions (clicks, inputs, navigation, etc.) into a Python script using Playwright's async API.

Key features:
- Uses XPath selectors derived from the agent's interaction history.
- Includes a robust helper function (`_try_locate_and_act`) with XPath prefix trimming for improved resilience on dynamic pages.
- Handles sensitive data placeholders by mapping them to environment variables in the generated script.
- Supports configuring the browser launch and context based on the original agent's `BrowserConfig` and `BrowserContextConfig`.
- Activated by setting the `save_playwright_script_path` option in `AgentSettings`.

Includes modifications to `Agent` service to trigger generation and `AgentHistoryList` view to add the saving method. Also adds a new example (`examples/features/playwright_script_generation.py`).

This feature enables reliable replay of agent runs, automated testing, and scripting of repetitive tasks discovered by the agent.
2025-04-21 11:05:06 -05:00
Daniel Fang
3657f0a3f5 Update views.py 2025-04-18 16:33:37 +10:00
Dev-Khant
52ac120e94 Merge branch 'main' into fix-huggingface-issue 2025-04-17 13:38:18 +05:30
Dev-Khant
c4ea195ae4 address comments 2025-04-17 13:35:26 +05:30
Dha-aa
7ca46f22c2 Run ruff fix and format on modified files 2025-04-16 11:46:58 +05:30
Dha-aa
27525a8595 Add GROK_API_KEY to REQUIRED_LLM_API_ENV_VARS in agent/views.py 2025-04-16 10:52:28 +05:30
mathisarends-viadee
075d776bb3 Add extend function for planning system prompt 2025-04-14 09:27:31 +02:00
Nick Sweeting
482953f2ea Merge branch 'main' into user/dyadav/add-mem0-procedural-memory 2025-03-30 11:27:48 -07:00
Nick Sweeting
8ba9934542 make it not a hard error if no required keys are set for a model 2025-03-29 20:56:35 -07:00
Nick Sweeting
b7a3658e2c fix KeyError for some models 2025-03-29 20:52:46 -07:00
Deshraj Yadav
3e135d1047 Merge branch 'main' into user/dyadav/add-mem0-procedural-memory 2025-03-29 17:24:51 -07:00
Christian Clauss
28c7a487c7 pre-commit run --all-files and pytest 2025-03-29 08:10:13 +01:00
Deshraj Yadav
597c8c6e84 Incorporate suggestions 2025-03-28 19:05:50 -07:00
Deshraj Yadav
f0dbcff77d Incorporate suggestions 2025-03-28 19:05:37 -07:00
Deshraj Yadav
cac030c66f Change the interval to 8 2025-03-28 19:05:21 -07:00
Deshraj Yadav
55e5e2168e Add support for procedural memory 2025-03-28 19:05:21 -07:00
Nick Sweeting
297c5539a6 Merge branch 'main' into feature/support-reasoning-models 2025-03-28 18:22:05 -07:00
Nick Sweeting
fb6fa259a8 apply ruff safe fixes 2025-03-28 18:11:36 -07:00
Anish Hiranandani
f5833ad53d Merge branch 'main' into feature/support-reasoning-models 2025-03-28 17:20:08 -07:00
Anish Hiranandani
cb2323118f Update browser_use/agent/views.py
Fix comma typo

Co-authored-by: Nick Sweeting <github@sweeting.me>
2025-03-28 17:13:27 -07: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
Weixing Chen (from Dev Box)
b8215de46b fix comment 2025-03-17 10:21:29 +08:00
Weixing Chen (from Dev Box)
af56e0262e fix empty interacted element 2025-03-17 10:21:29 +08:00
shudaizi1989
5b08613a27 Fix:mutable default argument. (#901) 2025-03-02 12:52:30 -08:00