agentrun-inner-test 0.0.46__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 (135) hide show
  1. agentrun/__init__.py +325 -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 +12 -0
  24. agentrun/integration/agentscope/adapter.py +17 -0
  25. agentrun/integration/agentscope/builtin.py +65 -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 +16 -0
  30. agentrun/integration/builtin/model.py +93 -0
  31. agentrun/integration/builtin/sandbox.py +1234 -0
  32. agentrun/integration/builtin/toolset.py +47 -0
  33. agentrun/integration/crewai/__init__.py +12 -0
  34. agentrun/integration/crewai/adapter.py +9 -0
  35. agentrun/integration/crewai/builtin.py +65 -0
  36. agentrun/integration/crewai/model_adapter.py +31 -0
  37. agentrun/integration/crewai/tool_adapter.py +26 -0
  38. agentrun/integration/google_adk/__init__.py +12 -0
  39. agentrun/integration/google_adk/adapter.py +15 -0
  40. agentrun/integration/google_adk/builtin.py +65 -0
  41. agentrun/integration/google_adk/message_adapter.py +144 -0
  42. agentrun/integration/google_adk/model_adapter.py +46 -0
  43. agentrun/integration/google_adk/tool_adapter.py +235 -0
  44. agentrun/integration/langchain/__init__.py +30 -0
  45. agentrun/integration/langchain/adapter.py +15 -0
  46. agentrun/integration/langchain/builtin.py +71 -0
  47. agentrun/integration/langchain/message_adapter.py +141 -0
  48. agentrun/integration/langchain/model_adapter.py +37 -0
  49. agentrun/integration/langchain/tool_adapter.py +50 -0
  50. agentrun/integration/langgraph/__init__.py +35 -0
  51. agentrun/integration/langgraph/adapter.py +20 -0
  52. agentrun/integration/langgraph/agent_converter.py +1073 -0
  53. agentrun/integration/langgraph/builtin.py +65 -0
  54. agentrun/integration/pydantic_ai/__init__.py +12 -0
  55. agentrun/integration/pydantic_ai/adapter.py +13 -0
  56. agentrun/integration/pydantic_ai/builtin.py +65 -0
  57. agentrun/integration/pydantic_ai/model_adapter.py +44 -0
  58. agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
  59. agentrun/integration/utils/__init__.py +112 -0
  60. agentrun/integration/utils/adapter.py +560 -0
  61. agentrun/integration/utils/canonical.py +164 -0
  62. agentrun/integration/utils/converter.py +134 -0
  63. agentrun/integration/utils/model.py +110 -0
  64. agentrun/integration/utils/tool.py +1759 -0
  65. agentrun/model/__client_async_template.py +357 -0
  66. agentrun/model/__init__.py +57 -0
  67. agentrun/model/__model_proxy_async_template.py +270 -0
  68. agentrun/model/__model_service_async_template.py +267 -0
  69. agentrun/model/api/__init__.py +6 -0
  70. agentrun/model/api/control.py +1173 -0
  71. agentrun/model/api/data.py +196 -0
  72. agentrun/model/client.py +674 -0
  73. agentrun/model/model.py +235 -0
  74. agentrun/model/model_proxy.py +439 -0
  75. agentrun/model/model_service.py +438 -0
  76. agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
  77. agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
  78. agentrun/sandbox/__client_async_template.py +491 -0
  79. agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
  80. agentrun/sandbox/__init__.py +69 -0
  81. agentrun/sandbox/__sandbox_async_template.py +463 -0
  82. agentrun/sandbox/__template_async_template.py +152 -0
  83. agentrun/sandbox/aio_sandbox.py +905 -0
  84. agentrun/sandbox/api/__aio_data_async_template.py +335 -0
  85. agentrun/sandbox/api/__browser_data_async_template.py +140 -0
  86. agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
  87. agentrun/sandbox/api/__init__.py +19 -0
  88. agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
  89. agentrun/sandbox/api/aio_data.py +551 -0
  90. agentrun/sandbox/api/browser_data.py +172 -0
  91. agentrun/sandbox/api/code_interpreter_data.py +396 -0
  92. agentrun/sandbox/api/control.py +1051 -0
  93. agentrun/sandbox/api/playwright_async.py +492 -0
  94. agentrun/sandbox/api/playwright_sync.py +492 -0
  95. agentrun/sandbox/api/sandbox_data.py +154 -0
  96. agentrun/sandbox/browser_sandbox.py +185 -0
  97. agentrun/sandbox/client.py +925 -0
  98. agentrun/sandbox/code_interpreter_sandbox.py +823 -0
  99. agentrun/sandbox/model.py +397 -0
  100. agentrun/sandbox/sandbox.py +848 -0
  101. agentrun/sandbox/template.py +217 -0
  102. agentrun/server/__init__.py +191 -0
  103. agentrun/server/agui_normalizer.py +180 -0
  104. agentrun/server/agui_protocol.py +797 -0
  105. agentrun/server/invoker.py +309 -0
  106. agentrun/server/model.py +427 -0
  107. agentrun/server/openai_protocol.py +535 -0
  108. agentrun/server/protocol.py +140 -0
  109. agentrun/server/server.py +208 -0
  110. agentrun/toolset/__client_async_template.py +62 -0
  111. agentrun/toolset/__init__.py +51 -0
  112. agentrun/toolset/__toolset_async_template.py +204 -0
  113. agentrun/toolset/api/__init__.py +17 -0
  114. agentrun/toolset/api/control.py +262 -0
  115. agentrun/toolset/api/mcp.py +100 -0
  116. agentrun/toolset/api/openapi.py +1251 -0
  117. agentrun/toolset/client.py +102 -0
  118. agentrun/toolset/model.py +321 -0
  119. agentrun/toolset/toolset.py +270 -0
  120. agentrun/utils/__data_api_async_template.py +720 -0
  121. agentrun/utils/__init__.py +5 -0
  122. agentrun/utils/__resource_async_template.py +158 -0
  123. agentrun/utils/config.py +258 -0
  124. agentrun/utils/control_api.py +78 -0
  125. agentrun/utils/data_api.py +1120 -0
  126. agentrun/utils/exception.py +151 -0
  127. agentrun/utils/helper.py +108 -0
  128. agentrun/utils/log.py +77 -0
  129. agentrun/utils/model.py +168 -0
  130. agentrun/utils/resource.py +291 -0
  131. agentrun_inner_test-0.0.46.dist-info/METADATA +263 -0
  132. agentrun_inner_test-0.0.46.dist-info/RECORD +135 -0
  133. agentrun_inner_test-0.0.46.dist-info/WHEEL +5 -0
  134. agentrun_inner_test-0.0.46.dist-info/licenses/LICENSE +201 -0
  135. agentrun_inner_test-0.0.46.dist-info/top_level.txt +1 -0
@@ -0,0 +1,177 @@
1
+ """Credential 客户端 / Credential Client
2
+
3
+ 此模块提供凭证管理的客户端API。
4
+ This module provides the client API for credential management.
5
+ """
6
+
7
+ from typing import Optional
8
+
9
+ from alibabacloud_agentrun20250910.models import (
10
+ CreateCredentialInput,
11
+ ListCredentialsRequest,
12
+ UpdateCredentialInput,
13
+ )
14
+
15
+ from agentrun.utils.config import Config
16
+ from agentrun.utils.exception import HTTPError
17
+
18
+ from .api.control import CredentialControlAPI
19
+ from .credential import Credential
20
+ from .model import (
21
+ CredentialCreateInput,
22
+ CredentialListInput,
23
+ CredentialListOutput,
24
+ CredentialUpdateInput,
25
+ )
26
+
27
+
28
+ class CredentialClient:
29
+ """Credential 客户端 / Credential Client
30
+
31
+ 提供凭证的创建、删除、更新和查询功能。
32
+ Provides create, delete, update and query functions for credentials.
33
+ """
34
+
35
+ def __init__(self, config: Optional[Config] = None):
36
+ """初始化客户端 / Initialize client
37
+
38
+ Args:
39
+ config: 配置对象,可选 / Configuration object, optional
40
+ """
41
+ self.__control_api = CredentialControlAPI(config)
42
+
43
+ async def create_async(
44
+ self, input: CredentialCreateInput, config: Optional[Config] = None
45
+ ):
46
+ """创建凭证(异步) / Create credential asynchronously
47
+
48
+ Args:
49
+ input: 凭证输入参数 / Credential input parameters
50
+ config: 配置对象,可选 / Configuration object, optional
51
+
52
+ Returns:
53
+ Credential: 创建的凭证对象 / Created credential object
54
+
55
+ Raises:
56
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
57
+ HTTPError: HTTP 请求错误 / HTTP request error
58
+ """
59
+ try:
60
+ result = await self.__control_api.create_credential_async(
61
+ CreateCredentialInput().from_map({
62
+ **input.model_dump(),
63
+ **input.credential_config.model_dump(),
64
+ }),
65
+ config=config,
66
+ )
67
+
68
+ return Credential.from_inner_object(result)
69
+ except HTTPError as e:
70
+ raise e.to_resource_error(
71
+ "Credential", input.credential_name
72
+ ) from e
73
+
74
+ async def delete_async(
75
+ self, credential_name: str, config: Optional[Config] = None
76
+ ):
77
+ """删除凭证(异步)
78
+
79
+ Args:
80
+ credential_name: 凭证名称
81
+ config: 配置
82
+
83
+ Raises:
84
+ ResourceNotExistError: 凭证不存在
85
+ """
86
+ try:
87
+ result = await self.__control_api.delete_credential_async(
88
+ credential_name, config=config
89
+ )
90
+
91
+ return Credential.from_inner_object(result)
92
+
93
+ except HTTPError as e:
94
+ raise e.to_resource_error("Credential", credential_name) from e
95
+
96
+ async def update_async(
97
+ self,
98
+ credential_name: str,
99
+ input: CredentialUpdateInput,
100
+ config: Optional[Config] = None,
101
+ ):
102
+ """更新凭证(异步)
103
+
104
+ Args:
105
+ credential_name: 凭证名称
106
+ input: 凭证更新输入参数
107
+ config: 配置
108
+
109
+ Returns:
110
+ Credential: 更新后的凭证对象
111
+
112
+ Raises:
113
+ ResourceNotExistError: 凭证不存在
114
+ """
115
+ try:
116
+ result = await self.__control_api.update_credential_async(
117
+ credential_name,
118
+ UpdateCredentialInput().from_map({
119
+ **input.model_dump(),
120
+ **(
121
+ input.credential_config.model_dump()
122
+ if input.credential_config
123
+ else {}
124
+ ),
125
+ }),
126
+ config=config,
127
+ )
128
+
129
+ return Credential.from_inner_object(result)
130
+ except HTTPError as e:
131
+ raise e.to_resource_error("Credential", credential_name) from e
132
+
133
+ async def get_async(
134
+ self, credential_name: str, config: Optional[Config] = None
135
+ ):
136
+ """获取凭证(异步)
137
+
138
+ Args:
139
+ credential_name: 凭证名称
140
+ config: 配置
141
+
142
+ Returns:
143
+ Credential: 凭证对象
144
+
145
+ Raises:
146
+ ResourceNotExistError: 凭证不存在
147
+ """
148
+ try:
149
+ result = await self.__control_api.get_credential_async(
150
+ credential_name, config=config
151
+ )
152
+ return Credential.from_inner_object(result)
153
+ except HTTPError as e:
154
+ raise e.to_resource_error("Credential", credential_name) from e
155
+
156
+ async def list_async(
157
+ self,
158
+ input: Optional[CredentialListInput] = None,
159
+ config: Optional[Config] = None,
160
+ ):
161
+ """列出凭证(异步)
162
+
163
+ Args:
164
+ input: 分页查询参数
165
+ config: 配置
166
+
167
+ Returns:
168
+ List[Credential]: 凭证列表
169
+ """
170
+ if input is None:
171
+ input = CredentialListInput()
172
+
173
+ results = await self.__control_api.list_credentials_async(
174
+ ListCredentialsRequest().from_map(input.model_dump()),
175
+ config=config,
176
+ )
177
+ return [CredentialListOutput.from_inner_object(item) for item in results.items] # type: ignore
@@ -0,0 +1,216 @@
1
+ """Credential 高层 API / Credential High-Level API
2
+
3
+ 此模块定义凭证资源的高级API。
4
+ This module defines the high-level API for credential resources.
5
+ """
6
+
7
+ from typing import List, Optional
8
+
9
+ from agentrun.utils.config import Config
10
+ from agentrun.utils.model import PageableInput
11
+ from agentrun.utils.resource import ResourceBase
12
+
13
+ from .model import (
14
+ CredentialAuthType,
15
+ CredentialCreateInput,
16
+ CredentialImmutableProps,
17
+ CredentialListInput,
18
+ CredentialListOutput,
19
+ CredentialMutableProps,
20
+ CredentialSourceType,
21
+ CredentialSystemProps,
22
+ CredentialUpdateInput,
23
+ )
24
+
25
+
26
+ class Credential(
27
+ CredentialMutableProps,
28
+ CredentialImmutableProps,
29
+ CredentialSystemProps,
30
+ ResourceBase,
31
+ ):
32
+ """凭证资源 / Credential Resource
33
+
34
+ 提供凭证的完整生命周期管理,包括创建、删除、更新、查询。
35
+ Provides complete lifecycle management for credentials, including create, delete, update, and query.
36
+ """
37
+
38
+ @classmethod
39
+ def __get_client(cls):
40
+ """获取客户端实例 / Get client instance
41
+
42
+ Returns:
43
+ CredentialClient: 客户端实例 / Client instance
44
+ """
45
+ from .client import CredentialClient
46
+
47
+ return CredentialClient()
48
+
49
+ @classmethod
50
+ async def create_async(
51
+ cls, input: CredentialCreateInput, config: Optional[Config] = None
52
+ ):
53
+ """创建凭证(异步)
54
+
55
+ Args:
56
+ input: 凭证输入参数
57
+ config: 配置
58
+
59
+ Returns:
60
+ Credential: 创建的凭证对象
61
+ """
62
+ return await cls.__get_client().create_async(input, config=config)
63
+
64
+ @classmethod
65
+ async def delete_by_name_async(
66
+ cls, credential_name: str, config: Optional[Config] = None
67
+ ):
68
+ """根据名称删除凭证(异步)
69
+
70
+ Args:
71
+ credential_name: 凭证名称
72
+ config: 配置
73
+ """
74
+ return await cls.__get_client().delete_async(
75
+ credential_name, config=config
76
+ )
77
+
78
+ @classmethod
79
+ async def update_by_name_async(
80
+ cls,
81
+ credential_name: str,
82
+ input: CredentialUpdateInput,
83
+ config: Optional[Config] = None,
84
+ ):
85
+ """根据名称更新凭证(异步)
86
+
87
+ Args:
88
+ credential_name: 凭证名称
89
+ input: 凭证更新输入参数
90
+ config: 配置
91
+
92
+ Returns:
93
+ Credential: 更新后的凭证对象
94
+ """
95
+ return await cls.__get_client().update_async(
96
+ credential_name, input, config=config
97
+ )
98
+
99
+ @classmethod
100
+ async def get_by_name_async(
101
+ cls, credential_name: str, config: Optional[Config] = None
102
+ ):
103
+ """根据名称获取凭证(异步)
104
+
105
+ Args:
106
+ credential_name: 凭证名称
107
+ config: 配置
108
+
109
+ Returns:
110
+ Credential: 凭证对象
111
+ """
112
+ return await cls.__get_client().get_async(
113
+ credential_name, config=config
114
+ )
115
+
116
+ @classmethod
117
+ async def _list_page_async(
118
+ cls, page_input: PageableInput, config: Config | None = None, **kwargs
119
+ ):
120
+ return await cls.__get_client().list_async(
121
+ input=CredentialListInput(
122
+ **kwargs,
123
+ **page_input.model_dump(),
124
+ ),
125
+ config=config,
126
+ )
127
+
128
+ @classmethod
129
+ async def list_all_async(
130
+ cls,
131
+ *,
132
+ credential_auth_type: Optional[CredentialAuthType] = None,
133
+ credential_name: Optional[str] = None,
134
+ credential_source_type: Optional[CredentialSourceType] = None,
135
+ provider: Optional[str] = None,
136
+ config: Optional[Config] = None,
137
+ ) -> List[CredentialListOutput]:
138
+ return await cls._list_all_async(
139
+ lambda cred: cred.credential_id or "",
140
+ config=config,
141
+ credential_auth_type=credential_auth_type,
142
+ credential_name=credential_name,
143
+ credential_source_type=credential_source_type,
144
+ provider=provider,
145
+ )
146
+
147
+ async def update_async(
148
+ self, input: CredentialUpdateInput, config: Optional[Config] = None
149
+ ):
150
+ """更新凭证(异步)
151
+
152
+ Args:
153
+ input: 凭证更新输入参数
154
+ config: 配置
155
+
156
+ Returns:
157
+ Credential: 更新后的凭证对象
158
+ """
159
+ if self.credential_name is None:
160
+ raise ValueError(
161
+ "credential_name is required to update a Credential"
162
+ )
163
+
164
+ result = await self.update_by_name_async(
165
+ self.credential_name, input, config=config
166
+ )
167
+ self.update_self(result)
168
+
169
+ return self
170
+
171
+ async def delete_async(self, config: Optional[Config] = None):
172
+ """删除凭证(异步)
173
+
174
+ Args:
175
+ config: 配置
176
+ """
177
+ if self.credential_name is None:
178
+ raise ValueError(
179
+ "credential_name is required to delete a Credential"
180
+ )
181
+
182
+ return await self.delete_by_name_async(
183
+ self.credential_name, config=config
184
+ )
185
+
186
+ async def get_async(self, config: Optional[Config] = None):
187
+ """刷新凭证信息(异步)
188
+
189
+ Args:
190
+ config: 配置
191
+
192
+ Returns:
193
+ Credential: 刷新后的凭证对象
194
+ """
195
+ if self.credential_name is None:
196
+ raise ValueError(
197
+ "credential_name is required to refresh a Credential"
198
+ )
199
+
200
+ result = await self.get_by_name_async(
201
+ self.credential_name, config=config
202
+ )
203
+ self.update_self(result)
204
+
205
+ return self
206
+
207
+ async def refresh_async(self, config: Optional[Config] = None):
208
+ """刷新凭证信息(异步)
209
+
210
+ Args:
211
+ config: 配置
212
+
213
+ Returns:
214
+ Credential: 刷新后的凭证对象
215
+ """
216
+ return await self.get_async(config=config)
@@ -0,0 +1,28 @@
1
+ """Credential 模块 / Credential Module"""
2
+
3
+ from .api import CredentialControlAPI
4
+ from .client import CredentialClient
5
+ from .credential import Credential
6
+ from .model import (
7
+ CredentialBasicAuth,
8
+ CredentialConfig,
9
+ CredentialCreateInput,
10
+ CredentialListInput,
11
+ CredentialUpdateInput,
12
+ RelatedResource,
13
+ )
14
+
15
+ __all__ = [
16
+ # base
17
+ "Credential",
18
+ "CredentialClient",
19
+ "CredentialControlAPI",
20
+ # inner model
21
+ "CredentialBasicAuth",
22
+ "RelatedResource",
23
+ "CredentialConfig",
24
+ # api model
25
+ "CredentialCreateInput",
26
+ "CredentialUpdateInput",
27
+ "CredentialListInput",
28
+ ]
@@ -0,0 +1,5 @@
1
+ """Credential API 模块 / Credential API Module"""
2
+
3
+ from .control import CredentialControlAPI
4
+
5
+ __all__ = ["CredentialControlAPI"]