agentrun-inner-test 0.0.62__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.

Potentially problematic release.


This version of agentrun-inner-test might be problematic. Click here for more details.

Files changed (154) hide show
  1. agentrun/__init__.py +358 -0
  2. agentrun/agent_runtime/__client_async_template.py +466 -0
  3. agentrun/agent_runtime/__endpoint_async_template.py +345 -0
  4. agentrun/agent_runtime/__init__.py +53 -0
  5. agentrun/agent_runtime/__runtime_async_template.py +477 -0
  6. agentrun/agent_runtime/api/__data_async_template.py +58 -0
  7. agentrun/agent_runtime/api/__init__.py +6 -0
  8. agentrun/agent_runtime/api/control.py +1362 -0
  9. agentrun/agent_runtime/api/data.py +98 -0
  10. agentrun/agent_runtime/client.py +868 -0
  11. agentrun/agent_runtime/endpoint.py +649 -0
  12. agentrun/agent_runtime/model.py +362 -0
  13. agentrun/agent_runtime/runtime.py +904 -0
  14. agentrun/credential/__client_async_template.py +177 -0
  15. agentrun/credential/__credential_async_template.py +216 -0
  16. agentrun/credential/__init__.py +28 -0
  17. agentrun/credential/api/__init__.py +5 -0
  18. agentrun/credential/api/control.py +606 -0
  19. agentrun/credential/client.py +319 -0
  20. agentrun/credential/credential.py +381 -0
  21. agentrun/credential/model.py +248 -0
  22. agentrun/integration/__init__.py +21 -0
  23. agentrun/integration/agentscope/__init__.py +13 -0
  24. agentrun/integration/agentscope/adapter.py +17 -0
  25. agentrun/integration/agentscope/builtin.py +88 -0
  26. agentrun/integration/agentscope/message_adapter.py +185 -0
  27. agentrun/integration/agentscope/model_adapter.py +60 -0
  28. agentrun/integration/agentscope/tool_adapter.py +59 -0
  29. agentrun/integration/builtin/__init__.py +18 -0
  30. agentrun/integration/builtin/knowledgebase.py +137 -0
  31. agentrun/integration/builtin/model.py +93 -0
  32. agentrun/integration/builtin/sandbox.py +1234 -0
  33. agentrun/integration/builtin/toolset.py +47 -0
  34. agentrun/integration/crewai/__init__.py +13 -0
  35. agentrun/integration/crewai/adapter.py +9 -0
  36. agentrun/integration/crewai/builtin.py +88 -0
  37. agentrun/integration/crewai/model_adapter.py +31 -0
  38. agentrun/integration/crewai/tool_adapter.py +26 -0
  39. agentrun/integration/google_adk/__init__.py +13 -0
  40. agentrun/integration/google_adk/adapter.py +15 -0
  41. agentrun/integration/google_adk/builtin.py +88 -0
  42. agentrun/integration/google_adk/message_adapter.py +144 -0
  43. agentrun/integration/google_adk/model_adapter.py +46 -0
  44. agentrun/integration/google_adk/tool_adapter.py +235 -0
  45. agentrun/integration/langchain/__init__.py +31 -0
  46. agentrun/integration/langchain/adapter.py +15 -0
  47. agentrun/integration/langchain/builtin.py +94 -0
  48. agentrun/integration/langchain/message_adapter.py +141 -0
  49. agentrun/integration/langchain/model_adapter.py +37 -0
  50. agentrun/integration/langchain/tool_adapter.py +50 -0
  51. agentrun/integration/langgraph/__init__.py +36 -0
  52. agentrun/integration/langgraph/adapter.py +20 -0
  53. agentrun/integration/langgraph/agent_converter.py +1073 -0
  54. agentrun/integration/langgraph/builtin.py +88 -0
  55. agentrun/integration/pydantic_ai/__init__.py +13 -0
  56. agentrun/integration/pydantic_ai/adapter.py +13 -0
  57. agentrun/integration/pydantic_ai/builtin.py +88 -0
  58. agentrun/integration/pydantic_ai/model_adapter.py +44 -0
  59. agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
  60. agentrun/integration/utils/__init__.py +112 -0
  61. agentrun/integration/utils/adapter.py +560 -0
  62. agentrun/integration/utils/canonical.py +164 -0
  63. agentrun/integration/utils/converter.py +134 -0
  64. agentrun/integration/utils/model.py +110 -0
  65. agentrun/integration/utils/tool.py +1759 -0
  66. agentrun/knowledgebase/__client_async_template.py +173 -0
  67. agentrun/knowledgebase/__init__.py +53 -0
  68. agentrun/knowledgebase/__knowledgebase_async_template.py +438 -0
  69. agentrun/knowledgebase/api/__data_async_template.py +414 -0
  70. agentrun/knowledgebase/api/__init__.py +19 -0
  71. agentrun/knowledgebase/api/control.py +606 -0
  72. agentrun/knowledgebase/api/data.py +624 -0
  73. agentrun/knowledgebase/client.py +311 -0
  74. agentrun/knowledgebase/knowledgebase.py +748 -0
  75. agentrun/knowledgebase/model.py +270 -0
  76. agentrun/memory_collection/__client_async_template.py +178 -0
  77. agentrun/memory_collection/__init__.py +37 -0
  78. agentrun/memory_collection/__memory_collection_async_template.py +457 -0
  79. agentrun/memory_collection/api/__init__.py +5 -0
  80. agentrun/memory_collection/api/control.py +610 -0
  81. agentrun/memory_collection/client.py +323 -0
  82. agentrun/memory_collection/memory_collection.py +844 -0
  83. agentrun/memory_collection/model.py +162 -0
  84. agentrun/model/__client_async_template.py +357 -0
  85. agentrun/model/__init__.py +57 -0
  86. agentrun/model/__model_proxy_async_template.py +270 -0
  87. agentrun/model/__model_service_async_template.py +267 -0
  88. agentrun/model/api/__init__.py +6 -0
  89. agentrun/model/api/control.py +1173 -0
  90. agentrun/model/api/data.py +196 -0
  91. agentrun/model/client.py +674 -0
  92. agentrun/model/model.py +235 -0
  93. agentrun/model/model_proxy.py +439 -0
  94. agentrun/model/model_service.py +438 -0
  95. agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
  96. agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
  97. agentrun/sandbox/__client_async_template.py +491 -0
  98. agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
  99. agentrun/sandbox/__init__.py +69 -0
  100. agentrun/sandbox/__sandbox_async_template.py +463 -0
  101. agentrun/sandbox/__template_async_template.py +152 -0
  102. agentrun/sandbox/aio_sandbox.py +912 -0
  103. agentrun/sandbox/api/__aio_data_async_template.py +335 -0
  104. agentrun/sandbox/api/__browser_data_async_template.py +140 -0
  105. agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
  106. agentrun/sandbox/api/__init__.py +19 -0
  107. agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
  108. agentrun/sandbox/api/aio_data.py +551 -0
  109. agentrun/sandbox/api/browser_data.py +172 -0
  110. agentrun/sandbox/api/code_interpreter_data.py +396 -0
  111. agentrun/sandbox/api/control.py +1051 -0
  112. agentrun/sandbox/api/playwright_async.py +492 -0
  113. agentrun/sandbox/api/playwright_sync.py +492 -0
  114. agentrun/sandbox/api/sandbox_data.py +154 -0
  115. agentrun/sandbox/browser_sandbox.py +185 -0
  116. agentrun/sandbox/client.py +925 -0
  117. agentrun/sandbox/code_interpreter_sandbox.py +823 -0
  118. agentrun/sandbox/model.py +384 -0
  119. agentrun/sandbox/sandbox.py +848 -0
  120. agentrun/sandbox/template.py +217 -0
  121. agentrun/server/__init__.py +191 -0
  122. agentrun/server/agui_normalizer.py +180 -0
  123. agentrun/server/agui_protocol.py +797 -0
  124. agentrun/server/invoker.py +309 -0
  125. agentrun/server/model.py +427 -0
  126. agentrun/server/openai_protocol.py +535 -0
  127. agentrun/server/protocol.py +140 -0
  128. agentrun/server/server.py +208 -0
  129. agentrun/toolset/__client_async_template.py +62 -0
  130. agentrun/toolset/__init__.py +51 -0
  131. agentrun/toolset/__toolset_async_template.py +204 -0
  132. agentrun/toolset/api/__init__.py +17 -0
  133. agentrun/toolset/api/control.py +262 -0
  134. agentrun/toolset/api/mcp.py +100 -0
  135. agentrun/toolset/api/openapi.py +1251 -0
  136. agentrun/toolset/client.py +102 -0
  137. agentrun/toolset/model.py +321 -0
  138. agentrun/toolset/toolset.py +271 -0
  139. agentrun/utils/__data_api_async_template.py +721 -0
  140. agentrun/utils/__init__.py +5 -0
  141. agentrun/utils/__resource_async_template.py +158 -0
  142. agentrun/utils/config.py +270 -0
  143. agentrun/utils/control_api.py +105 -0
  144. agentrun/utils/data_api.py +1121 -0
  145. agentrun/utils/exception.py +151 -0
  146. agentrun/utils/helper.py +108 -0
  147. agentrun/utils/log.py +77 -0
  148. agentrun/utils/model.py +168 -0
  149. agentrun/utils/resource.py +291 -0
  150. agentrun_inner_test-0.0.62.dist-info/METADATA +265 -0
  151. agentrun_inner_test-0.0.62.dist-info/RECORD +154 -0
  152. agentrun_inner_test-0.0.62.dist-info/WHEEL +5 -0
  153. agentrun_inner_test-0.0.62.dist-info/licenses/LICENSE +201 -0
  154. agentrun_inner_test-0.0.62.dist-info/top_level.txt +1 -0
@@ -0,0 +1,463 @@
1
+ """代码解释器沙箱高层API模板 / Code Interpreter Sandbox High-Level API Template
2
+
3
+ 此模板用于生成代码解释器沙箱资源的高级API代码。
4
+ This template is used to generate high-level API code for code interpreter sandbox resources.
5
+ """
6
+
7
+ import asyncio
8
+ import time
9
+ from typing import Optional
10
+
11
+ from agentrun.sandbox.api.code_interpreter_data import CodeInterpreterDataAPI
12
+ from agentrun.sandbox.model import CodeLanguage, TemplateType
13
+ from agentrun.utils.exception import ServerError
14
+ from agentrun.utils.log import logger
15
+
16
+ from .sandbox import Sandbox
17
+
18
+
19
+ class FileOperations:
20
+ """File upload/download operations."""
21
+
22
+ def __init__(self, sandbox: "CodeInterpreterSandbox"):
23
+ self._sandbox = sandbox
24
+
25
+ async def read_async(self, path: str):
26
+ """Read a file from the code interpreter (async).
27
+ Args:
28
+ path: Remote file path in the code interpreter
29
+ Returns:
30
+ File content
31
+ """
32
+ return await self._sandbox.data_api.read_file_async(path=path)
33
+
34
+ async def write_async(
35
+ self,
36
+ path: str,
37
+ content: str,
38
+ mode: str = "644",
39
+ encoding: str = "utf-8",
40
+ create_dir=True,
41
+ ):
42
+ """Write a file to the code interpreter (async).
43
+ Args:
44
+ path: Remote file path in the code interpreter
45
+ content: File content
46
+ """
47
+ return await self._sandbox.data_api.write_file_async(
48
+ path=path,
49
+ content=content,
50
+ mode=mode,
51
+ encoding=encoding,
52
+ create_dir=create_dir,
53
+ )
54
+
55
+
56
+ class FileSystemOperations:
57
+ """File system operations (list, move, remove, stat, mkdir)."""
58
+
59
+ def __init__(self, sandbox: "CodeInterpreterSandbox"):
60
+ self._sandbox = sandbox
61
+
62
+ async def list_async(
63
+ self, path: Optional[str] = None, depth: Optional[int] = None
64
+ ):
65
+ """List directory contents (async).
66
+
67
+ Args:
68
+ path: Directory path (optional)
69
+ depth: Traversal depth (optional)
70
+
71
+ Returns:
72
+ Directory contents
73
+ """
74
+ return await self._sandbox.data_api.list_directory_async(
75
+ path=path, depth=depth
76
+ )
77
+
78
+ async def move_async(self, source: str, destination: str):
79
+ """Move a file or directory (async).
80
+
81
+ Args:
82
+ source: Source file or directory path
83
+ destination: Target file or directory path
84
+
85
+ Returns:
86
+ Move operation result
87
+ """
88
+ return await self._sandbox.data_api.move_file_async(
89
+ source=source, destination=destination
90
+ )
91
+
92
+ async def remove_async(self, path: str):
93
+ """Remove a file or directory (async).
94
+
95
+ Args:
96
+ path: File or directory path to remove
97
+
98
+ Returns:
99
+ Remove operation result
100
+ """
101
+ return await self._sandbox.data_api.remove_file_async(path=path)
102
+
103
+ async def stat_async(self, path: str):
104
+ """Get file or directory statistics (async).
105
+
106
+ Args:
107
+ path: File or directory path
108
+
109
+ Returns:
110
+ File/directory statistics
111
+ """
112
+ return await self._sandbox.data_api.stat_async(path=path)
113
+
114
+ async def mkdir_async(
115
+ self,
116
+ path: str,
117
+ parents: Optional[bool] = True,
118
+ mode: Optional[str] = "0755",
119
+ ):
120
+ """Create a directory (async).
121
+
122
+ Args:
123
+ path: Directory path to create
124
+ parents: Whether to create parent directories (default: True)
125
+ mode: Directory permissions mode (default: "0755")
126
+
127
+ Returns:
128
+ Mkdir operation result
129
+ """
130
+ return await self._sandbox.data_api.mkdir_async(
131
+ path=path, parents=parents, mode=mode
132
+ )
133
+
134
+ async def upload_async(
135
+ self,
136
+ local_file_path: str,
137
+ target_file_path: str,
138
+ ):
139
+ """Upload a file to the code interpreter (async).
140
+
141
+ Args:
142
+ local_file_path: Local file path to upload
143
+ target_file_path: Target file path in code interpreter
144
+
145
+ Returns:
146
+ Upload result
147
+ """
148
+ return await self._sandbox.data_api.upload_file_async(
149
+ local_file_path=local_file_path, target_file_path=target_file_path
150
+ )
151
+
152
+ async def download_async(self, path: str, save_path: str):
153
+ """Download a file from the code interpreter (async).
154
+
155
+ Args:
156
+ path: Remote file path in the code interpreter
157
+ save_path: Local file path to save the downloaded file
158
+
159
+ Returns:
160
+ Download result with 'saved_path' and 'size'
161
+ """
162
+ return await self._sandbox.data_api.download_file_async(
163
+ path=path, save_path=save_path
164
+ )
165
+
166
+
167
+ class ProcessOperations:
168
+ """Process management operations."""
169
+
170
+ def __init__(self, sandbox: "CodeInterpreterSandbox"):
171
+ self._sandbox = sandbox
172
+
173
+ async def cmd_async(
174
+ self, command: str, cwd: str, timeout: Optional[int] = 30
175
+ ):
176
+ """Execute a command in the code interpreter (async).
177
+
178
+ Args:
179
+ command: Command to execute
180
+ cwd: Working directory
181
+ timeout: Execution timeout in seconds (default: 30)
182
+
183
+ Returns:
184
+ Command execution result
185
+ """
186
+ return await self._sandbox.data_api.cmd_async(
187
+ command=command, cwd=cwd, timeout=timeout
188
+ )
189
+
190
+ async def list_async(self):
191
+ """List all processes (async).
192
+
193
+ Returns:
194
+ List of processes
195
+ """
196
+ return await self._sandbox.data_api.list_processes_async()
197
+
198
+ async def get_async(self, pid: str):
199
+ """Get a specific process by PID (async).
200
+
201
+ Args:
202
+ pid: Process ID
203
+
204
+ Returns:
205
+ Process information
206
+ """
207
+ return await self._sandbox.data_api.get_process_async(pid=pid)
208
+
209
+ async def kill_async(self, pid: str):
210
+ """Kill a specific process by PID (async).
211
+
212
+ Args:
213
+ pid: Process ID
214
+
215
+ Returns:
216
+ Kill operation result
217
+ """
218
+ return await self._sandbox.data_api.kill_process_async(pid=pid)
219
+
220
+
221
+ class ContextOperations:
222
+ """Context management operations."""
223
+
224
+ def __init__(self, sandbox: "CodeInterpreterSandbox"):
225
+ self._sandbox = sandbox
226
+ self._context_id: Optional[str] = None
227
+ self._language: Optional[str] = None
228
+ self._cwd: Optional[str] = None
229
+
230
+ @property
231
+ def context_id(self) -> Optional[str]:
232
+ """Get the current context ID."""
233
+ return self._context_id
234
+
235
+ async def list_async(self):
236
+ """List all contexts (async)."""
237
+ return await self._sandbox.data_api.list_contexts_async()
238
+
239
+ async def create_async(
240
+ self,
241
+ language: Optional[CodeLanguage] = CodeLanguage.PYTHON,
242
+ cwd: str = "/home/user",
243
+ ) -> "ContextOperations":
244
+ """Create a new context and save its ID (async).
245
+
246
+ Args:
247
+ name: Context name
248
+ language: Programming language (default: "python")
249
+ config: Context configuration (optional)
250
+
251
+ Returns:
252
+ ContextOperations: Returns self for chaining and context manager support
253
+ """
254
+ result = await self._sandbox.data_api.create_context_async(
255
+ language=language, cwd=cwd
256
+ )
257
+ if all(result.get(key) for key in ("id", "cwd", "language")):
258
+ self._context_id = result["id"]
259
+ self._language = result["language"]
260
+ self._cwd = result["cwd"]
261
+ return self
262
+ raise ServerError(500, "Failed to create context")
263
+
264
+ async def get_async(
265
+ self, context_id: Optional[str] = None
266
+ ) -> "ContextOperations":
267
+ """Get a specific context by ID (async).
268
+ Args:
269
+ context_id: Context ID
270
+ Returns:
271
+ ContextOperations: Returns self for chaining and context manager support
272
+ """
273
+ if context_id is None:
274
+ context_id = self._context_id
275
+ if context_id is None:
276
+ logger.error(f"context id is not set")
277
+ raise ValueError("context id is not set,")
278
+ result = await self._sandbox.data_api.get_context_async(
279
+ context_id=context_id
280
+ )
281
+ if all(result.get(key) for key in ("id", "cwd", "language")):
282
+ self._context_id = result["id"]
283
+ self._language = result["language"]
284
+ self._cwd = result["cwd"]
285
+ return self
286
+ raise ServerError(500, "Failed to create context")
287
+
288
+ async def execute_async(
289
+ self,
290
+ code: str,
291
+ language: Optional[CodeLanguage] = None,
292
+ context_id: Optional[str] = None,
293
+ timeout: Optional[int] = 30,
294
+ ):
295
+ """Execute code in a context (async).
296
+
297
+ Args:
298
+ code: Code to execute
299
+ context_id: Context ID (optional, uses saved context_id if not provided)
300
+ timeout: Execution timeout in seconds (default: 30)
301
+
302
+ Returns:
303
+ Execution result
304
+
305
+ Raises:
306
+ ValueError: If no context_id is provided and none is saved
307
+ """
308
+ if context_id is None:
309
+ context_id = self._context_id
310
+ if context_id is None and language is None:
311
+ logger.debug("context id is not set, use default language: python")
312
+ language = CodeLanguage.PYTHON
313
+ return await self._sandbox.data_api.execute_code_async(
314
+ context_id=context_id, language=language, code=code, timeout=timeout
315
+ )
316
+
317
+ async def delete_async(self, context_id: Optional[str] = None):
318
+ """Delete a context (async).
319
+
320
+ Args:
321
+ context_id: Context ID (optional, uses saved context_id if not provided)
322
+
323
+ Returns:
324
+ Delete result
325
+
326
+ Raises:
327
+ ValueError: If no context_id is provided and none is saved
328
+ """
329
+ if context_id is None:
330
+ context_id = self._context_id
331
+ if context_id is None:
332
+ raise ValueError(
333
+ "context_id is required. Either pass it as parameter or create"
334
+ " a context first."
335
+ )
336
+ result = await self._sandbox.data_api.delete_context_async(
337
+ context_id=context_id
338
+ )
339
+ # Clear the saved context_id after deletion
340
+ self._context_id = None
341
+ return result
342
+
343
+ async def __aenter__(self):
344
+ """Asynchronous context manager entry."""
345
+ if self._context_id is None:
346
+ raise ValueError(
347
+ "No context has been created. Call create() first or use: "
348
+ "async with await sandbox.context.create_async(...) as ctx:"
349
+ )
350
+ return self
351
+
352
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
353
+ """Asynchronous context manager exit - deletes the context."""
354
+ if self._context_id is not None:
355
+ try:
356
+ await self._sandbox.data_api.delete_context_async(
357
+ self._context_id
358
+ )
359
+ except Exception as e:
360
+ logger.error(
361
+ f"Warning: Failed to delete context {self._context_id}: {e}"
362
+ )
363
+ return False
364
+
365
+
366
+ class CodeInterpreterSandbox(Sandbox):
367
+ _template_type = TemplateType.CODE_INTERPRETER
368
+
369
+ _data_api: Optional["CodeInterpreterDataAPI"] = None
370
+ _file: Optional[FileOperations] = None
371
+ _file_system: Optional[FileSystemOperations] = None
372
+ _context: Optional[ContextOperations] = None
373
+ _process: Optional[ProcessOperations] = None
374
+
375
+ @property
376
+ def data_api(self) -> "CodeInterpreterDataAPI":
377
+ """Get data client."""
378
+ if self._data_api is None:
379
+ self._data_api = CodeInterpreterDataAPI(
380
+ sandbox_id=self.sandbox_id or "", config=self._config
381
+ )
382
+ return self._data_api
383
+
384
+ @property
385
+ def file(self) -> FileOperations:
386
+ """Access file upload/download operations."""
387
+ if self._file is None:
388
+ self._file = FileOperations(self)
389
+ return self._file
390
+
391
+ @property
392
+ def file_system(self) -> FileSystemOperations:
393
+ """Access file system operations."""
394
+ if self._file_system is None:
395
+ self._file_system = FileSystemOperations(self)
396
+ return self._file_system
397
+
398
+ @property
399
+ def context(self) -> ContextOperations:
400
+ """Access context management operations."""
401
+ if self._context is None:
402
+ self._context = ContextOperations(self)
403
+ return self._context
404
+
405
+ @property
406
+ def process(self) -> ProcessOperations:
407
+ """Access process management operations."""
408
+ if self._process is None:
409
+ self._process = ProcessOperations(self)
410
+ return self._process
411
+
412
+ async def check_health_async(self):
413
+ return await self.data_api.check_health_async()
414
+
415
+ async def __aenter__(self):
416
+ """Asynchronous context manager entry."""
417
+ # Poll health check asynchronously
418
+ max_retries = 60 # Maximum 60 seconds
419
+ retry_count = 0
420
+
421
+ logger.debug("Waiting for code interpreter to be ready...")
422
+
423
+ while retry_count < max_retries:
424
+ retry_count += 1
425
+
426
+ try:
427
+ health = await self.check_health_async()
428
+
429
+ if health["status"] == "ok":
430
+ logger.debug(
431
+ "Code Interpreter is ready! (took"
432
+ f" {retry_count} seconds)"
433
+ )
434
+ return self
435
+
436
+ logger.debug(
437
+ f"[{retry_count}/{max_retries}] Health status: not ready"
438
+ )
439
+
440
+ logger.debug(
441
+ f"[{retry_count}/{max_retries}] Health status:"
442
+ f" {health.get('code')} { health.get('message')}",
443
+ )
444
+
445
+ except Exception as e:
446
+ logger.error(
447
+ f"[{retry_count}/{max_retries}] Health check failed: {e}"
448
+ )
449
+
450
+ if retry_count < max_retries:
451
+ await asyncio.sleep(1)
452
+
453
+ raise RuntimeError(
454
+ f"Health check timeout after {max_retries} seconds. "
455
+ "Code interpreter did not become ready in time."
456
+ )
457
+
458
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
459
+ """Asynchronous context manager exit."""
460
+ if self.sandbox_id is None:
461
+ raise ValueError("Sandbox ID is not set")
462
+ logger.debug(f"Deleting code interpreter sandbox {self.sandbox_id}...")
463
+ await self.delete_async()
@@ -0,0 +1,69 @@
1
+ """AgentRun Sandbox 模块 / AgentRun Sandbox Module
2
+
3
+ 提供沙箱环境管理功能,包括 Sandbox 和 Template 的创建、管理和控制。"""
4
+
5
+ from .aio_sandbox import AioSandbox
6
+ from .browser_sandbox import BrowserSandbox
7
+ from .client import SandboxClient
8
+ from .code_interpreter_sandbox import CodeInterpreterSandbox
9
+ from .model import (
10
+ CodeLanguage,
11
+ ListSandboxesInput,
12
+ ListSandboxesOutput,
13
+ NASConfig,
14
+ NASMountConfig,
15
+ OSSMountConfig,
16
+ OSSMountPoint,
17
+ PageableInput,
18
+ PolarFsConfig,
19
+ SandboxInput,
20
+ TemplateArmsConfiguration,
21
+ TemplateContainerConfiguration,
22
+ TemplateCredentialConfiguration,
23
+ TemplateInput,
24
+ TemplateLogConfiguration,
25
+ TemplateMcpOptions,
26
+ TemplateMcpState,
27
+ TemplateNetworkConfiguration,
28
+ TemplateNetworkMode,
29
+ TemplateOssConfiguration,
30
+ TemplateOSSPermission,
31
+ TemplateType,
32
+ )
33
+ from .sandbox import Sandbox
34
+ from .template import Template
35
+
36
+ ListSandboxesOutput.model_rebuild()
37
+
38
+ __all__ = [
39
+ "SandboxClient",
40
+ "Sandbox",
41
+ "Template",
42
+ "CodeInterpreterSandbox",
43
+ "BrowserSandbox",
44
+ "AioSandbox",
45
+ # 模型类
46
+ "SandboxInput",
47
+ "TemplateInput",
48
+ "TemplateType",
49
+ "TemplateNetworkMode",
50
+ "TemplateNetworkConfiguration",
51
+ "TemplateOssConfiguration",
52
+ "TemplateLogConfiguration",
53
+ "TemplateCredentialConfiguration",
54
+ "TemplateArmsConfiguration",
55
+ "TemplateContainerConfiguration",
56
+ "TemplateMcpOptions",
57
+ "TemplateMcpState",
58
+ "PageableInput",
59
+ "ListSandboxesInput",
60
+ "ListSandboxesOutput",
61
+ "CodeLanguage",
62
+ "TemplateOSSPermission",
63
+ "NASConfig",
64
+ "NASMountConfig",
65
+ "OSSMountConfig",
66
+ "OSSMountPoint",
67
+ "PolarFsConfig",
68
+ "PolarFsConfig",
69
+ ]