alita-sdk 0.3.175__py3-none-any.whl → 0.3.177__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alita_sdk/community/__init__.py +7 -17
- alita_sdk/tools/carrier/api_wrapper.py +6 -0
- alita_sdk/tools/carrier/backend_tests_tool.py +308 -7
- alita_sdk/tools/carrier/carrier_sdk.py +18 -0
- alita_sdk/tools/carrier/create_ui_test_tool.py +90 -109
- alita_sdk/tools/carrier/run_ui_test_tool.py +311 -184
- alita_sdk/tools/carrier/tools.py +2 -1
- alita_sdk/tools/confluence/api_wrapper.py +1 -0
- {alita_sdk-0.3.175.dist-info → alita_sdk-0.3.177.dist-info}/METADATA +2 -2
- {alita_sdk-0.3.175.dist-info → alita_sdk-0.3.177.dist-info}/RECORD +13 -44
- alita_sdk/community/browseruse/__init__.py +0 -73
- alita_sdk/community/browseruse/api_wrapper.py +0 -288
- alita_sdk/community/deep_researcher/__init__.py +0 -70
- alita_sdk/community/deep_researcher/agents/__init__.py +0 -1
- alita_sdk/community/deep_researcher/agents/baseclass.py +0 -182
- alita_sdk/community/deep_researcher/agents/knowledge_gap_agent.py +0 -74
- alita_sdk/community/deep_researcher/agents/long_writer_agent.py +0 -251
- alita_sdk/community/deep_researcher/agents/planner_agent.py +0 -124
- alita_sdk/community/deep_researcher/agents/proofreader_agent.py +0 -80
- alita_sdk/community/deep_researcher/agents/thinking_agent.py +0 -64
- alita_sdk/community/deep_researcher/agents/tool_agents/__init__.py +0 -20
- alita_sdk/community/deep_researcher/agents/tool_agents/crawl_agent.py +0 -87
- alita_sdk/community/deep_researcher/agents/tool_agents/search_agent.py +0 -96
- alita_sdk/community/deep_researcher/agents/tool_selector_agent.py +0 -83
- alita_sdk/community/deep_researcher/agents/utils/__init__.py +0 -0
- alita_sdk/community/deep_researcher/agents/utils/parse_output.py +0 -148
- alita_sdk/community/deep_researcher/agents/writer_agent.py +0 -63
- alita_sdk/community/deep_researcher/api_wrapper.py +0 -116
- alita_sdk/community/deep_researcher/deep_research.py +0 -185
- alita_sdk/community/deep_researcher/examples/deep_example.py +0 -30
- alita_sdk/community/deep_researcher/examples/iterative_example.py +0 -34
- alita_sdk/community/deep_researcher/examples/report_plan_example.py +0 -27
- alita_sdk/community/deep_researcher/iterative_research.py +0 -419
- alita_sdk/community/deep_researcher/llm_config.py +0 -87
- alita_sdk/community/deep_researcher/main.py +0 -67
- alita_sdk/community/deep_researcher/tools/__init__.py +0 -2
- alita_sdk/community/deep_researcher/tools/crawl_website.py +0 -109
- alita_sdk/community/deep_researcher/tools/web_search.py +0 -294
- alita_sdk/community/deep_researcher/utils/__init__.py +0 -0
- alita_sdk/community/deep_researcher/utils/md_to_pdf.py +0 -8
- alita_sdk/community/deep_researcher/utils/os.py +0 -21
- {alita_sdk-0.3.175.dist-info → alita_sdk-0.3.177.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.175.dist-info → alita_sdk-0.3.177.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.175.dist-info → alita_sdk-0.3.177.dist-info}/top_level.txt +0 -0
@@ -1507,6 +1507,7 @@ class ConfluenceAPIWrapper(BaseVectorStoreToolApiWrapper):
|
|
1507
1507
|
'application/doc', 'application/docx',
|
1508
1508
|
'application/xls', 'application/xlsx',
|
1509
1509
|
'application/svg', 'application/html',
|
1510
|
+
'application/octet-stream'
|
1510
1511
|
]
|
1511
1512
|
or file_ext in [
|
1512
1513
|
'xml', 'json', 'md', 'markdown', 'txt',
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.177
|
4
4
|
Summary: SDK for building langchain agents using resources from Alita
|
5
5
|
Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedjik@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -123,9 +123,9 @@ Requires-Dist: pysnc==1.1.10; extra == "tools"
|
|
123
123
|
Requires-Dist: shortuuid==1.0.13; extra == "tools"
|
124
124
|
Requires-Dist: yarl==1.17.1; extra == "tools"
|
125
125
|
Requires-Dist: langmem==0.0.27; extra == "tools"
|
126
|
+
Requires-Dist: textract-py3==2.1.1; extra == "tools"
|
126
127
|
Provides-Extra: community
|
127
128
|
Requires-Dist: retry-extended==0.2.3; extra == "community"
|
128
|
-
Requires-Dist: browser-use==0.1.43; extra == "community"
|
129
129
|
Requires-Dist: pyobjtojson==0.3; extra == "community"
|
130
130
|
Requires-Dist: elitea-analyse==0.1.2; extra == "community"
|
131
131
|
Provides-Extra: all
|
@@ -1,5 +1,5 @@
|
|
1
1
|
alita_sdk/__init__.py,sha256=fxeNiqiVpIFAJls31Oomifyrtd5gT9iPUTdkWjDOB2Y,656
|
2
|
-
alita_sdk/community/__init__.py,sha256=
|
2
|
+
alita_sdk/community/__init__.py,sha256=8N7wWwPhoyOq3p8wlV3-pb3l3nJCR8TUrtV9iIPLU88,2523
|
3
3
|
alita_sdk/community/utils.py,sha256=lvuCJaNqVPHOORJV6kIPcXJcdprVW_TJvERtYAEgpjM,249
|
4
4
|
alita_sdk/community/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
alita_sdk/community/analysis/ado_analyse/__init__.py,sha256=ADjjyV2z7XmQhOv873Mrz_-W9jWxhWpiDJ0nujm0eZs,4232
|
@@ -10,37 +10,6 @@ alita_sdk/community/analysis/gitlab_analyse/__init__.py,sha256=6PgqvD0cX5evpT_vg
|
|
10
10
|
alita_sdk/community/analysis/gitlab_analyse/api_wrapper.py,sha256=xGX3io2rT_DJl1PMiP9d6lsw6xhr9L2h910raGk1s4w,6373
|
11
11
|
alita_sdk/community/analysis/jira_analyse/__init__.py,sha256=oyAVkjq4KZmSA1RiAijeo4oh9hNDgFmOCkDilUJ8DWs,6023
|
12
12
|
alita_sdk/community/analysis/jira_analyse/api_wrapper.py,sha256=Ui1GBWizIFGFOi98BtkPWxVITQbrv7xFZxxYjAFq66Q,9701
|
13
|
-
alita_sdk/community/browseruse/__init__.py,sha256=9GhPp8VTuTPJHdlM06PlauHmCqbXR6zMwg_EV1OCpsg,3609
|
14
|
-
alita_sdk/community/browseruse/api_wrapper.py,sha256=cu6Rik6Dugrlb4aomlKIwBHuTHmhWZhIfysXbO03-_c,10842
|
15
|
-
alita_sdk/community/deep_researcher/__init__.py,sha256=Gq0VWr5v6Mr0m1vsZmIUCh5rITlZIi7TU5BDjfm70ow,3433
|
16
|
-
alita_sdk/community/deep_researcher/api_wrapper.py,sha256=WoMkbGHcwDq_BsTnfehPEGu7QZP-mMQe1aWrqLxbMuk,4806
|
17
|
-
alita_sdk/community/deep_researcher/deep_research.py,sha256=qAX5Ghtk130e6UQ9ciy2lmkv0o-rBuVGuzneu4V1Wwk,7818
|
18
|
-
alita_sdk/community/deep_researcher/iterative_research.py,sha256=ROnIecAWufGXkExT1aUX7tLR_khifaqf_vRLNQ1UTps,16970
|
19
|
-
alita_sdk/community/deep_researcher/llm_config.py,sha256=WPSrTy8K9URHvHxauO0gKVkua_8RcO1TFvo4Vfsdsmk,3098
|
20
|
-
alita_sdk/community/deep_researcher/main.py,sha256=AAw6WOgx6zcL6bbQKlhIhZuDYgGQxdK7XEAn9f2N5Ik,2593
|
21
|
-
alita_sdk/community/deep_researcher/agents/__init__.py,sha256=MG9dF6z2AuDniIghfhrfXupO5DP9t1vNzMJO2SksO2o,52
|
22
|
-
alita_sdk/community/deep_researcher/agents/baseclass.py,sha256=vIw1ezRkGM5zCBFWrIRNlKEWhl5frdlfO-ywVavgrFM,6271
|
23
|
-
alita_sdk/community/deep_researcher/agents/knowledge_gap_agent.py,sha256=XC648-7LQ3UQglDaMqvf-jWzegEt1ykiigUydM_ZuOI,3467
|
24
|
-
alita_sdk/community/deep_researcher/agents/long_writer_agent.py,sha256=WDu_9qT5frX2rkPGmsAeUiD8Ram5UPllUg7-rKq4gUQ,10250
|
25
|
-
alita_sdk/community/deep_researcher/agents/planner_agent.py,sha256=aGvpVn0Wrtmzrati87sSQrTkxNdX0P8XjNQwwENmx1U,5736
|
26
|
-
alita_sdk/community/deep_researcher/agents/proofreader_agent.py,sha256=MfBoZMlDNKIGQp9c87bpIWBIdb0BBFkJ9ufqfFNRK2I,3618
|
27
|
-
alita_sdk/community/deep_researcher/agents/thinking_agent.py,sha256=VYyHVuYVDBP7ZLrgrGKYYD9e6v11krb0XJ4fzcrakGU,2948
|
28
|
-
alita_sdk/community/deep_researcher/agents/tool_selector_agent.py,sha256=2PK3CWKM1DVQnOjQNnj_5AY_OTMSH2tFkF9FzaW0Nvg,4026
|
29
|
-
alita_sdk/community/deep_researcher/agents/writer_agent.py,sha256=-qyoJjEcXTyPbEvxNVP_ni_xPmq3VNZdkBJwKKpvZbQ,2699
|
30
|
-
alita_sdk/community/deep_researcher/agents/tool_agents/__init__.py,sha256=zrbzyCDrUWhQ7ZRX-AK5fqYd-kcq8IHFZeFkmy77V3k,608
|
31
|
-
alita_sdk/community/deep_researcher/agents/tool_agents/crawl_agent.py,sha256=VBSsPmiBpz9L8QT49RyQ43nkMYO6rJirYcbmzXWxieE,3552
|
32
|
-
alita_sdk/community/deep_researcher/agents/tool_agents/search_agent.py,sha256=sQzUdt44Xm2sRB6lQ3nTTRtS41rVT7Zm4tACH3I5prA,3986
|
33
|
-
alita_sdk/community/deep_researcher/agents/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
|
-
alita_sdk/community/deep_researcher/agents/utils/parse_output.py,sha256=_9Jq3bvChaRaKuZbayc92DmqXZaOoj7nLSOZzyUGXWw,4963
|
35
|
-
alita_sdk/community/deep_researcher/examples/deep_example.py,sha256=xWDojQ8dwPLaZCPU2zkKfyeesFk2T1bwRlCO3hYqvEo,699
|
36
|
-
alita_sdk/community/deep_researcher/examples/iterative_example.py,sha256=k291pvU3BnMkNXFdw6GdekvpXSztouv5CYRXXaBT_-4,863
|
37
|
-
alita_sdk/community/deep_researcher/examples/report_plan_example.py,sha256=9xrLVksmnCPwhdgHqieqnmaW2b-DcGwB3vl6xXKiHs8,952
|
38
|
-
alita_sdk/community/deep_researcher/tools/__init__.py,sha256=-gLuDJIkSeLW4BRsS-maAIIz6pcyr_VrSUs34G63dTg,88
|
39
|
-
alita_sdk/community/deep_researcher/tools/crawl_website.py,sha256=oQ12KgpXB3P-6mbUVUONMmEqgsnZ_m5JTvrkjt4idik,4446
|
40
|
-
alita_sdk/community/deep_researcher/tools/web_search.py,sha256=PucwnPCwJwMyaEfHGCy2OxNyCUhF7Uvv61M-yzNO_Yc,11036
|
41
|
-
alita_sdk/community/deep_researcher/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
-
alita_sdk/community/deep_researcher/utils/md_to_pdf.py,sha256=EgCaUGLsP5-5F301aB60ZbwhhaxKK-EsSx0Ol_35fvw,246
|
43
|
-
alita_sdk/community/deep_researcher/utils/os.py,sha256=Q1xX7c7_p7EmuzzXIAY9TDmraDNvU0GGcpfgIfWKQ2A,793
|
44
13
|
alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
|
45
14
|
alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
|
46
15
|
alita_sdk/runtime/clients/artifact.py,sha256=4N2t5x3GibyXLq3Fvrv2o_VA7Z000yNfc-UN4eGsHZg,2679
|
@@ -160,18 +129,18 @@ alita_sdk/tools/browser/google_search_rag.py,sha256=QVHFbVwymiJGuno_HLSJOK1c_Mpg
|
|
160
129
|
alita_sdk/tools/browser/utils.py,sha256=4k3YM_f1Kqlhjz9vt2pNsGkvCjhy-EmY3nvcwdFCsLA,2501
|
161
130
|
alita_sdk/tools/browser/wiki.py,sha256=Qh3HBFd4dkS2VavXbFJOm4b8SjVSIe5xSD7CY1vEkKE,1126
|
162
131
|
alita_sdk/tools/carrier/__init__.py,sha256=pP-nk-dpqOkrvwcRY_szgwqoowyVNl_GobD4Inp-Qus,4435
|
163
|
-
alita_sdk/tools/carrier/api_wrapper.py,sha256=
|
132
|
+
alita_sdk/tools/carrier/api_wrapper.py,sha256=R8fyGesykTDJ1D2t7z1h_W9TO9B5GaqKaWI7OU9tdRE,8877
|
164
133
|
alita_sdk/tools/carrier/backend_reports_tool.py,sha256=2Z1DCt6f0XTrQcEoynxMFUnenhtYMuIt_epq4YBSLDE,12234
|
165
|
-
alita_sdk/tools/carrier/backend_tests_tool.py,sha256=
|
134
|
+
alita_sdk/tools/carrier/backend_tests_tool.py,sha256=xfcp0-CHLW_yi5eNeoepd9w8He_1ls_knnhuWt_Kjv4,21723
|
166
135
|
alita_sdk/tools/carrier/cancel_ui_test_tool.py,sha256=pD1sKEcZGBWJqFpgjeohMk93uuUPWruVJRPVVg90rpo,6438
|
167
|
-
alita_sdk/tools/carrier/carrier_sdk.py,sha256=
|
136
|
+
alita_sdk/tools/carrier/carrier_sdk.py,sha256=JDPgZ0MSUGEQf07ZBwBYpY-9RvYpXyyDj-cKZsx-3m0,14513
|
168
137
|
alita_sdk/tools/carrier/create_ui_excel_report_tool.py,sha256=8aSpkyIGXsOBTo8Ye_6p19v8OOl1y7QW47IJxZ6QDgM,20163
|
169
|
-
alita_sdk/tools/carrier/create_ui_test_tool.py,sha256=
|
138
|
+
alita_sdk/tools/carrier/create_ui_test_tool.py,sha256=knKvPOo9usI2XHqZtcbBEBzKwB9tS7GEl9KIX78vJiA,8184
|
170
139
|
alita_sdk/tools/carrier/excel_reporter.py,sha256=fXptz7iaBDBcFSc8Ah8nZ9CSgugTONc5JMC1XcQEnfM,21487
|
171
140
|
alita_sdk/tools/carrier/lighthouse_excel_reporter.py,sha256=mVuU63tl2n-Gntx9RuedjEU0U5AP1APKsSx1DvJs7wk,6684
|
172
|
-
alita_sdk/tools/carrier/run_ui_test_tool.py,sha256=
|
141
|
+
alita_sdk/tools/carrier/run_ui_test_tool.py,sha256=Wqfxi_jyOU6XxYGsTje2ftgm8O7PJRXRDHUwWcw8opM,26277
|
173
142
|
alita_sdk/tools/carrier/tickets_tool.py,sha256=d-wFyFWWTvV01o-hyssb2S-oLnr51b6tlNTUqA_CohY,8099
|
174
|
-
alita_sdk/tools/carrier/tools.py,sha256=
|
143
|
+
alita_sdk/tools/carrier/tools.py,sha256=6j0-_DJqOOBwMtpdSFHlOBcS44HWLBINh4RttpVN_cU,1679
|
175
144
|
alita_sdk/tools/carrier/ui_reports_tool.py,sha256=Y6EstTRCa9d11ipFUFGOYlpiEhFx7aOQcgZ_M5Gd1lQ,13708
|
176
145
|
alita_sdk/tools/carrier/update_ui_test_schedule_tool.py,sha256=jh9Q86cMCEqpsFopJPNIP0wlr7sYVa_3lhlq6lRmkGg,11850
|
177
146
|
alita_sdk/tools/carrier/utils.py,sha256=rl7aq-F6ed_PapDM15w8EtS0BkgsjpDrNdKYuDCMOaI,4376
|
@@ -217,7 +186,7 @@ alita_sdk/tools/code/loaders/codesearcher.py,sha256=XoXXZtIQZhvjIwZlnl_4wVGHC-3s
|
|
217
186
|
alita_sdk/tools/code/sonar/__init__.py,sha256=u8wpgXJ_shToLl3G9-XEtGDor5dhmsnurIImh1-e-U0,3165
|
218
187
|
alita_sdk/tools/code/sonar/api_wrapper.py,sha256=nNqxcWN_6W8c0ckj-Er9HkNuAdgQLoWBXh5UyzNutis,2653
|
219
188
|
alita_sdk/tools/confluence/__init__.py,sha256=1wGSP4CjPbfpdZLsjC1SVftTV7XSvW3QCAMHuh9tIxA,6885
|
220
|
-
alita_sdk/tools/confluence/api_wrapper.py,sha256=
|
189
|
+
alita_sdk/tools/confluence/api_wrapper.py,sha256=zP8S85oVulhqrom1wlgelN-TSuKtPuYxwwGAlOSn_I0,88776
|
221
190
|
alita_sdk/tools/confluence/loader.py,sha256=aHqgdIQMqkyRry8feHAhyd-a_ASEyW3JrV6epTRG6-c,9162
|
222
191
|
alita_sdk/tools/confluence/utils.py,sha256=Lxo6dBD0OlvM4o0JuK6qeB_4LV9BptiwJA9e1vqNcDw,435
|
223
192
|
alita_sdk/tools/custom_open_api/__init__.py,sha256=9aT5SPNPWcJC6jMZEM-3rUCXVULj_3-qJLQKmnreKNo,2537
|
@@ -326,8 +295,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw
|
|
326
295
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=rq4jOb3lRW2GXvAguk4H1KinO5f-zpygzhBJf-E1Ucw,2773
|
327
296
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=iOMxyE7vOc_LwFB_nBMiSFXkNtvbptA4i-BrTlo7M0A,5854
|
328
297
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=IYUJoMFOMA70knLhLtAnuGoy3OK80RuqeQZ710oyIxE,3631
|
329
|
-
alita_sdk-0.3.
|
330
|
-
alita_sdk-0.3.
|
331
|
-
alita_sdk-0.3.
|
332
|
-
alita_sdk-0.3.
|
333
|
-
alita_sdk-0.3.
|
298
|
+
alita_sdk-0.3.177.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
299
|
+
alita_sdk-0.3.177.dist-info/METADATA,sha256=avoSyHmQjQ--BnjrSryL8zpwaJdw0q8FJpy9Mc3R7fA,18753
|
300
|
+
alita_sdk-0.3.177.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
301
|
+
alita_sdk-0.3.177.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
302
|
+
alita_sdk-0.3.177.dist-info/RECORD,,
|
@@ -1,73 +0,0 @@
|
|
1
|
-
from typing import List, Literal, Optional, Dict, Any
|
2
|
-
from langchain_community.agent_toolkits.base import BaseToolkit
|
3
|
-
from .api_wrapper import BrowserUseAPIWrapper
|
4
|
-
from langchain_core.tools import BaseTool
|
5
|
-
from alita_sdk.tools.base.tool import BaseAction
|
6
|
-
from pydantic import create_model, BaseModel, ConfigDict, Field
|
7
|
-
from alita_sdk.tools.utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length
|
8
|
-
|
9
|
-
name = "browser_use"
|
10
|
-
|
11
|
-
def get_tools(tool):
|
12
|
-
return BrowserUseToolkit().get_toolkit(
|
13
|
-
selected_tools=tool['settings'].get('selected_tools', []),
|
14
|
-
headless=tool['settings'].get('headless', True),
|
15
|
-
width=tool['settings'].get('width', 1280),
|
16
|
-
height=tool['settings'].get('height', 800),
|
17
|
-
cookies=tool['settings'].get('cookies', None),
|
18
|
-
disable_security=tool['settings'].get('disable_security', True),
|
19
|
-
proxy=tool['settings'].get('proxy', None),
|
20
|
-
extra_chromium_args=tool['settings'].get('extra_chromium_args', []),
|
21
|
-
bucket=tool['settings'].get('bucket', None),
|
22
|
-
alita=tool['settings'].get('alita'),
|
23
|
-
toolkit_name=tool.get('toolkit_name')
|
24
|
-
).get_tools()
|
25
|
-
|
26
|
-
toolkit_max_length = 25
|
27
|
-
|
28
|
-
class BrowserUseToolkit(BaseToolkit):
|
29
|
-
tools: List[BaseTool] = []
|
30
|
-
|
31
|
-
@staticmethod
|
32
|
-
def toolkit_config_schema() -> BaseModel:
|
33
|
-
selected_tools = {x['name']: x['args_schema'].schema() for x in
|
34
|
-
BrowserUseAPIWrapper.model_construct().get_available_tools()}
|
35
|
-
return create_model(
|
36
|
-
name,
|
37
|
-
headless=(bool, Field(description="Run browser in headless mode", default=True)),
|
38
|
-
width=(int, Field(description="Browser window width", default=1280)),
|
39
|
-
height=(int, Field(description="Browser window height", default=800)),
|
40
|
-
bucket=(Optional[str], Field(description="Bucket to store test results", default=None)),
|
41
|
-
cookies=(Optional[Dict[str, Any]], Field(description="Browser cookies as JSON", default=None)),
|
42
|
-
disable_security=(bool, Field(description="Disable browser security features", default=True)),
|
43
|
-
proxy=(Optional[Dict[str, str]], Field(description="Proxy settings", default=None)),
|
44
|
-
extra_chromium_args=(List[str], Field(description="Extra arguments to pass to the browser", default=[])),
|
45
|
-
selected_tools=(List[Literal[tuple(selected_tools)]],
|
46
|
-
Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
47
|
-
__config__=ConfigDict(json_schema_extra={'metadata': {"label": "Browser Use", "icon_url": None, "hidden": True}})
|
48
|
-
)
|
49
|
-
|
50
|
-
@classmethod
|
51
|
-
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
52
|
-
if selected_tools is None:
|
53
|
-
selected_tools = []
|
54
|
-
_api_wrapper = BrowserUseAPIWrapper(**kwargs)
|
55
|
-
prefix = clean_string(toolkit_name, toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
56
|
-
available_tools = _api_wrapper.get_available_tools()
|
57
|
-
tools = []
|
58
|
-
for tool in available_tools:
|
59
|
-
if selected_tools:
|
60
|
-
if tool["name"] not in selected_tools:
|
61
|
-
continue
|
62
|
-
tools.append(
|
63
|
-
BaseAction(
|
64
|
-
api_wrapper=_api_wrapper,
|
65
|
-
name=prefix + tool["name"],
|
66
|
-
description=f"Browser automation tool: {tool['name']}" + tool["description"],
|
67
|
-
args_schema=tool["args_schema"],
|
68
|
-
)
|
69
|
-
)
|
70
|
-
return cls(tools=tools)
|
71
|
-
|
72
|
-
def get_tools(self):
|
73
|
-
return self.tools
|
@@ -1,288 +0,0 @@
|
|
1
|
-
from datetime import datetime
|
2
|
-
from typing import Dict, List, Any, Optional, Type
|
3
|
-
from pydantic import BaseModel, Field
|
4
|
-
from browser_use import Agent, ActionResult, Browser, BrowserConfig, BrowserContextConfig
|
5
|
-
from browser_use.agent.views import AgentHistoryList
|
6
|
-
from playwright._impl._api_structures import ProxySettings
|
7
|
-
from alita_sdk.tools.elitea_base import BaseToolApiWrapper
|
8
|
-
from pydantic import create_model, Field, model_validator
|
9
|
-
from tempfile import TemporaryDirectory, NamedTemporaryFile
|
10
|
-
from browser_use.controller.service import Controller
|
11
|
-
from langchain_core.callbacks import dispatch_custom_event
|
12
|
-
from pyobjtojson import obj_to_json
|
13
|
-
import os
|
14
|
-
import asyncio
|
15
|
-
|
16
|
-
import socket
|
17
|
-
from browser_use.browser.utils.screen_resolution import get_screen_resolution, get_window_adjustments
|
18
|
-
from playwright.async_api import Playwright, Browser as PlaywrightBrowser
|
19
|
-
from browser_use.browser.chrome import (
|
20
|
-
CHROME_ARGS,
|
21
|
-
CHROME_DEBUG_PORT,
|
22
|
-
CHROME_DETERMINISTIC_RENDERING_ARGS,
|
23
|
-
CHROME_DISABLE_SECURITY_ARGS,
|
24
|
-
CHROME_DOCKER_ARGS,
|
25
|
-
CHROME_HEADLESS_ARGS,
|
26
|
-
)
|
27
|
-
IN_DOCKER = os.environ.get('IN_DOCKER', 'false').lower()[0] in 'ty1'
|
28
|
-
|
29
|
-
class BrowserEx(Browser):
|
30
|
-
def __init__(self, config: BrowserConfig):
|
31
|
-
super().__init__(config)
|
32
|
-
self.config = config
|
33
|
-
|
34
|
-
async def _setup_builtin_browser(self, playwright: Playwright) -> PlaywrightBrowser:
|
35
|
-
"""Sets up and returns a Playwright Browser instance with anti-detection measures."""
|
36
|
-
assert self.config.browser_binary_path is None, 'browser_binary_path should be None if trying to use the builtin browsers'
|
37
|
-
|
38
|
-
# Use the configured window size from new_context_config if available
|
39
|
-
if (
|
40
|
-
not self.config.headless
|
41
|
-
and hasattr(self.config, 'new_context_config')
|
42
|
-
and hasattr(self.config.new_context_config, 'browser_window_size')
|
43
|
-
):
|
44
|
-
screen_size = self.config.new_context_config.browser_window_size.model_dump()
|
45
|
-
offset_x, offset_y = get_window_adjustments()
|
46
|
-
elif self.config.headless:
|
47
|
-
screen_size = {'width': 1920, 'height': 1080}
|
48
|
-
offset_x, offset_y = 0, 0
|
49
|
-
else:
|
50
|
-
screen_size = get_screen_resolution()
|
51
|
-
offset_x, offset_y = get_window_adjustments()
|
52
|
-
|
53
|
-
chrome_args = {
|
54
|
-
f'--remote-debugging-port={self.config.chrome_remote_debugging_port}',
|
55
|
-
*CHROME_ARGS,
|
56
|
-
*(CHROME_DOCKER_ARGS if IN_DOCKER else []),
|
57
|
-
*(CHROME_HEADLESS_ARGS if self.config.headless else []),
|
58
|
-
*(CHROME_DISABLE_SECURITY_ARGS if self.config.disable_security else []),
|
59
|
-
*(CHROME_DETERMINISTIC_RENDERING_ARGS if self.config.deterministic_rendering else []),
|
60
|
-
f'--window-position={offset_x},{offset_y}',
|
61
|
-
f'--window-size={screen_size["width"]},{screen_size["height"]}',
|
62
|
-
*self.config.extra_browser_args,
|
63
|
-
}
|
64
|
-
|
65
|
-
# check if chrome remote debugging port is already taken,
|
66
|
-
# if so remove the remote-debugging-port arg to prevent conflicts
|
67
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
68
|
-
if s.connect_ex(('localhost', self.config.chrome_remote_debugging_port)) == 0:
|
69
|
-
chrome_args.remove(f'--remote-debugging-port={self.config.chrome_remote_debugging_port}')
|
70
|
-
|
71
|
-
browser_class = getattr(playwright, self.config.browser_class)
|
72
|
-
args = {
|
73
|
-
'chromium': list(chrome_args),
|
74
|
-
'firefox': [
|
75
|
-
*{
|
76
|
-
'-no-remote',
|
77
|
-
*self.config.extra_browser_args,
|
78
|
-
}
|
79
|
-
],
|
80
|
-
'webkit': [
|
81
|
-
*{
|
82
|
-
'--no-startup-window',
|
83
|
-
*self.config.extra_browser_args,
|
84
|
-
}
|
85
|
-
],
|
86
|
-
}
|
87
|
-
|
88
|
-
browser = await browser_class.launch(
|
89
|
-
headless=self.config.headless,
|
90
|
-
channel='chromium',
|
91
|
-
args=args[self.config.browser_class],
|
92
|
-
proxy=self.config.proxy.model_dump() if self.config.proxy else None,
|
93
|
-
handle_sigterm=False,
|
94
|
-
handle_sigint=False,
|
95
|
-
)
|
96
|
-
return browser
|
97
|
-
|
98
|
-
|
99
|
-
BrowserTask = create_model(
|
100
|
-
"BrowserTask",
|
101
|
-
task=(str, Field(description="Task to perform")),
|
102
|
-
max_steps=(Optional[int], Field(description="Maximum number of steps to perform")),
|
103
|
-
debug=(Optional[bool], Field(description="Whether debug mode is enabled")),
|
104
|
-
__config__=Field(description="Browser Use API Wrapper")
|
105
|
-
)
|
106
|
-
|
107
|
-
BrowserTasks = create_model(
|
108
|
-
"BrowserTasks",
|
109
|
-
tasks=(List[str], Field(description="List of tasks to perform")),
|
110
|
-
max_steps=(Optional[int], Field(description="Maximum number of steps to perform")),
|
111
|
-
debug=(Optional[bool], Field(description="Whether debug mode is enabled")),
|
112
|
-
__config__=Field(description="Browser Use API Wrapper")
|
113
|
-
)
|
114
|
-
|
115
|
-
async def thinking_processor(agent):
|
116
|
-
"""Hook to be called after each step."""
|
117
|
-
if hasattr(agent, "state"):
|
118
|
-
history = agent.state.history
|
119
|
-
else:
|
120
|
-
history = None
|
121
|
-
return
|
122
|
-
|
123
|
-
# Process model thoughts
|
124
|
-
model_thoughts = obj_to_json(
|
125
|
-
obj=history.model_thoughts(),
|
126
|
-
check_circular=False
|
127
|
-
)
|
128
|
-
if len(model_thoughts) > 0:
|
129
|
-
model_thoughts_last_elem = model_thoughts[-1]
|
130
|
-
evalualtion = model_thoughts_last_elem.get('evaluation_previous_goal')
|
131
|
-
memory = model_thoughts_last_elem.get('memory')
|
132
|
-
next_goal = model_thoughts_last_elem.get('next_goal')
|
133
|
-
dispatch_custom_event(
|
134
|
-
name="thinking_step",
|
135
|
-
data={
|
136
|
-
"message": f"**Memory** : \n\n{memory}\n\n**Evaluation goal**:\n\n{evalualtion}\n\n**Next goal**:\n\n{next_goal}",
|
137
|
-
"tool_name": "task",
|
138
|
-
"toolkit": "browser_use"
|
139
|
-
}
|
140
|
-
)
|
141
|
-
|
142
|
-
|
143
|
-
class DoneResult(BaseModel):
|
144
|
-
title: str
|
145
|
-
comments: str
|
146
|
-
hours_since_start: int
|
147
|
-
|
148
|
-
gif_default_location = './agent_history.gif'
|
149
|
-
default_bucket = 'browseruse'
|
150
|
-
|
151
|
-
class BrowserUseAPIWrapper(BaseToolApiWrapper):
|
152
|
-
"""Wrapper for Browser Use API."""
|
153
|
-
headless: bool = True
|
154
|
-
width: int = 1280
|
155
|
-
height: int = 800
|
156
|
-
use_vision: bool = False
|
157
|
-
trace_actions: bool = False
|
158
|
-
trace_actions_path: Optional[str] = None
|
159
|
-
cookies: Optional[Dict[str, Any]] = None
|
160
|
-
disable_security: bool = True
|
161
|
-
proxy: Any = None
|
162
|
-
extra_chromium_args: List[str] = []
|
163
|
-
client: Any = None # AlitaClient
|
164
|
-
artifact: Any = None # Artifact
|
165
|
-
llm: Any = None # LLMLikeObject
|
166
|
-
bucket: str = None
|
167
|
-
proxy_settings: Any = None
|
168
|
-
validate_output: bool = False
|
169
|
-
planner_llm: Any = None
|
170
|
-
browser_window_size: Dict[str, int] = None
|
171
|
-
|
172
|
-
|
173
|
-
@model_validator(mode='before')
|
174
|
-
@classmethod
|
175
|
-
def validate_toolkit(cls, values):
|
176
|
-
"""Validate toolkit parameters."""
|
177
|
-
values['proxy'] = ProxySettings(**values['proxy']) if values.get('proxy') else None
|
178
|
-
values['extra_chromium_args'] = values.get('extra_chromium_args') or []
|
179
|
-
values['browser_window_size'] = {"width": values.get('width', 1280), "height": values.get('height', 800)}
|
180
|
-
values['artifact'] = values.get('client').artifact(values.get('bucket', default_bucket))
|
181
|
-
return values
|
182
|
-
|
183
|
-
|
184
|
-
def _create_browser(self):
|
185
|
-
cookies_file = None
|
186
|
-
if self.cookies:
|
187
|
-
cookies_file = NamedTemporaryFile(delete=False)
|
188
|
-
cookies_file.write(self.cookies)
|
189
|
-
cookies_file.close()
|
190
|
-
|
191
|
-
context_config = BrowserContextConfig(
|
192
|
-
cookies_file=cookies_file,
|
193
|
-
wait_for_network_idle_page_load_time=10.0, # TODO: Make this configurable
|
194
|
-
highlight_elements=True,
|
195
|
-
browser_window_size=self.browser_window_size
|
196
|
-
)
|
197
|
-
browser_config = BrowserConfig(
|
198
|
-
headless=self.headless,
|
199
|
-
browser_class='chromium', # TODO: Make this configurable
|
200
|
-
disable_security=self.disable_security,
|
201
|
-
extra_chromium_args=self.extra_chromium_args,
|
202
|
-
proxy=self.proxy,
|
203
|
-
new_context_config=context_config
|
204
|
-
)
|
205
|
-
return BrowserEx(config=browser_config)
|
206
|
-
|
207
|
-
def task(self, task: str, max_steps: Optional[int] = 20, debug: Optional[bool] = False):
|
208
|
-
"""Perform a task using the browser."""
|
209
|
-
return asyncio.run(self._tasks([task], max_steps, debug))
|
210
|
-
|
211
|
-
async def _tasks(self, tasks: List[str], max_steps: Optional[int] = 20, debug: Optional[bool] = False):
|
212
|
-
browser = self._create_browser()
|
213
|
-
context_config = BrowserContextConfig(
|
214
|
-
wait_for_network_idle_page_load_time=10.0, # TODO: Make this configurable
|
215
|
-
highlight_elements=True,
|
216
|
-
browser_window_size=self.browser_window_size
|
217
|
-
)
|
218
|
-
async with await browser.new_context(context_config) as browser:
|
219
|
-
start = tasks[0]
|
220
|
-
if len(tasks) == 1:
|
221
|
-
tasks = []
|
222
|
-
agent = Agent(
|
223
|
-
task=start,
|
224
|
-
llm=self.llm,
|
225
|
-
browser_context=browser,
|
226
|
-
max_actions_per_step=20,
|
227
|
-
use_vision=self.use_vision,
|
228
|
-
save_conversation_path=None,
|
229
|
-
generate_gif=True,
|
230
|
-
planner_llm=self.planner_llm,
|
231
|
-
controller=Controller(),
|
232
|
-
message_context = "Carefully check every step, and make sure to provide detailed feedback on the results.",
|
233
|
-
validate_output=self.validate_output
|
234
|
-
)
|
235
|
-
for task in tasks:
|
236
|
-
agent.add_new_task(task)
|
237
|
-
history: AgentHistoryList = await agent.run(
|
238
|
-
max_steps=max_steps,
|
239
|
-
on_step_end=thinking_processor
|
240
|
-
)
|
241
|
-
await browser.close()
|
242
|
-
files = self._save_execution(history.model_dump_json())
|
243
|
-
|
244
|
-
return {
|
245
|
-
"run_data": str(history.extracted_content()),
|
246
|
-
"files": files
|
247
|
-
}
|
248
|
-
|
249
|
-
def _save_execution(self, data_content: Any):
|
250
|
-
"""Saves tasks execution gif"""
|
251
|
-
|
252
|
-
try:
|
253
|
-
with open(gif_default_location, 'rb') as file:
|
254
|
-
artifact_data = file.read()
|
255
|
-
except FileNotFoundError:
|
256
|
-
artifact_data = None
|
257
|
-
|
258
|
-
filename = f"tasks_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
|
259
|
-
files = []
|
260
|
-
if data_content:
|
261
|
-
self.artifact.create(f'{filename}.json', data_content)
|
262
|
-
files.append(f'{filename}.json')
|
263
|
-
|
264
|
-
if artifact_data:
|
265
|
-
self.artifact.create(f'{filename}.gif', artifact_data)
|
266
|
-
files.append(f'{filename}.gif')
|
267
|
-
return files
|
268
|
-
|
269
|
-
|
270
|
-
def tasks(self, tasks: List[str], max_steps: Optional[int] = 20, debug: Optional[bool] = False):
|
271
|
-
"""Perform a list of tasks using the browser."""
|
272
|
-
return asyncio.run(self._tasks(tasks, max_steps, debug))
|
273
|
-
|
274
|
-
def get_available_tools(self):
|
275
|
-
return [
|
276
|
-
{
|
277
|
-
"name": "task",
|
278
|
-
"description": self.task.__doc__,
|
279
|
-
"args_schema": BrowserTask,
|
280
|
-
"ref": self.task
|
281
|
-
},
|
282
|
-
{
|
283
|
-
"name": "tasks",
|
284
|
-
"description": self.tasks.__doc__,
|
285
|
-
"args_schema": BrowserTasks,
|
286
|
-
"ref": self.tasks
|
287
|
-
}
|
288
|
-
]
|
@@ -1,70 +0,0 @@
|
|
1
|
-
from .deep_research import DeepResearcher
|
2
|
-
from .iterative_research import IterativeResearcher
|
3
|
-
from .agents.baseclass import ResearchRunner
|
4
|
-
from .llm_config import LLMConfig
|
5
|
-
|
6
|
-
__all__ = ["DeepResearcher", "IterativeResearcher", "ResearchRunner", "LLMConfig"]
|
7
|
-
|
8
|
-
from typing import Any, List, Literal, Optional
|
9
|
-
|
10
|
-
from langchain_core.tools import BaseToolkit, BaseTool
|
11
|
-
from pydantic import BaseModel, ConfigDict, create_model, Field
|
12
|
-
|
13
|
-
from .api_wrapper import DeepResearcherWrapper
|
14
|
-
from ..base.tool import BaseAction
|
15
|
-
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length
|
16
|
-
|
17
|
-
name = "deep_researcher"
|
18
|
-
|
19
|
-
def get_tools(tool):
|
20
|
-
return DeepResearcherToolkit().get_toolkit(
|
21
|
-
selected_tools=tool['settings'].get('selected_tools', []),
|
22
|
-
max_iterations=tool['settings'].get('max_iterations', 5),
|
23
|
-
max_time_minutes=tool['settings'].get('max_time_minutes', 10),
|
24
|
-
verbose=tool['settings'].get('verbose', False),
|
25
|
-
tracing=tool['settings'].get('tracing', False),
|
26
|
-
alita=tool['settings'].get('alita', None),
|
27
|
-
llm=tool['settings'].get('llm', None),
|
28
|
-
toolkit_name=tool.get('toolkit_name')
|
29
|
-
).get_tools()
|
30
|
-
|
31
|
-
|
32
|
-
class DeepResearcherToolkit(BaseToolkit):
|
33
|
-
tools: List[BaseTool] = []
|
34
|
-
toolkit_max_length: int = 0
|
35
|
-
|
36
|
-
@staticmethod
|
37
|
-
def toolkit_config_schema() -> BaseModel:
|
38
|
-
selected_tools = {x['name']: x['args_schema'].schema() for x in DeepResearcherWrapper.model_construct().get_available_tools()}
|
39
|
-
DeepResearcherToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
40
|
-
return create_model(
|
41
|
-
name,
|
42
|
-
max_iterations=(int, Field(default=5, title="Max iterations", description="Maximum number of iterations for research", json_schema_extra={'toolkit_name': True, 'max_toolkit_length': DeepResearcherToolkit.toolkit_max_length})),
|
43
|
-
max_time_minutes=(int, Field(default=10, title="Max time (minutes)", description="Maximum time in minutes for research")),
|
44
|
-
verbose=(bool, Field(default=False, title="Verbose", description="Print status updates to the console")),
|
45
|
-
tracing=(bool, Field(default=False, title="Tracing", description="Enable tracing (only for OpenAI models)")),
|
46
|
-
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
47
|
-
__config__=ConfigDict(json_schema_extra={'metadata': {"label": "Deep Researcher", "icon_url": "research-icon.svg"}})
|
48
|
-
)
|
49
|
-
|
50
|
-
@classmethod
|
51
|
-
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
52
|
-
if selected_tools is None:
|
53
|
-
selected_tools = []
|
54
|
-
deep_researcher_api_wrapper = DeepResearcherWrapper(**kwargs)
|
55
|
-
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
56
|
-
available_tools = deep_researcher_api_wrapper.get_available_tools()
|
57
|
-
tools = []
|
58
|
-
for tool in available_tools:
|
59
|
-
if selected_tools and tool["name"] not in selected_tools:
|
60
|
-
continue
|
61
|
-
tools.append(BaseAction(
|
62
|
-
api_wrapper=deep_researcher_api_wrapper,
|
63
|
-
name=prefix + tool["name"],
|
64
|
-
description=tool["description"],
|
65
|
-
args_schema=tool["args_schema"]
|
66
|
-
))
|
67
|
-
return cls(tools=tools)
|
68
|
-
|
69
|
-
def get_tools(self):
|
70
|
-
return self.tools
|
@@ -1 +0,0 @@
|
|
1
|
-
from .baseclass import ResearchAgent, ResearchRunner
|