agentscope-runtime 0.1.6__py3-none-any.whl → 0.2.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 (87) hide show
  1. agentscope_runtime/common/container_clients/__init__.py +0 -0
  2. agentscope_runtime/{sandbox/manager → common}/container_clients/kubernetes_client.py +546 -6
  3. agentscope_runtime/engine/__init__.py +12 -0
  4. agentscope_runtime/engine/agents/agentscope_agent.py +130 -10
  5. agentscope_runtime/engine/agents/agno_agent.py +8 -10
  6. agentscope_runtime/engine/agents/langgraph_agent.py +52 -9
  7. agentscope_runtime/engine/app/__init__.py +6 -0
  8. agentscope_runtime/engine/app/agent_app.py +239 -0
  9. agentscope_runtime/engine/app/base_app.py +181 -0
  10. agentscope_runtime/engine/app/celery_mixin.py +92 -0
  11. agentscope_runtime/engine/deployers/__init__.py +13 -0
  12. agentscope_runtime/engine/deployers/adapter/responses/__init__.py +0 -0
  13. agentscope_runtime/engine/deployers/adapter/responses/response_api_adapter_utils.py +2890 -0
  14. agentscope_runtime/engine/deployers/adapter/responses/response_api_agent_adapter.py +51 -0
  15. agentscope_runtime/engine/deployers/adapter/responses/response_api_protocol_adapter.py +314 -0
  16. agentscope_runtime/engine/deployers/base.py +1 -0
  17. agentscope_runtime/engine/deployers/cli_fc_deploy.py +203 -0
  18. agentscope_runtime/engine/deployers/kubernetes_deployer.py +272 -0
  19. agentscope_runtime/engine/deployers/local_deployer.py +414 -501
  20. agentscope_runtime/engine/deployers/modelstudio_deployer.py +838 -0
  21. agentscope_runtime/engine/deployers/utils/__init__.py +0 -0
  22. agentscope_runtime/engine/deployers/utils/deployment_modes.py +14 -0
  23. agentscope_runtime/engine/deployers/utils/docker_image_utils/__init__.py +8 -0
  24. agentscope_runtime/engine/deployers/utils/docker_image_utils/docker_image_builder.py +429 -0
  25. agentscope_runtime/engine/deployers/utils/docker_image_utils/dockerfile_generator.py +240 -0
  26. agentscope_runtime/engine/deployers/utils/docker_image_utils/runner_image_factory.py +306 -0
  27. agentscope_runtime/engine/deployers/utils/package_project_utils.py +1163 -0
  28. agentscope_runtime/engine/deployers/utils/service_utils/__init__.py +9 -0
  29. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_factory.py +1064 -0
  30. agentscope_runtime/engine/deployers/utils/service_utils/fastapi_templates.py +157 -0
  31. agentscope_runtime/engine/deployers/utils/service_utils/process_manager.py +268 -0
  32. agentscope_runtime/engine/deployers/utils/service_utils/service_config.py +75 -0
  33. agentscope_runtime/engine/deployers/utils/service_utils/service_factory.py +220 -0
  34. agentscope_runtime/engine/deployers/utils/service_utils/standalone_main.py.j2 +211 -0
  35. agentscope_runtime/engine/deployers/utils/wheel_packager.py +389 -0
  36. agentscope_runtime/engine/helpers/agent_api_builder.py +651 -0
  37. agentscope_runtime/engine/runner.py +76 -35
  38. agentscope_runtime/engine/schemas/agent_schemas.py +112 -2
  39. agentscope_runtime/engine/schemas/embedding.py +37 -0
  40. agentscope_runtime/engine/schemas/modelstudio_llm.py +310 -0
  41. agentscope_runtime/engine/schemas/oai_llm.py +538 -0
  42. agentscope_runtime/engine/schemas/realtime.py +254 -0
  43. agentscope_runtime/engine/services/tablestore_memory_service.py +4 -1
  44. agentscope_runtime/engine/tracing/__init__.py +9 -3
  45. agentscope_runtime/engine/tracing/asyncio_util.py +24 -0
  46. agentscope_runtime/engine/tracing/base.py +66 -34
  47. agentscope_runtime/engine/tracing/local_logging_handler.py +45 -31
  48. agentscope_runtime/engine/tracing/message_util.py +528 -0
  49. agentscope_runtime/engine/tracing/tracing_metric.py +20 -8
  50. agentscope_runtime/engine/tracing/tracing_util.py +130 -0
  51. agentscope_runtime/engine/tracing/wrapper.py +794 -169
  52. agentscope_runtime/sandbox/box/base/base_sandbox.py +2 -1
  53. agentscope_runtime/sandbox/box/browser/browser_sandbox.py +2 -1
  54. agentscope_runtime/sandbox/box/dummy/dummy_sandbox.py +2 -1
  55. agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +2 -1
  56. agentscope_runtime/sandbox/box/gui/gui_sandbox.py +2 -1
  57. agentscope_runtime/sandbox/box/training_box/training_box.py +0 -42
  58. agentscope_runtime/sandbox/client/http_client.py +52 -18
  59. agentscope_runtime/sandbox/constant.py +3 -0
  60. agentscope_runtime/sandbox/custom/custom_sandbox.py +2 -1
  61. agentscope_runtime/sandbox/custom/example.py +2 -1
  62. agentscope_runtime/sandbox/enums.py +0 -1
  63. agentscope_runtime/sandbox/manager/sandbox_manager.py +29 -22
  64. agentscope_runtime/sandbox/model/container.py +6 -0
  65. agentscope_runtime/sandbox/registry.py +1 -1
  66. agentscope_runtime/sandbox/tools/tool.py +4 -0
  67. agentscope_runtime/version.py +1 -1
  68. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/METADATA +103 -59
  69. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/RECORD +87 -52
  70. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/entry_points.txt +1 -0
  71. /agentscope_runtime/{sandbox/manager/container_clients → common}/__init__.py +0 -0
  72. /agentscope_runtime/{sandbox/manager → common}/collections/__init__.py +0 -0
  73. /agentscope_runtime/{sandbox/manager → common}/collections/base_mapping.py +0 -0
  74. /agentscope_runtime/{sandbox/manager → common}/collections/base_queue.py +0 -0
  75. /agentscope_runtime/{sandbox/manager → common}/collections/base_set.py +0 -0
  76. /agentscope_runtime/{sandbox/manager → common}/collections/in_memory_mapping.py +0 -0
  77. /agentscope_runtime/{sandbox/manager → common}/collections/in_memory_queue.py +0 -0
  78. /agentscope_runtime/{sandbox/manager → common}/collections/in_memory_set.py +0 -0
  79. /agentscope_runtime/{sandbox/manager → common}/collections/redis_mapping.py +0 -0
  80. /agentscope_runtime/{sandbox/manager → common}/collections/redis_queue.py +0 -0
  81. /agentscope_runtime/{sandbox/manager → common}/collections/redis_set.py +0 -0
  82. /agentscope_runtime/{sandbox/manager → common}/container_clients/agentrun_client.py +0 -0
  83. /agentscope_runtime/{sandbox/manager → common}/container_clients/base_client.py +0 -0
  84. /agentscope_runtime/{sandbox/manager → common}/container_clients/docker_client.py +0 -0
  85. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/WHEEL +0 -0
  86. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/licenses/LICENSE +0 -0
  87. {agentscope_runtime-0.1.6.dist-info → agentscope_runtime-0.2.0.dist-info}/top_level.txt +0 -0
@@ -5,13 +5,14 @@ from ...utils import build_image_uri
5
5
  from ...registry import SandboxRegistry
6
6
  from ...enums import SandboxType
7
7
  from ...box.sandbox import Sandbox
8
+ from ...constant import TIMEOUT
8
9
 
9
10
 
10
11
  @SandboxRegistry.register(
11
12
  build_image_uri("runtime-sandbox-base"),
12
13
  sandbox_type=SandboxType.BASE,
13
14
  security_level="medium",
14
- timeout=30,
15
+ timeout=TIMEOUT,
15
16
  description="Base Sandbox",
16
17
  )
17
18
  class BaseSandbox(Sandbox):
@@ -8,6 +8,7 @@ from ...registry import SandboxRegistry
8
8
  from ...enums import SandboxType
9
9
  from ...box.base import BaseSandbox
10
10
  from ...box.gui import GUIMixin
11
+ from ...constant import TIMEOUT
11
12
 
12
13
 
13
14
  def http_to_ws(url, use_localhost=True):
@@ -31,7 +32,7 @@ def http_to_ws(url, use_localhost=True):
31
32
  build_image_uri("runtime-sandbox-browser"),
32
33
  sandbox_type=SandboxType.BROWSER,
33
34
  security_level="medium",
34
- timeout=60,
35
+ timeout=TIMEOUT,
35
36
  description="Browser sandbox",
36
37
  )
37
38
  class BrowserSandbox(GUIMixin, BaseSandbox):
@@ -4,13 +4,14 @@ from typing import Optional
4
4
  from ...registry import SandboxRegistry
5
5
  from ...enums import SandboxType
6
6
  from ...box.sandbox import Sandbox
7
+ from ...constant import TIMEOUT
7
8
 
8
9
 
9
10
  @SandboxRegistry.register(
10
11
  "",
11
12
  sandbox_type=SandboxType.DUMMY,
12
13
  security_level="low",
13
- timeout=30,
14
+ timeout=TIMEOUT,
14
15
  description="Dummy Sandbox",
15
16
  )
16
17
  class DummySandbox(Sandbox):
@@ -7,13 +7,14 @@ from ...registry import SandboxRegistry
7
7
  from ...enums import SandboxType
8
8
  from ...box.base import BaseSandbox
9
9
  from ...box.gui import GUIMixin
10
+ from ...constant import TIMEOUT
10
11
 
11
12
 
12
13
  @SandboxRegistry.register(
13
14
  build_image_uri("runtime-sandbox-filesystem"),
14
15
  sandbox_type=SandboxType.FILESYSTEM,
15
16
  security_level="medium",
16
- timeout=60,
17
+ timeout=TIMEOUT,
17
18
  description="Filesystem sandbox",
18
19
  )
19
20
  class FilesystemSandbox(GUIMixin, BaseSandbox):
@@ -8,6 +8,7 @@ from ...utils import build_image_uri, get_platform
8
8
  from ...registry import SandboxRegistry
9
9
  from ...enums import SandboxType
10
10
  from ...box.base import BaseSandbox
11
+ from ...constant import TIMEOUT
11
12
 
12
13
  logger = logging.getLogger(__name__)
13
14
 
@@ -36,7 +37,7 @@ class GUIMixin:
36
37
  build_image_uri("runtime-sandbox-gui"),
37
38
  sandbox_type=SandboxType.GUI,
38
39
  security_level="high",
39
- timeout=30,
40
+ timeout=TIMEOUT,
40
41
  description="GUI Sandbox",
41
42
  )
42
43
  class GuiSandbox(GUIMixin, BaseSandbox):
@@ -300,45 +300,3 @@ class BFCLSandbox(TrainingSandbox):
300
300
  bearer_token,
301
301
  sandbox_type,
302
302
  )
303
-
304
-
305
- @SandboxRegistry.register(
306
- build_image_uri("runtime-sandbox-webshop", arm64_compatible=False),
307
- sandbox_type=SandboxType.WEBSHOP,
308
- runtime_config={"shm_size": "5.06gb"},
309
- security_level="medium",
310
- timeout=30,
311
- description="webshop Sandbox",
312
- )
313
- class WebShopSandbox(TrainingSandbox):
314
- """
315
- Training Sandbox class for managing and executing training-related tasks.
316
-
317
- This class provides methods to create, manage, and interact with
318
- training environment instances using specialized tool calls.
319
- """
320
-
321
- def __init__(
322
- self,
323
- sandbox_id: Optional[str] = None,
324
- timeout: int = 3000,
325
- base_url: Optional[str] = None,
326
- bearer_token: Optional[str] = None,
327
- sandbox_type: SandboxType = SandboxType.WEBSHOP,
328
- ):
329
- """
330
- Initialize the Training Sandbox.
331
-
332
- Args:
333
- sandbox_id (Optional[str]): Unique identifier for the sandbox.
334
- timeout (int): Maximum time allowed for sandbox operations.
335
- base_url (Optional[str]): Base URL for sandbox API.
336
- bearer_token (Optional[str]): Authentication token for API access.
337
- """
338
- super().__init__(
339
- sandbox_id,
340
- timeout,
341
- base_url,
342
- bearer_token,
343
- sandbox_type,
344
- )
@@ -11,6 +11,8 @@ from pydantic import Field
11
11
  from ..model import ContainerModel
12
12
 
13
13
 
14
+ DEFAULT_TIMEOUT = 60
15
+
14
16
  logging.getLogger("httpx").setLevel(logging.CRITICAL)
15
17
  logging.basicConfig(level=logging.INFO)
16
18
  logger = logging.getLogger(__name__)
@@ -84,7 +86,8 @@ class SandboxHttpClient:
84
86
  "fastapi",
85
87
  )
86
88
 
87
- self.timeout = timeout
89
+ self.start_timeout = timeout
90
+ self.timeout = model.timeout or DEFAULT_TIMEOUT
88
91
  self.session = requests.Session()
89
92
  self.built_in_tools = []
90
93
  self.secret = model.runtime_token
@@ -106,6 +109,11 @@ class SandboxHttpClient:
106
109
  def __exit__(self, exc_type, exc_value, traceback):
107
110
  pass
108
111
 
112
+ def _request(self, method: str, url: str, **kwargs):
113
+ if "timeout" not in kwargs:
114
+ kwargs["timeout"] = self.timeout
115
+ return self.session.request(method, url, **kwargs)
116
+
109
117
  def check_health(self) -> bool:
110
118
  """
111
119
  Checks if the runtime service is running by verifying the health
@@ -126,7 +134,7 @@ class SandboxHttpClient:
126
134
  Waits until the runtime service is running for a specified timeout.
127
135
  """
128
136
  start_time = time.time()
129
- while time.time() - start_time < self.timeout:
137
+ while time.time() - start_time < self.start_timeout:
130
138
  if self.check_health():
131
139
  return
132
140
  time.sleep(1)
@@ -140,7 +148,8 @@ class SandboxHttpClient:
140
148
  """
141
149
  try:
142
150
  endpoint = f"{self.base_url}/mcp/add_servers"
143
- response = self.session.post(
151
+ response = self._request(
152
+ "post",
144
153
  endpoint,
145
154
  json={
146
155
  "server_configs": server_configs,
@@ -159,7 +168,10 @@ class SandboxHttpClient:
159
168
  def list_tools(self, tool_type=None, **kwargs) -> dict:
160
169
  try:
161
170
  endpoint = f"{self.base_url}/mcp/list_tools"
162
- response = self.session.get(endpoint)
171
+ response = self._request(
172
+ "get",
173
+ endpoint,
174
+ )
163
175
  response.raise_for_status()
164
176
  mcp_tools = response.json()
165
177
  mcp_tools["generic"] = self.generic_tools
@@ -189,7 +201,8 @@ class SandboxHttpClient:
189
201
 
190
202
  try:
191
203
  endpoint = f"{self.base_url}/mcp/call_tool"
192
- response = self.session.post(
204
+ response = self._request(
205
+ "post",
193
206
  endpoint,
194
207
  json={
195
208
  "tool_name": name,
@@ -215,7 +228,8 @@ class SandboxHttpClient:
215
228
  """Run an IPython cell."""
216
229
  try:
217
230
  endpoint = f"{self.base_url}/tools/run_ipython_cell"
218
- response = self.session.post(
231
+ response = self._request(
232
+ "post",
219
233
  endpoint,
220
234
  json={"code": code},
221
235
  )
@@ -237,7 +251,11 @@ class SandboxHttpClient:
237
251
  """Run a shell command."""
238
252
  try:
239
253
  endpoint = f"{self.base_url}/tools/run_shell_command"
240
- response = self.session.post(endpoint, json={"command": command})
254
+ response = self._request(
255
+ "post",
256
+ endpoint,
257
+ json={"command": command},
258
+ )
241
259
  response.raise_for_status()
242
260
  return response.json()
243
261
  except requests.exceptions.RequestException as e:
@@ -258,7 +276,8 @@ class SandboxHttpClient:
258
276
  """
259
277
  try:
260
278
  endpoint = f"{self.base_url}/watcher/commit_changes"
261
- response = self.session.post(
279
+ response = self._request(
280
+ "post",
262
281
  endpoint,
263
282
  json={"commit_message": commit_message},
264
283
  )
@@ -282,7 +301,8 @@ class SandboxHttpClient:
282
301
  """
283
302
  try:
284
303
  endpoint = f"{self.base_url}/watcher/generate_diff"
285
- response = self.session.post(
304
+ response = self._request(
305
+ "post",
286
306
  endpoint,
287
307
  json={"commit_a": commit_a, "commit_b": commit_b},
288
308
  )
@@ -301,7 +321,10 @@ class SandboxHttpClient:
301
321
  """
302
322
  try:
303
323
  endpoint = f"{self.base_url}/watcher/git_logs"
304
- response = self.session.get(endpoint)
324
+ response = self._request(
325
+ "get",
326
+ endpoint,
327
+ )
305
328
  response.raise_for_status()
306
329
  return response.json()
307
330
  except requests.exceptions.RequestException as e:
@@ -318,7 +341,11 @@ class SandboxHttpClient:
318
341
  try:
319
342
  endpoint = f"{self.base_url}/workspace/files"
320
343
  params = {"file_path": file_path}
321
- response = self.session.get(endpoint, params=params)
344
+ response = self._request(
345
+ "get",
346
+ endpoint,
347
+ params=params,
348
+ )
322
349
  response.raise_for_status()
323
350
  # Return the binary content of the file
324
351
  # Check for empty content
@@ -351,7 +378,8 @@ class SandboxHttpClient:
351
378
  endpoint = f"{self.base_url}/workspace/files"
352
379
  params = {"file_path": file_path}
353
380
  data = {"content": content}
354
- response = self.session.post(
381
+ response = self._request(
382
+ "post",
355
383
  endpoint,
356
384
  params=params,
357
385
  json=data,
@@ -378,7 +406,8 @@ class SandboxHttpClient:
378
406
  try:
379
407
  endpoint = f"{self.base_url}/workspace/list-directories"
380
408
  params = {"directory": directory}
381
- response = self.session.get(
409
+ response = self._request(
410
+ "get",
382
411
  endpoint,
383
412
  params=params,
384
413
  )
@@ -398,7 +427,8 @@ class SandboxHttpClient:
398
427
  try:
399
428
  endpoint = f"{self.base_url}/workspace/directories"
400
429
  params = {"directory_path": directory_path}
401
- response = self.session.post(
430
+ response = self._request(
431
+ "post",
402
432
  endpoint,
403
433
  params=params,
404
434
  )
@@ -420,7 +450,8 @@ class SandboxHttpClient:
420
450
  try:
421
451
  endpoint = f"{self.base_url}/workspace/files"
422
452
  params = {"file_path": file_path}
423
- response = self.session.delete(
453
+ response = self._request(
454
+ "delete",
424
455
  endpoint,
425
456
  params=params,
426
457
  )
@@ -446,7 +477,8 @@ class SandboxHttpClient:
446
477
  try:
447
478
  endpoint = f"{self.base_url}/workspace/directories"
448
479
  params = {"directory_path": directory_path, "recursive": recursive}
449
- response = self.session.delete(
480
+ response = self._request(
481
+ "delete",
450
482
  endpoint,
451
483
  params=params,
452
484
  )
@@ -475,7 +507,8 @@ class SandboxHttpClient:
475
507
  "source_path": source_path,
476
508
  "destination_path": destination_path,
477
509
  }
478
- response = self.session.put(
510
+ response = self._request(
511
+ "put",
479
512
  endpoint,
480
513
  params=params,
481
514
  )
@@ -505,7 +538,8 @@ class SandboxHttpClient:
505
538
  "source_path": source_path,
506
539
  "destination_path": destination_path,
507
540
  }
508
- response = self.session.post(
541
+ response = self._request(
542
+ "post",
509
543
  endpoint,
510
544
  params=params,
511
545
  )
@@ -26,3 +26,6 @@ IMAGE_NAMESPACE = os.getenv("RUNTIME_SANDBOX_IMAGE_NAMESPACE", "agentscope")
26
26
 
27
27
  # Image Tag
28
28
  IMAGE_TAG = os.getenv("RUNTIME_SANDBOX_IMAGE_TAG", "latest")
29
+
30
+ # Timeout
31
+ TIMEOUT = int(os.getenv("RUNTIME_SANDBOX_TIMEOUT", "60"))
@@ -7,6 +7,7 @@ from ..utils import build_image_uri
7
7
  from ..registry import SandboxRegistry
8
8
  from ..enums import SandboxType
9
9
  from ..box.sandbox import Sandbox
10
+ from ..constant import TIMEOUT
10
11
 
11
12
  SANDBOX_TYPE = "custom_sandbox"
12
13
 
@@ -15,7 +16,7 @@ SANDBOX_TYPE = "custom_sandbox"
15
16
  build_image_uri(f"runtime-sandbox-{SANDBOX_TYPE}"),
16
17
  sandbox_type=SANDBOX_TYPE,
17
18
  security_level="medium",
18
- timeout=60,
19
+ timeout=TIMEOUT,
19
20
  description="my sandbox",
20
21
  environment={
21
22
  "TAVILY_API_KEY": os.getenv("TAVILY_API_KEY", ""),
@@ -5,6 +5,7 @@ from ..utils import build_image_uri
5
5
  from ..registry import SandboxRegistry
6
6
  from ..enums import SandboxType
7
7
  from ..box.sandbox import Sandbox
8
+ from ..constant import TIMEOUT
8
9
 
9
10
  SANDBOX_TYPE = "example"
10
11
 
@@ -13,7 +14,7 @@ SANDBOX_TYPE = "example"
13
14
  build_image_uri(f"runtime-sandbox-{SANDBOX_TYPE}"),
14
15
  sandbox_type=SANDBOX_TYPE,
15
16
  security_level="medium",
16
- timeout=60,
17
+ timeout=TIMEOUT,
17
18
  description="Example sandbox",
18
19
  )
19
20
  class ExampleSandbox(Sandbox):
@@ -68,4 +68,3 @@ class SandboxType(DynamicEnum):
68
68
  GUI = "gui"
69
69
  APPWORLD = "appworld"
70
70
  BFCL = "bfcl"
71
- WEBSHOP = "webshop"
@@ -1,39 +1,36 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # pylint: disable=redefined-outer-name, protected-access
3
3
  # pylint: disable=too-many-branches, too-many-statements
4
+ # pylint: disable=redefined-outer-name, protected-access, too-many-branches
5
+ import inspect
6
+ import json
4
7
  import logging
5
8
  import os
6
- import json
7
9
  import secrets
8
- import inspect
9
10
  import traceback
10
-
11
11
  from functools import wraps
12
12
  from typing import Optional, Dict, Union, List
13
13
 
14
- import shortuuid
15
14
  import requests
15
+ import shortuuid
16
16
 
17
- from .container_clients.docker_client import DockerClient
18
- from .container_clients.kubernetes_client import KubernetesClient
17
+ from ..client import SandboxHttpClient, TrainingSandboxClient
18
+ from ..enums import SandboxType
19
+ from ..manager.storage import (
20
+ LocalStorage,
21
+ OSSStorage,
22
+ )
19
23
  from ..model import (
20
24
  ContainerModel,
21
25
  SandboxManagerEnvConfig,
22
26
  )
23
- from ..enums import SandboxType
24
27
  from ..registry import SandboxRegistry
25
- from ..client import SandboxHttpClient, TrainingSandboxClient
26
-
27
- from ..manager.collections import (
28
+ from ...common.collections import (
28
29
  RedisMapping,
29
30
  RedisQueue,
30
31
  InMemoryMapping,
31
32
  InMemoryQueue,
32
33
  )
33
- from ..manager.storage import (
34
- LocalStorage,
35
- OSSStorage,
36
- )
37
34
 
38
35
  logging.basicConfig(level=logging.INFO)
39
36
  logger = logging.getLogger(__name__)
@@ -174,11 +171,21 @@ class SandboxManager:
174
171
 
175
172
  if base_url is None:
176
173
  if self.container_deployment == "docker":
174
+ from ...common.container_clients.docker_client import (
175
+ DockerClient,
176
+ )
177
+
177
178
  self.client = DockerClient(config=self.config)
178
179
  elif self.container_deployment == "k8s":
180
+ from ...common.container_clients.kubernetes_client import (
181
+ KubernetesClient,
182
+ )
183
+
179
184
  self.client = KubernetesClient(config=self.config)
180
185
  elif self.container_deployment == "agentrun":
181
- from .container_clients.agentrun_client import AgentRunClient
186
+ from ...common.container_clients.agentrun_client import (
187
+ AgentRunClient,
188
+ )
182
189
 
183
190
  self.client = AgentRunClient(config=self.config)
184
191
  else:
@@ -447,18 +454,17 @@ class SandboxManager:
447
454
  else:
448
455
  target_sandbox_type = self.default_type[0]
449
456
 
450
- image = SandboxRegistry.get_image_by_type(target_sandbox_type)
451
- if not image:
457
+ config = SandboxRegistry.get_config_by_type(target_sandbox_type)
458
+
459
+ if not config:
452
460
  logger.warning(
453
- f"No image found for sandbox {target_sandbox_type}, "
454
- f"using default",
461
+ f"Not found sandbox {target_sandbox_type}, " f"using default",
455
462
  )
456
- image = SandboxRegistry.get_image_by_type(
463
+ config = SandboxRegistry.get_config_by_type(
457
464
  self.default_type[0],
458
465
  )
466
+ image = config.image_name
459
467
 
460
- # TODO: enable for timeout for the sandbox (auto cleanup)
461
- config = SandboxRegistry.get_config_by_type(target_sandbox_type)
462
468
  environment = {
463
469
  **(config.environment if config.environment else {}),
464
470
  **(environment if environment else {}),
@@ -569,6 +575,7 @@ class SandboxManager:
569
575
  runtime_token=runtime_token,
570
576
  version=image,
571
577
  meta=meta or {},
578
+ timeout=config.timeout,
572
579
  )
573
580
 
574
581
  # Register in mapping
@@ -53,5 +53,11 @@ class ContainerModel(BaseModel):
53
53
 
54
54
  meta: Optional[Dict] = Field(default_factory=dict)
55
55
 
56
+ timeout: Optional[int] = Field(
57
+ None,
58
+ description="Timeout in seconds for container operations",
59
+ ge=0,
60
+ )
61
+
56
62
  class Config:
57
63
  extra = "allow"
@@ -42,7 +42,7 @@ class SandboxRegistry:
42
42
  sandbox_type: SandboxType | str,
43
43
  resource_limits: Dict = None,
44
44
  security_level: str = "medium", # Not used for now
45
- timeout: int = 300,
45
+ timeout: int = 60,
46
46
  description: str = "",
47
47
  environment: Dict = None,
48
48
  runtime_config: Optional[Dict] = None,
@@ -37,6 +37,10 @@ class Tool(ABC):
37
37
  self._name = name
38
38
  self._tool_type = tool_type
39
39
 
40
+ @property
41
+ def __name__(self) -> str:
42
+ return self.name
43
+
40
44
  @property
41
45
  @abstractmethod
42
46
  def name(self) -> str:
@@ -1,2 +1,2 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "v0.1.6"
2
+ __version__ = "v0.2.0"