agentscope-runtime 0.2.0b1__py3-none-any.whl → 1.0.0__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.
Files changed (185) hide show
  1. agentscope_runtime/adapters/__init__.py +0 -0
  2. agentscope_runtime/adapters/agentscope/__init__.py +0 -0
  3. agentscope_runtime/adapters/agentscope/long_term_memory/__init__.py +6 -0
  4. agentscope_runtime/adapters/agentscope/long_term_memory/_long_term_memory_adapter.py +258 -0
  5. agentscope_runtime/adapters/agentscope/memory/__init__.py +6 -0
  6. agentscope_runtime/adapters/agentscope/memory/_memory_adapter.py +152 -0
  7. agentscope_runtime/adapters/agentscope/message.py +535 -0
  8. agentscope_runtime/adapters/agentscope/stream.py +506 -0
  9. agentscope_runtime/adapters/agentscope/tool/__init__.py +9 -0
  10. agentscope_runtime/adapters/agentscope/tool/sandbox_tool.py +69 -0
  11. agentscope_runtime/adapters/agentscope/tool/tool.py +233 -0
  12. agentscope_runtime/adapters/autogen/__init__.py +0 -0
  13. agentscope_runtime/adapters/autogen/tool/__init__.py +7 -0
  14. agentscope_runtime/adapters/autogen/tool/tool.py +211 -0
  15. agentscope_runtime/adapters/text/__init__.py +0 -0
  16. agentscope_runtime/adapters/text/stream.py +29 -0
  17. agentscope_runtime/common/collections/redis_mapping.py +4 -1
  18. agentscope_runtime/common/container_clients/fc_client.py +855 -0
  19. agentscope_runtime/common/container_clients/kubernetes_client.py +6 -13
  20. agentscope_runtime/common/utils/__init__.py +0 -0
  21. agentscope_runtime/common/utils/lazy_loader.py +57 -0
  22. agentscope_runtime/engine/__init__.py +25 -18
  23. agentscope_runtime/engine/app/agent_app.py +161 -91
  24. agentscope_runtime/engine/app/base_app.py +4 -118
  25. agentscope_runtime/engine/constant.py +8 -0
  26. agentscope_runtime/engine/deployers/__init__.py +8 -0
  27. agentscope_runtime/engine/deployers/adapter/__init__.py +2 -0
  28. agentscope_runtime/engine/deployers/adapter/a2a/a2a_adapter_utils.py +0 -21
  29. agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +28 -9
  30. agentscope_runtime/engine/deployers/adapter/responses/__init__.py +2 -0
  31. agentscope_runtime/engine/deployers/adapter/responses/response_api_adapter_utils.py +5 -2
  32. agentscope_runtime/engine/deployers/adapter/responses/response_api_protocol_adapter.py +1 -1
  33. agentscope_runtime/engine/deployers/agentrun_deployer.py +2541 -0
  34. agentscope_runtime/engine/deployers/cli_fc_deploy.py +1 -1
  35. agentscope_runtime/engine/deployers/kubernetes_deployer.py +9 -21
  36. agentscope_runtime/engine/deployers/local_deployer.py +47 -74
  37. agentscope_runtime/engine/deployers/modelstudio_deployer.py +216 -50
  38. agentscope_runtime/engine/deployers/utils/app_runner_utils.py +29 -0
  39. agentscope_runtime/engine/deployers/utils/detached_app.py +510 -0
  40. agentscope_runtime/engine/deployers/utils/docker_image_utils/__init__.py +1 -1
  41. agentscope_runtime/engine/deployers/utils/docker_image_utils/dockerfile_generator.py +1 -1
  42. agentscope_runtime/engine/deployers/utils/docker_image_utils/{runner_image_factory.py → image_factory.py} +121 -61
  43. agentscope_runtime/engine/deployers/utils/package.py +693 -0
  44. agentscope_runtime/engine/deployers/utils/service_utils/__init__.py +0 -5
  45. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_factory.py +301 -282
  46. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_templates.py +2 -4
  47. agentscope_runtime/engine/deployers/utils/service_utils/process_manager.py +23 -1
  48. agentscope_runtime/engine/deployers/utils/templates/app_main.py.j2 +84 -0
  49. agentscope_runtime/engine/deployers/utils/templates/runner_main.py.j2 +95 -0
  50. agentscope_runtime/engine/deployers/utils/{service_utils → templates}/standalone_main.py.j2 +0 -45
  51. agentscope_runtime/engine/deployers/utils/wheel_packager.py +119 -18
  52. agentscope_runtime/engine/helpers/runner.py +40 -0
  53. agentscope_runtime/engine/runner.py +171 -130
  54. agentscope_runtime/engine/schemas/agent_schemas.py +114 -3
  55. agentscope_runtime/engine/schemas/modelstudio_llm.py +4 -2
  56. agentscope_runtime/engine/schemas/oai_llm.py +23 -23
  57. agentscope_runtime/engine/schemas/response_api.py +65 -0
  58. agentscope_runtime/engine/schemas/session.py +24 -0
  59. agentscope_runtime/engine/services/__init__.py +0 -9
  60. agentscope_runtime/engine/services/agent_state/__init__.py +16 -0
  61. agentscope_runtime/engine/services/agent_state/redis_state_service.py +113 -0
  62. agentscope_runtime/engine/services/agent_state/state_service.py +179 -0
  63. agentscope_runtime/engine/services/memory/__init__.py +24 -0
  64. agentscope_runtime/engine/services/{mem0_memory_service.py → memory/mem0_memory_service.py} +17 -13
  65. agentscope_runtime/engine/services/{memory_service.py → memory/memory_service.py} +28 -7
  66. agentscope_runtime/engine/services/{redis_memory_service.py → memory/redis_memory_service.py} +1 -1
  67. agentscope_runtime/engine/services/{reme_personal_memory_service.py → memory/reme_personal_memory_service.py} +9 -6
  68. agentscope_runtime/engine/services/{reme_task_memory_service.py → memory/reme_task_memory_service.py} +2 -2
  69. agentscope_runtime/engine/services/{tablestore_memory_service.py → memory/tablestore_memory_service.py} +16 -19
  70. agentscope_runtime/engine/services/sandbox/__init__.py +13 -0
  71. agentscope_runtime/engine/services/{sandbox_service.py → sandbox/sandbox_service.py} +86 -71
  72. agentscope_runtime/engine/services/session_history/__init__.py +23 -0
  73. agentscope_runtime/engine/services/{redis_session_history_service.py → session_history/redis_session_history_service.py} +3 -2
  74. agentscope_runtime/engine/services/{session_history_service.py → session_history/session_history_service.py} +44 -34
  75. agentscope_runtime/engine/services/{tablestore_session_history_service.py → session_history/tablestore_session_history_service.py} +14 -19
  76. agentscope_runtime/engine/services/utils/tablestore_service_utils.py +2 -2
  77. agentscope_runtime/engine/tracing/base.py +10 -9
  78. agentscope_runtime/engine/tracing/message_util.py +1 -1
  79. agentscope_runtime/engine/tracing/tracing_util.py +7 -2
  80. agentscope_runtime/engine/tracing/wrapper.py +49 -31
  81. agentscope_runtime/sandbox/__init__.py +10 -2
  82. agentscope_runtime/sandbox/box/agentbay/__init__.py +4 -0
  83. agentscope_runtime/sandbox/box/agentbay/agentbay_sandbox.py +559 -0
  84. agentscope_runtime/sandbox/box/base/base_sandbox.py +12 -0
  85. agentscope_runtime/sandbox/box/browser/browser_sandbox.py +115 -11
  86. agentscope_runtime/sandbox/box/cloud/__init__.py +4 -0
  87. agentscope_runtime/sandbox/box/cloud/cloud_sandbox.py +254 -0
  88. agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +66 -0
  89. agentscope_runtime/sandbox/box/gui/gui_sandbox.py +42 -0
  90. agentscope_runtime/sandbox/box/mobile/__init__.py +4 -0
  91. agentscope_runtime/sandbox/box/mobile/box/__init__.py +0 -0
  92. agentscope_runtime/sandbox/box/mobile/mobile_sandbox.py +216 -0
  93. agentscope_runtime/sandbox/box/training_box/training_box.py +2 -44
  94. agentscope_runtime/sandbox/client/http_client.py +1 -0
  95. agentscope_runtime/sandbox/enums.py +2 -1
  96. agentscope_runtime/sandbox/manager/sandbox_manager.py +15 -2
  97. agentscope_runtime/sandbox/manager/server/app.py +12 -0
  98. agentscope_runtime/sandbox/manager/server/config.py +19 -0
  99. agentscope_runtime/sandbox/model/manager_config.py +79 -2
  100. agentscope_runtime/sandbox/utils.py +0 -18
  101. agentscope_runtime/tools/RAGs/__init__.py +0 -0
  102. agentscope_runtime/tools/RAGs/modelstudio_rag.py +377 -0
  103. agentscope_runtime/tools/RAGs/modelstudio_rag_lite.py +219 -0
  104. agentscope_runtime/tools/__init__.py +119 -0
  105. agentscope_runtime/tools/_constants.py +18 -0
  106. agentscope_runtime/tools/alipay/__init__.py +4 -0
  107. agentscope_runtime/tools/alipay/base.py +334 -0
  108. agentscope_runtime/tools/alipay/payment.py +835 -0
  109. agentscope_runtime/tools/alipay/subscribe.py +551 -0
  110. agentscope_runtime/tools/base.py +264 -0
  111. agentscope_runtime/tools/cli/__init__.py +0 -0
  112. agentscope_runtime/tools/cli/modelstudio_mcp_server.py +78 -0
  113. agentscope_runtime/tools/generations/__init__.py +75 -0
  114. agentscope_runtime/tools/generations/async_image_to_video.py +350 -0
  115. agentscope_runtime/tools/generations/async_image_to_video_wan25.py +366 -0
  116. agentscope_runtime/tools/generations/async_speech_to_video.py +422 -0
  117. agentscope_runtime/tools/generations/async_text_to_video.py +320 -0
  118. agentscope_runtime/tools/generations/async_text_to_video_wan25.py +334 -0
  119. agentscope_runtime/tools/generations/image_edit.py +208 -0
  120. agentscope_runtime/tools/generations/image_edit_wan25.py +193 -0
  121. agentscope_runtime/tools/generations/image_generation.py +202 -0
  122. agentscope_runtime/tools/generations/image_generation_wan25.py +201 -0
  123. agentscope_runtime/tools/generations/image_style_repaint.py +208 -0
  124. agentscope_runtime/tools/generations/image_to_video.py +233 -0
  125. agentscope_runtime/tools/generations/qwen_image_edit.py +205 -0
  126. agentscope_runtime/tools/generations/qwen_image_generation.py +214 -0
  127. agentscope_runtime/tools/generations/qwen_text_to_speech.py +154 -0
  128. agentscope_runtime/tools/generations/speech_to_text.py +260 -0
  129. agentscope_runtime/tools/generations/speech_to_video.py +314 -0
  130. agentscope_runtime/tools/generations/text_to_video.py +221 -0
  131. agentscope_runtime/tools/mcp_wrapper.py +215 -0
  132. agentscope_runtime/tools/realtime_clients/__init__.py +13 -0
  133. agentscope_runtime/tools/realtime_clients/asr_client.py +27 -0
  134. agentscope_runtime/tools/realtime_clients/azure_asr_client.py +195 -0
  135. agentscope_runtime/tools/realtime_clients/azure_tts_client.py +383 -0
  136. agentscope_runtime/tools/realtime_clients/modelstudio_asr_client.py +151 -0
  137. agentscope_runtime/tools/realtime_clients/modelstudio_tts_client.py +199 -0
  138. agentscope_runtime/tools/realtime_clients/realtime_tool.py +55 -0
  139. agentscope_runtime/tools/realtime_clients/tts_client.py +33 -0
  140. agentscope_runtime/tools/searches/__init__.py +3 -0
  141. agentscope_runtime/tools/searches/modelstudio_search.py +877 -0
  142. agentscope_runtime/tools/searches/modelstudio_search_lite.py +310 -0
  143. agentscope_runtime/tools/utils/__init__.py +0 -0
  144. agentscope_runtime/tools/utils/api_key_util.py +45 -0
  145. agentscope_runtime/tools/utils/crypto_utils.py +99 -0
  146. agentscope_runtime/tools/utils/mcp_util.py +35 -0
  147. agentscope_runtime/version.py +1 -1
  148. {agentscope_runtime-0.2.0b1.dist-info → agentscope_runtime-1.0.0.dist-info}/METADATA +244 -168
  149. agentscope_runtime-1.0.0.dist-info/RECORD +240 -0
  150. {agentscope_runtime-0.2.0b1.dist-info → agentscope_runtime-1.0.0.dist-info}/entry_points.txt +1 -0
  151. agentscope_runtime/engine/agents/__init__.py +0 -2
  152. agentscope_runtime/engine/agents/agentscope_agent.py +0 -488
  153. agentscope_runtime/engine/agents/agno_agent.py +0 -222
  154. agentscope_runtime/engine/agents/autogen_agent.py +0 -250
  155. agentscope_runtime/engine/agents/base_agent.py +0 -29
  156. agentscope_runtime/engine/agents/langgraph_agent.py +0 -59
  157. agentscope_runtime/engine/agents/utils.py +0 -53
  158. agentscope_runtime/engine/deployers/utils/package_project_utils.py +0 -1163
  159. agentscope_runtime/engine/deployers/utils/service_utils/service_config.py +0 -75
  160. agentscope_runtime/engine/deployers/utils/service_utils/service_factory.py +0 -220
  161. agentscope_runtime/engine/helpers/helper.py +0 -179
  162. agentscope_runtime/engine/schemas/context.py +0 -54
  163. agentscope_runtime/engine/services/context_manager.py +0 -164
  164. agentscope_runtime/engine/services/environment_manager.py +0 -50
  165. agentscope_runtime/engine/services/manager.py +0 -174
  166. agentscope_runtime/engine/services/rag_service.py +0 -195
  167. agentscope_runtime/engine/services/tablestore_rag_service.py +0 -143
  168. agentscope_runtime/sandbox/tools/__init__.py +0 -12
  169. agentscope_runtime/sandbox/tools/base/__init__.py +0 -8
  170. agentscope_runtime/sandbox/tools/base/tool.py +0 -52
  171. agentscope_runtime/sandbox/tools/browser/__init__.py +0 -57
  172. agentscope_runtime/sandbox/tools/browser/tool.py +0 -597
  173. agentscope_runtime/sandbox/tools/filesystem/__init__.py +0 -32
  174. agentscope_runtime/sandbox/tools/filesystem/tool.py +0 -319
  175. agentscope_runtime/sandbox/tools/function_tool.py +0 -321
  176. agentscope_runtime/sandbox/tools/gui/__init__.py +0 -7
  177. agentscope_runtime/sandbox/tools/gui/tool.py +0 -77
  178. agentscope_runtime/sandbox/tools/mcp_tool.py +0 -195
  179. agentscope_runtime/sandbox/tools/sandbox_tool.py +0 -104
  180. agentscope_runtime/sandbox/tools/tool.py +0 -238
  181. agentscope_runtime/sandbox/tools/utils.py +0 -68
  182. agentscope_runtime-0.2.0b1.dist-info/RECORD +0 -183
  183. {agentscope_runtime-0.2.0b1.dist-info → agentscope_runtime-1.0.0.dist-info}/WHEEL +0 -0
  184. {agentscope_runtime-0.2.0b1.dist-info → agentscope_runtime-1.0.0.dist-info}/licenses/LICENSE +0 -0
  185. {agentscope_runtime-0.2.0b1.dist-info → agentscope_runtime-1.0.0.dist-info}/top_level.txt +0 -0
@@ -1,597 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # flake8: noqa: E501
3
- # pylint: disable=line-too-long
4
- from typing import Dict
5
-
6
- from ..base.tool import RunIPythonCellTool, RunShellCommandTool
7
- from ..sandbox_tool import SandboxTool
8
-
9
-
10
- class _RunIPythonCellTool(RunIPythonCellTool):
11
- """Tool for running IPython cells."""
12
-
13
- _sandbox_type: str = "browser"
14
- _tool_type: str = "generic"
15
-
16
-
17
- class _RunShellCommandTool(RunShellCommandTool):
18
- """Tool for running shell commands."""
19
-
20
- _sandbox_type: str = "browser"
21
- _tool_type: str = "generic"
22
-
23
-
24
- class BrowserCloseTool(SandboxTool):
25
- """Tool for closing the browser page."""
26
-
27
- _name: str = "browser_close"
28
- _sandbox_type: str = "browser"
29
- _tool_type: str = "playwright"
30
- _schema: Dict = {
31
- "name": "browser_close",
32
- "description": "Close the page",
33
- "parameters": {
34
- "type": "object",
35
- "properties": {},
36
- "required": [],
37
- },
38
- }
39
-
40
-
41
- class BrowserResizeTool(SandboxTool):
42
- """Tool for resizing the browser window."""
43
-
44
- _name: str = "browser_resize"
45
- _sandbox_type: str = "browser"
46
- _tool_type: str = "playwright"
47
- _schema: Dict = {
48
- "name": "browser_resize",
49
- "description": "Resize the browser window",
50
- "parameters": {
51
- "type": "object",
52
- "properties": {
53
- "width": {
54
- "type": "number",
55
- "description": "Width of the browser window",
56
- },
57
- "height": {
58
- "type": "number",
59
- "description": "Height of the browser window",
60
- },
61
- },
62
- "required": ["width", "height"],
63
- },
64
- }
65
-
66
-
67
- class BrowserConsoleMessagesTool(SandboxTool):
68
- """Tool for returning all console messages."""
69
-
70
- _name: str = "browser_console_messages"
71
- _sandbox_type: str = "browser"
72
- _tool_type: str = "playwright"
73
- _schema: Dict = {
74
- "name": "browser_console_messages",
75
- "description": "Returns all console messages",
76
- "parameters": {
77
- "type": "object",
78
- "properties": {},
79
- "required": [],
80
- },
81
- }
82
-
83
-
84
- class BrowserHandleDialogTool(SandboxTool):
85
- """Tool for handling a dialog."""
86
-
87
- _name: str = "browser_handle_dialog"
88
- _sandbox_type: str = "browser"
89
- _tool_type: str = "playwright"
90
- _schema: Dict = {
91
- "name": "browser_handle_dialog",
92
- "description": "Handle a dialog",
93
- "parameters": {
94
- "type": "object",
95
- "properties": {
96
- "accept": {
97
- "type": "boolean",
98
- "description": "Whether to accept the dialog.",
99
- },
100
- "promptText": {
101
- "type": "string",
102
- "description": "The text of the prompt in case of a prompt dialog.",
103
- },
104
- },
105
- "required": ["accept"],
106
- },
107
- }
108
-
109
-
110
- class BrowserFileUploadTool(SandboxTool):
111
- """Tool for uploading one or multiple files."""
112
-
113
- _name: str = "browser_file_upload"
114
- _sandbox_type: str = "browser"
115
- _tool_type: str = "playwright"
116
- _schema: Dict = {
117
- "name": "browser_file_upload",
118
- "description": "Upload one or multiple files",
119
- "parameters": {
120
- "type": "object",
121
- "properties": {
122
- "paths": {
123
- "type": "array",
124
- "items": {
125
- "type": "string",
126
- },
127
- "description": "The absolute paths to the files to upload. Can be a single file or multiple files.",
128
- },
129
- },
130
- "required": ["paths"],
131
- },
132
- }
133
-
134
-
135
- class BrowserPressKeyTool(SandboxTool):
136
- """Tool for pressing a key on the keyboard."""
137
-
138
- _name: str = "browser_press_key"
139
- _sandbox_type: str = "browser"
140
- _tool_type: str = "playwright"
141
- _schema: Dict = {
142
- "name": "browser_press_key",
143
- "description": "Press a key on the keyboard",
144
- "parameters": {
145
- "type": "object",
146
- "properties": {
147
- "key": {
148
- "type": "string",
149
- "description": "Name of the key to press or a character to generate, such as `ArrowLeft` or `a`",
150
- },
151
- },
152
- "required": ["key"],
153
- },
154
- }
155
-
156
-
157
- class BrowserNavigateTool(SandboxTool):
158
- """Tool for navigating to a URL."""
159
-
160
- _name: str = "browser_navigate"
161
- _sandbox_type: str = "browser"
162
- _tool_type: str = "playwright"
163
- _schema: Dict = {
164
- "name": "browser_navigate",
165
- "description": "Navigate to a URL",
166
- "parameters": {
167
- "type": "object",
168
- "properties": {
169
- "url": {
170
- "type": "string",
171
- "description": "The URL to navigate to",
172
- },
173
- },
174
- "required": ["url"],
175
- },
176
- }
177
-
178
-
179
- class BrowserNavigateBackTool(SandboxTool):
180
- """Tool for going back to the previous page."""
181
-
182
- _name: str = "browser_navigate_back"
183
- _sandbox_type: str = "browser"
184
- _tool_type: str = "playwright"
185
- _schema: Dict = {
186
- "name": "browser_navigate_back",
187
- "description": "Go back to the previous page",
188
- "parameters": {
189
- "type": "object",
190
- "properties": {},
191
- "required": [],
192
- },
193
- }
194
-
195
-
196
- class BrowserNavigateForwardTool(SandboxTool):
197
- """Tool for going forward to the next page."""
198
-
199
- _name: str = "browser_navigate_forward"
200
- _sandbox_type: str = "browser"
201
- _tool_type: str = "playwright"
202
- _schema: Dict = {
203
- "name": "browser_navigate_forward",
204
- "description": "Go forward to the next page",
205
- "parameters": {
206
- "type": "object",
207
- "properties": {},
208
- "required": [],
209
- },
210
- }
211
-
212
-
213
- class BrowserNetworkRequestsTool(SandboxTool):
214
- """Tool for returning all network requests since loading the page."""
215
-
216
- _name: str = "browser_network_requests"
217
- _sandbox_type: str = "browser"
218
- _tool_type: str = "playwright"
219
- _schema: Dict = {
220
- "name": "browser_network_requests",
221
- "description": "Returns all network requests since loading the page",
222
- "parameters": {
223
- "type": "object",
224
- "properties": {},
225
- "required": [],
226
- },
227
- }
228
-
229
-
230
- class BrowserPdfSaveTool(SandboxTool):
231
- """Tool for saving a page as PDF."""
232
-
233
- _name: str = "browser_pdf_save"
234
- _sandbox_type: str = "browser"
235
- _tool_type: str = "playwright"
236
- _schema: Dict = {
237
- "name": "browser_pdf_save",
238
- "description": "Save page as PDF",
239
- "parameters": {
240
- "type": "object",
241
- "properties": {
242
- "filename": {
243
- "type": "string",
244
- "description": "File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.",
245
- },
246
- },
247
- "required": [],
248
- },
249
- }
250
-
251
-
252
- class BrowserTakeScreenshotTool(SandboxTool):
253
- """Tool for taking a screenshot of the current page."""
254
-
255
- _name: str = "browser_take_screenshot"
256
- _sandbox_type: str = "browser"
257
- _tool_type: str = "playwright"
258
- _schema: Dict = {
259
- "name": "browser_take_screenshot",
260
- "description": "Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.",
261
- "parameters": {
262
- "type": "object",
263
- "properties": {
264
- "raw": {
265
- "type": "boolean",
266
- "description": "Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.",
267
- },
268
- "filename": {
269
- "type": "string",
270
- "description": "File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.",
271
- },
272
- "element": {
273
- "type": "string",
274
- "description": "Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.",
275
- },
276
- "ref": {
277
- "type": "string",
278
- "description": "Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.",
279
- },
280
- },
281
- "required": [],
282
- },
283
- }
284
-
285
-
286
- class BrowserSnapshotTool(SandboxTool):
287
- """Tool for capturing an accessibility snapshot of the current page."""
288
-
289
- _name: str = "browser_snapshot"
290
- _sandbox_type: str = "browser"
291
- _tool_type: str = "playwright"
292
- _schema: Dict = {
293
- "name": "browser_snapshot",
294
- "description": "Capture accessibility snapshot of the current page, this is better than screenshot",
295
- "parameters": {
296
- "type": "object",
297
- "properties": {},
298
- "required": [],
299
- },
300
- }
301
-
302
-
303
- class BrowserClickTool(SandboxTool):
304
- """Tool for performing a click on a web page."""
305
-
306
- _name: str = "browser_click"
307
- _sandbox_type: str = "browser"
308
- _tool_type: str = "playwright"
309
- _schema: Dict = {
310
- "name": "browser_click",
311
- "description": "Perform click on a web page",
312
- "parameters": {
313
- "type": "object",
314
- "properties": {
315
- "element": {
316
- "type": "string",
317
- "description": "Human-readable element description used to obtain permission to interact with the element",
318
- },
319
- "ref": {
320
- "type": "string",
321
- "description": "Exact target element reference from the page snapshot",
322
- },
323
- },
324
- "required": ["element", "ref"],
325
- },
326
- }
327
-
328
-
329
- class BrowserDragTool(SandboxTool):
330
- """Tool for performing drag and drop between two elements."""
331
-
332
- _name: str = "browser_drag"
333
- _sandbox_type: str = "browser"
334
- _tool_type: str = "playwright"
335
- _schema: Dict = {
336
- "name": "browser_drag",
337
- "description": "Perform drag and drop between two elements",
338
- "parameters": {
339
- "type": "object",
340
- "properties": {
341
- "startElement": {
342
- "type": "string",
343
- "description": "Human-readable source element description used to obtain the permission to interact with the element",
344
- },
345
- "startRef": {
346
- "type": "string",
347
- "description": "Exact source element reference from the page snapshot",
348
- },
349
- "endElement": {
350
- "type": "string",
351
- "description": "Human-readable target element description used to obtain the permission to interact with the element",
352
- },
353
- "endRef": {
354
- "type": "string",
355
- "description": "Exact target element reference from the page snapshot",
356
- },
357
- },
358
- "required": ["startElement", "startRef", "endElement", "endRef"],
359
- },
360
- }
361
-
362
-
363
- class BrowserHoverTool(SandboxTool):
364
- """Tool for hovering over an element on a page."""
365
-
366
- _name: str = "browser_hover"
367
- _sandbox_type: str = "browser"
368
- _tool_type: str = "playwright"
369
- _schema: Dict = {
370
- "name": "browser_hover",
371
- "description": "Hover over an element on a page",
372
- "parameters": {
373
- "type": "object",
374
- "properties": {
375
- "element": {
376
- "type": "string",
377
- "description": "Human-readable element description used to obtain permission to interact with the element",
378
- },
379
- "ref": {
380
- "type": "string",
381
- "description": "Exact target element reference from the page snapshot",
382
- },
383
- },
384
- "required": ["element", "ref"],
385
- },
386
- }
387
-
388
-
389
- class BrowserTypeTool(SandboxTool):
390
- """Tool for typing text into an editable element."""
391
-
392
- _name: str = "browser_type"
393
- _sandbox_type: str = "browser"
394
- _tool_type: str = "playwright"
395
- _schema: Dict = {
396
- "name": "browser_type",
397
- "description": "Type text into an editable element",
398
- "parameters": {
399
- "type": "object",
400
- "properties": {
401
- "element": {
402
- "type": "string",
403
- "description": "Human-readable element description used to obtain permission to interact with the element",
404
- },
405
- "ref": {
406
- "type": "string",
407
- "description": "Exact target element reference from the page snapshot",
408
- },
409
- "text": {
410
- "type": "string",
411
- "description": "Text to type into the element",
412
- },
413
- "submit": {
414
- "type": "boolean",
415
- "description": "Whether to submit entered text (press Enter after)",
416
- },
417
- "slowly": {
418
- "type": "boolean",
419
- "description": "Whether to type one character at a time. Useful for triggering key handlers in the page. By default, the entire text is filled in at once.",
420
- },
421
- },
422
- "required": ["element", "ref", "text"],
423
- },
424
- }
425
-
426
-
427
- class BrowserSelectOptionTool(SandboxTool):
428
- """Tool for selecting an option in a dropdown."""
429
-
430
- _name: str = "browser_select_option"
431
- _sandbox_type: str = "browser"
432
- _tool_type: str = "playwright"
433
- _schema: Dict = {
434
- "name": "browser_select_option",
435
- "description": "Select an option in a dropdown",
436
- "parameters": {
437
- "type": "object",
438
- "properties": {
439
- "element": {
440
- "type": "string",
441
- "description": "Human-readable element description used to obtain permission to interact with the element",
442
- },
443
- "ref": {
444
- "type": "string",
445
- "description": "Exact target element reference from the page snapshot",
446
- },
447
- "values": {
448
- "type": "array",
449
- "items": {
450
- "type": "string",
451
- },
452
- "description": "Array of values to select in the dropdown. This can be a single value or multiple values.",
453
- },
454
- },
455
- "required": ["element", "ref", "values"],
456
- },
457
- }
458
-
459
-
460
- class BrowserTabListTool(SandboxTool):
461
- """Tool for listing browser tabs."""
462
-
463
- _name: str = "browser_tab_list"
464
- _sandbox_type: str = "browser"
465
- _tool_type: str = "playwright"
466
- _schema: Dict = {
467
- "name": "browser_tab_list",
468
- "description": "List browser tabs",
469
- "parameters": {
470
- "type": "object",
471
- "properties": {},
472
- "required": [],
473
- },
474
- }
475
-
476
-
477
- class BrowserTabNewTool(SandboxTool):
478
- """Tool for opening a new tab."""
479
-
480
- _name: str = "browser_tab_new"
481
- _sandbox_type: str = "browser"
482
- _tool_type: str = "playwright"
483
- _schema: Dict = {
484
- "name": "browser_tab_new",
485
- "description": "Open a new tab",
486
- "parameters": {
487
- "type": "object",
488
- "properties": {
489
- "url": {
490
- "type": "string",
491
- "description": "The URL to navigate to in the new tab. If not provided, the new tab will be blank.",
492
- },
493
- },
494
- "required": [],
495
- },
496
- }
497
-
498
-
499
- class BrowserTabSelectTool(SandboxTool):
500
- """Tool for selecting a tab by index."""
501
-
502
- _name: str = "browser_tab_select"
503
- _sandbox_type: str = "browser"
504
- _tool_type: str = "playwright"
505
- _schema: Dict = {
506
- "name": "browser_tab_select",
507
- "description": "Select a tab by index",
508
- "parameters": {
509
- "type": "object",
510
- "properties": {
511
- "index": {
512
- "type": "number",
513
- "description": "The index of the tab to select",
514
- },
515
- },
516
- "required": ["index"],
517
- },
518
- }
519
-
520
-
521
- class BrowserTabCloseTool(SandboxTool):
522
- """Tool for closing a tab."""
523
-
524
- _name: str = "browser_tab_close"
525
- _sandbox_type: str = "browser"
526
- _tool_type: str = "playwright"
527
- _schema: Dict = {
528
- "name": "browser_tab_close",
529
- "description": "Close a tab",
530
- "parameters": {
531
- "type": "object",
532
- "properties": {
533
- "index": {
534
- "type": "number",
535
- "description": "The index of the tab to close. Closes current tab if not provided.",
536
- },
537
- },
538
- "required": [],
539
- },
540
- }
541
-
542
-
543
- class BrowserWaitForTool(SandboxTool):
544
- """Tool for waiting for text to appear or disappear or for a specified time to pass."""
545
-
546
- _name: str = "browser_wait_for"
547
- _sandbox_type: str = "browser"
548
- _tool_type: str = "playwright"
549
- _schema: Dict = {
550
- "name": "browser_wait_for",
551
- "description": "Wait for text to appear or disappear or a specified time to pass",
552
- "parameters": {
553
- "type": "object",
554
- "properties": {
555
- "time": {
556
- "type": "number",
557
- "description": "The time to wait in seconds",
558
- },
559
- "text": {
560
- "type": "string",
561
- "description": "The text to wait for",
562
- },
563
- "textGone": {
564
- "type": "string",
565
- "description": "The text to wait for to disappear",
566
- },
567
- },
568
- "required": [],
569
- },
570
- }
571
-
572
-
573
- run_shell_command = _RunShellCommandTool()
574
- run_ipython_cell = _RunIPythonCellTool()
575
- browser_close = BrowserCloseTool()
576
- browser_resize = BrowserResizeTool()
577
- browser_console_messages = BrowserConsoleMessagesTool()
578
- browser_handle_dialog = BrowserHandleDialogTool()
579
- browser_file_upload = BrowserFileUploadTool()
580
- browser_press_key = BrowserPressKeyTool()
581
- browser_navigate = BrowserNavigateTool()
582
- browser_navigate_back = BrowserNavigateBackTool()
583
- browser_navigate_forward = BrowserNavigateForwardTool()
584
- browser_network_requests = BrowserNetworkRequestsTool()
585
- browser_pdf_save = BrowserPdfSaveTool()
586
- browser_take_screenshot = BrowserTakeScreenshotTool()
587
- browser_snapshot = BrowserSnapshotTool()
588
- browser_click = BrowserClickTool()
589
- browser_drag = BrowserDragTool()
590
- browser_hover = BrowserHoverTool()
591
- browser_type = BrowserTypeTool()
592
- browser_select_option = BrowserSelectOptionTool()
593
- browser_tab_list = BrowserTabListTool()
594
- browser_tab_new = BrowserTabNewTool()
595
- browser_tab_select = BrowserTabSelectTool()
596
- browser_tab_close = BrowserTabCloseTool()
597
- browser_wait_for = BrowserWaitForTool()
@@ -1,32 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from .tool import (
3
- run_shell_command,
4
- run_ipython_cell,
5
- read_file,
6
- read_multiple_files,
7
- write_file,
8
- edit_file,
9
- create_directory,
10
- list_directory,
11
- directory_tree,
12
- move_file,
13
- search_files,
14
- get_file_info,
15
- list_allowed_directories,
16
- )
17
-
18
- __all__ = [
19
- "run_shell_command",
20
- "run_ipython_cell",
21
- "read_file",
22
- "read_multiple_files",
23
- "write_file",
24
- "edit_file",
25
- "create_directory",
26
- "list_directory",
27
- "directory_tree",
28
- "move_file",
29
- "search_files",
30
- "get_file_info",
31
- "list_allowed_directories",
32
- ]