agentscope-runtime 1.0.4__py3-none-any.whl → 1.0.5__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 (49) hide show
  1. agentscope_runtime/adapters/agentscope/stream.py +1 -1
  2. agentscope_runtime/adapters/langgraph/stream.py +120 -70
  3. agentscope_runtime/cli/commands/deploy.py +465 -1
  4. agentscope_runtime/cli/commands/stop.py +16 -0
  5. agentscope_runtime/common/container_clients/__init__.py +52 -0
  6. agentscope_runtime/common/container_clients/agentrun_client.py +6 -4
  7. agentscope_runtime/common/container_clients/boxlite_client.py +442 -0
  8. agentscope_runtime/common/container_clients/docker_client.py +0 -20
  9. agentscope_runtime/common/container_clients/fc_client.py +6 -4
  10. agentscope_runtime/common/container_clients/gvisor_client.py +38 -0
  11. agentscope_runtime/common/container_clients/knative_client.py +1 -0
  12. agentscope_runtime/common/utils/deprecation.py +164 -0
  13. agentscope_runtime/engine/app/agent_app.py +16 -4
  14. agentscope_runtime/engine/deployers/__init__.py +31 -20
  15. agentscope_runtime/engine/deployers/adapter/__init__.py +8 -0
  16. agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +9 -8
  17. agentscope_runtime/engine/deployers/adapter/a2a/nacos_a2a_registry.py +19 -1
  18. agentscope_runtime/engine/deployers/adapter/agui/__init__.py +8 -0
  19. agentscope_runtime/engine/deployers/adapter/agui/agui_adapter_utils.py +652 -0
  20. agentscope_runtime/engine/deployers/adapter/agui/agui_protocol_adapter.py +225 -0
  21. agentscope_runtime/engine/deployers/pai_deployer.py +2335 -0
  22. agentscope_runtime/engine/deployers/utils/net_utils.py +37 -0
  23. agentscope_runtime/engine/deployers/utils/oss_utils.py +38 -0
  24. agentscope_runtime/engine/deployers/utils/package.py +46 -42
  25. agentscope_runtime/engine/helpers/agent_api_client.py +372 -0
  26. agentscope_runtime/engine/runner.py +1 -0
  27. agentscope_runtime/engine/schemas/agent_schemas.py +9 -3
  28. agentscope_runtime/engine/services/agent_state/__init__.py +7 -0
  29. agentscope_runtime/engine/services/memory/__init__.py +7 -0
  30. agentscope_runtime/engine/services/memory/redis_memory_service.py +15 -16
  31. agentscope_runtime/engine/services/session_history/__init__.py +7 -0
  32. agentscope_runtime/engine/tracing/local_logging_handler.py +2 -3
  33. agentscope_runtime/sandbox/box/sandbox.py +4 -0
  34. agentscope_runtime/sandbox/manager/sandbox_manager.py +11 -25
  35. agentscope_runtime/sandbox/manager/server/config.py +3 -1
  36. agentscope_runtime/sandbox/model/manager_config.py +11 -9
  37. agentscope_runtime/tools/modelstudio_memory/__init__.py +106 -0
  38. agentscope_runtime/tools/modelstudio_memory/base.py +220 -0
  39. agentscope_runtime/tools/modelstudio_memory/config.py +86 -0
  40. agentscope_runtime/tools/modelstudio_memory/core.py +594 -0
  41. agentscope_runtime/tools/modelstudio_memory/exceptions.py +60 -0
  42. agentscope_runtime/tools/modelstudio_memory/schemas.py +253 -0
  43. agentscope_runtime/version.py +1 -1
  44. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/METADATA +101 -62
  45. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/RECORD +49 -34
  46. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/WHEEL +0 -0
  47. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/entry_points.txt +0 -0
  48. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/licenses/LICENSE +0 -0
  49. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.5.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
+ # flake8: noqa: E501
2
3
  import logging
3
4
  import os
4
5
  import types
@@ -20,6 +21,7 @@ from ..deployers.adapter.a2a import (
20
21
  from ..deployers.adapter.responses.response_api_protocol_adapter import (
21
22
  ResponseAPIDefaultAdapter,
22
23
  )
24
+ from ..deployers.adapter.agui import AGUIDefaultAdapter, AGUIAdaptorConfig
23
25
  from ..deployers.utils.deployment_modes import DeploymentMode
24
26
  from ..deployers.utils.service_utils.fastapi_factory import FastAPIAppFactory
25
27
  from ..runner import Runner
@@ -52,6 +54,7 @@ class AgentApp(BaseApp):
52
54
  runner: Optional[Runner] = None,
53
55
  enable_embedded_worker: bool = False,
54
56
  a2a_config: Optional["AgentCardWithRuntimeConfig"] = None,
57
+ agui_config: Optional[AGUIAdaptorConfig] = None,
55
58
  **kwargs,
56
59
  ):
57
60
  """
@@ -74,11 +77,14 @@ class AgentApp(BaseApp):
74
77
  Must be an ``AgentCardWithRuntimeConfig`` instance, which
75
78
  contains ``agent_card`` (AgentCard object or dict) and runtime
76
79
  settings (host, port, registry, task_timeout, etc.).
77
- Example:
78
- from a2a.types import AgentCard, AgentCapabilities
79
- from agentscope_runtime.engine.deployers.adapter.a2a import ( # noqa: E501
80
+
81
+ Example::
82
+
83
+ from a2a.types import AgentCapabilities
84
+ from agentscope_runtime.engine.deployers.adapter.a2a import (
80
85
  AgentCardWithRuntimeConfig,
81
86
  )
87
+
82
88
  config = AgentCardWithRuntimeConfig(
83
89
  agent_card={
84
90
  "name": "MyAgent",
@@ -93,6 +99,7 @@ class AgentApp(BaseApp):
93
99
  registry=[nacos_registry],
94
100
  task_timeout=120,
95
101
  )
102
+ agui_config: Config for AGUI adaptor.
96
103
  **kwargs: Additional keyword arguments passed to FastAPI app
97
104
  """
98
105
 
@@ -125,7 +132,12 @@ class AgentApp(BaseApp):
125
132
  )
126
133
 
127
134
  response_protocol = ResponseAPIDefaultAdapter()
128
- self.protocol_adapters = [a2a_protocol, response_protocol]
135
+ agui_protocol = AGUIDefaultAdapter(config=agui_config)
136
+ self.protocol_adapters = [
137
+ a2a_protocol,
138
+ response_protocol,
139
+ agui_protocol,
140
+ ]
129
141
 
130
142
  self._app_kwargs = {
131
143
  "title": "Agent Service",
@@ -1,32 +1,42 @@
1
1
  # -*- coding: utf-8 -*-
2
- from .base import DeployManager
3
- from .local_deployer import LocalDeployManager
4
- from .kubernetes_deployer import (
5
- KubernetesDeployManager,
6
- K8sConfig,
7
- )
8
- from .modelstudio_deployer import (
9
- ModelstudioDeployManager,
10
- )
11
- from .knative_deployer import (
12
- KnativeDeployManager,
13
- )
2
+ from typing import TYPE_CHECKING
3
+ from ...common.utils.lazy_loader import install_lazy_loader
14
4
 
15
- try:
16
- from .agentrun_deployer import (
17
- AgentRunDeployManager,
5
+ if TYPE_CHECKING:
6
+ from .base import DeployManager
7
+ from .local_deployer import LocalDeployManager
8
+ from .kubernetes_deployer import (
9
+ KubernetesDeployManager,
10
+ K8sConfig,
18
11
  )
19
- except ImportError:
20
- AgentRunDeployManager = None # type: ignore
12
+ from .modelstudio_deployer import ModelstudioDeployManager
13
+ from .knative_deployer import KnativeDeployManager
14
+ from .agentrun_deployer import AgentRunDeployManager
15
+ from .fc_deployer import FCDeployManager
16
+
17
+ install_lazy_loader(
18
+ globals(),
19
+ {
20
+ "DeployManager": ".base",
21
+ "LocalDeployManager": ".local_deployer",
22
+ "KubernetesDeployManager": ".kubernetes_deployer",
23
+ "K8sConfig": ".kubernetes_deployer",
24
+ "ModelstudioDeployManager": ".modelstudio_deployer",
25
+ "KnativeDeployManager": ".knative_deployer",
26
+ "AgentRunDeployManager": ".agentrun_deployer",
27
+ "FCDeployManager": ".fc_deployer",
28
+ },
29
+ )
21
30
 
22
31
  try:
23
- from .fc_deployer import (
24
- FCDeployManager,
32
+ from .pai_deployer import (
33
+ PAIDeployManager,
25
34
  )
26
35
  except ImportError:
27
- FCDeployManager = None # type: ignore
36
+ PAIDeployManager = None # type: ignore
28
37
 
29
38
  __all__ = [
39
+ "K8sConfig",
30
40
  "DeployManager",
31
41
  "LocalDeployManager",
32
42
  "KubernetesDeployManager",
@@ -34,4 +44,5 @@ __all__ = [
34
44
  "AgentRunDeployManager",
35
45
  "KnativeDeployManager",
36
46
  "FCDeployManager",
47
+ "PAIDeployManager",
37
48
  ]
@@ -1,2 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  from .a2a import A2AFastAPIDefaultAdapter
3
+ from .agui import AGUIDefaultAdapter
4
+ from .responses import ResponseAPIDefaultAdapter
5
+
6
+ __all__ = [
7
+ "A2AFastAPIDefaultAdapter",
8
+ "AGUIDefaultAdapter",
9
+ "ResponseAPIDefaultAdapter",
10
+ ]
@@ -55,20 +55,21 @@ AGENT_VERSION = "1.0.0"
55
55
  def extract_a2a_config(
56
56
  a2a_config: Optional["AgentCardWithRuntimeConfig"] = None,
57
57
  ) -> "AgentCardWithRuntimeConfig":
58
- """Normalize a2a_config to AgentCardWithRuntimeConfig object.
58
+ """Normalize ``a2a_config`` to an ``AgentCardWithRuntimeConfig`` object.
59
59
 
60
60
  Registry resolution priority:
61
- 1. Use registry from a2a_config if provided
62
- 2. Fallback to environment variables if a2a_config.registry is
63
- None
64
- 3. If neither is available, registry remains None (user doesn't
65
- want registry)
61
+
62
+ 1. Use ``registry`` from ``a2a_config`` if provided.
63
+ 2. Fallback to environment variables if ``a2a_config.registry`` is
64
+ ``None``.
65
+ 3. If neither is available, registry remains ``None``
66
+ (user doesn't want it).
66
67
 
67
68
  Args:
68
- a2a_config: Optional AgentCardWithRuntimeConfig instance.
69
+ a2a_config: Optional ``AgentCardWithRuntimeConfig`` instance.
69
70
 
70
71
  Returns:
71
- Normalized AgentCardWithRuntimeConfig object.
72
+ Normalized ``AgentCardWithRuntimeConfig`` object.
72
73
  """
73
74
  if a2a_config is None:
74
75
  a2a_config = AgentCardWithRuntimeConfig()
@@ -157,8 +157,26 @@ def create_nacos_registry_from_env() -> Optional[A2ARegistry]:
157
157
  if not _NACOS_SDK_AVAILABLE:
158
158
  return None
159
159
 
160
+ # Only create a Nacos registry if the user has explicitly configured
161
+ # at least one NACOS_* related environment variable. If none of these
162
+ # are present, we assume the user does NOT want to use any registry.
163
+ nacos_settings = get_nacos_settings()
164
+ env_keys = [
165
+ "NACOS_SERVER_ADDR",
166
+ "NACOS_USERNAME",
167
+ "NACOS_PASSWORD",
168
+ "NACOS_NAMESPACE_ID",
169
+ "NACOS_ACCESS_KEY",
170
+ "NACOS_SECRET_KEY",
171
+ ]
172
+ if not any(key in os.environ for key in env_keys):
173
+ logger.info(
174
+ "[A2A] No NACOS_* environment variables found; "
175
+ "registry will not be enabled.",
176
+ )
177
+ return None
178
+
160
179
  try:
161
- nacos_settings = get_nacos_settings()
162
180
  nacos_client_config = _build_nacos_client_config(nacos_settings)
163
181
  registry = NacosRegistry(nacos_client_config=nacos_client_config)
164
182
 
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ from .agui_protocol_adapter import (
3
+ AGUIDefaultAdapter,
4
+ FlexibleRunAgentInput,
5
+ AGUIAdaptorConfig,
6
+ )
7
+
8
+ __all__ = ["AGUIDefaultAdapter", "FlexibleRunAgentInput", "AGUIAdaptorConfig"]