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,466 @@
1
+ """Agent Runtime 客户端 / Agent Runtime Client
2
+
3
+ 此模块提供 Agent Runtime 的客户端API,用于管理智能体运行时。
4
+ This module provides the client API for Agent Runtime to manage agent runtimes.
5
+ """
6
+
7
+ from typing import List, Optional
8
+
9
+ from alibabacloud_agentrun20250910.models import (
10
+ CreateAgentRuntimeEndpointInput,
11
+ CreateAgentRuntimeInput,
12
+ GetAgentRuntimeRequest,
13
+ ListAgentRuntimeEndpointsRequest,
14
+ ListAgentRuntimesRequest,
15
+ ListAgentRuntimeVersionsRequest,
16
+ UpdateAgentRuntimeEndpointInput,
17
+ UpdateAgentRuntimeInput,
18
+ )
19
+ from typing_extensions import Unpack
20
+
21
+ from agentrun.agent_runtime.api.data import InvokeArgs
22
+ from agentrun.agent_runtime.model import (
23
+ AgentRuntimeArtifact,
24
+ AgentRuntimeCreateInput,
25
+ AgentRuntimeEndpointCreateInput,
26
+ AgentRuntimeEndpointListInput,
27
+ AgentRuntimeEndpointUpdateInput,
28
+ AgentRuntimeListInput,
29
+ AgentRuntimeUpdateInput,
30
+ AgentRuntimeVersion,
31
+ AgentRuntimeVersionListInput,
32
+ NetworkConfig,
33
+ )
34
+ from agentrun.agent_runtime.runtime import AgentRuntime
35
+ from agentrun.utils.config import Config
36
+ from agentrun.utils.exception import HTTPError
37
+
38
+ from .api import AgentRuntimeControlAPI, AgentRuntimeDataAPI
39
+ from .endpoint import AgentRuntimeEndpoint
40
+
41
+
42
+ class AgentRuntimeClient:
43
+ """Agent Runtime 客户端 / Agent Runtime Client
44
+
45
+ 提供 Agent Runtime 的创建、删除、更新、查询和端点管理功能。
46
+ Provides create, delete, update, query and endpoint management functions for Agent Runtime.
47
+ """
48
+
49
+ def __init__(self, config: Optional[Config] = None):
50
+ """初始化客户端 / Initialize client
51
+
52
+ Args:
53
+ config: 配置对象,可选 / Configuration object, optional
54
+ """
55
+ self.config = config
56
+ self.__control_api = AgentRuntimeControlAPI(config)
57
+
58
+ async def create_async(
59
+ self, input: AgentRuntimeCreateInput, config: Optional[Config] = None
60
+ ) -> AgentRuntime:
61
+ """异步创建 Agent Runtime / Create Agent Runtime asynchronously
62
+
63
+ Args:
64
+ input: Agent Runtime 创建配置 / Agent Runtime creation configuration
65
+ config: 配置对象,可选 / Configuration object, optional
66
+
67
+ Returns:
68
+ AgentRuntime: 创建的 Agent Runtime 对象 / Created Agent Runtime object
69
+
70
+ Raises:
71
+ ValueError: 当既未提供代码配置也未提供容器配置时 / When neither code nor container configuration is provided
72
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
73
+ ResourceNotExistError: 资源不存在 / Resource does not exist
74
+ HTTPError: HTTP 请求错误 / HTTP request error
75
+ """
76
+ if input.network_configuration is None:
77
+ input.network_configuration = NetworkConfig()
78
+
79
+ if input.artifact_type is None:
80
+ if input.code_configuration is not None:
81
+ input.artifact_type = AgentRuntimeArtifact.CODE
82
+ elif input.container_configuration is not None:
83
+ input.artifact_type = AgentRuntimeArtifact.CONTAINER
84
+ else:
85
+ raise ValueError(
86
+ "Either code_configuration or image_configuration must be"
87
+ " provided."
88
+ )
89
+
90
+ try:
91
+ result = await self.__control_api.create_agent_runtime_async(
92
+ CreateAgentRuntimeInput().from_map(input.model_dump()),
93
+ config=config,
94
+ )
95
+ except HTTPError as e:
96
+ raise e.to_resource_error(
97
+ "AgentRuntime", input.agent_runtime_name
98
+ ) from e
99
+ return AgentRuntime.from_inner_object(result)
100
+
101
+ async def delete_async(
102
+ self, id: str, config: Optional[Config] = None
103
+ ) -> AgentRuntime:
104
+ """异步删除 Agent Runtime / Delete Agent Runtime asynchronously
105
+
106
+ Args:
107
+ id: Agent Runtime ID
108
+ config: 配置对象,可选 / Configuration object, optional
109
+
110
+ Returns:
111
+ AgentRuntime: 删除的 Agent Runtime 对象 / Deleted Agent Runtime object
112
+
113
+ Raises:
114
+ ResourceNotExistError: 资源不存在 / Resource does not exist
115
+ HTTPError: HTTP 请求错误 / HTTP request error
116
+ """
117
+ try:
118
+ result = await self.__control_api.delete_agent_runtime_async(
119
+ id, config=config
120
+ )
121
+ return AgentRuntime.from_inner_object(result)
122
+ except HTTPError as e:
123
+ raise e.to_resource_error("AgentRuntime", id) from e
124
+
125
+ async def update_async(
126
+ self,
127
+ id: str,
128
+ input: AgentRuntimeUpdateInput,
129
+ config: Optional[Config] = None,
130
+ ) -> AgentRuntime:
131
+ """异步更新 Agent Runtime / Update Agent Runtime asynchronously
132
+
133
+ Args:
134
+ id: Agent Runtime ID
135
+ input: Agent Runtime 更新配置 / Agent Runtime update configuration
136
+ config: 配置对象,可选 / Configuration object, optional
137
+
138
+ Returns:
139
+ AgentRuntime: 更新后的 Agent Runtime 对象 / Updated Agent Runtime object
140
+
141
+ Raises:
142
+ ResourceNotExistError: 资源不存在 / Resource does not exist
143
+ HTTPError: HTTP 请求错误 / HTTP request error
144
+ """
145
+ try:
146
+ result = await self.__control_api.update_agent_runtime_async(
147
+ id,
148
+ UpdateAgentRuntimeInput().from_map(input.model_dump()),
149
+ config=config,
150
+ )
151
+ return AgentRuntime.from_inner_object(result)
152
+ except HTTPError as e:
153
+ raise e.to_resource_error("AgentRuntime", id) from e
154
+
155
+ async def get_async(
156
+ self,
157
+ id: str,
158
+ config: Optional[Config] = None,
159
+ ) -> AgentRuntime:
160
+ """异步获取 Agent Runtime / Get Agent Runtime asynchronously
161
+
162
+ Args:
163
+ id: Agent Runtime ID
164
+ config: 配置对象,可选 / Configuration object, optional
165
+
166
+ Returns:
167
+ AgentRuntime: Agent Runtime 对象 / Agent Runtime object
168
+
169
+ Raises:
170
+ ResourceNotExistError: 资源不存在 / Resource does not exist
171
+ HTTPError: HTTP 请求错误 / HTTP request error
172
+ """
173
+ try:
174
+ result = await self.__control_api.get_agent_runtime_async(
175
+ id, GetAgentRuntimeRequest(), config=config
176
+ )
177
+ return AgentRuntime.from_inner_object(result)
178
+ except HTTPError as e:
179
+ raise e.to_resource_error("AgentRuntime", id) from e
180
+
181
+ async def list_async(
182
+ self,
183
+ input: Optional[AgentRuntimeListInput] = None,
184
+ config: Optional[Config] = None,
185
+ ) -> List[AgentRuntime]:
186
+ """异步列出 Agent Runtimes / List Agent Runtimes asynchronously
187
+
188
+ Args:
189
+ input: 列表查询配置,可选 / List query configuration, optional
190
+ config: 配置对象,可选 / Configuration object, optional
191
+
192
+ Returns:
193
+ List[AgentRuntime]: Agent Runtime 对象列表 / List of Agent Runtime objects
194
+
195
+ Raises:
196
+ HTTPError: HTTP 请求错误 / HTTP request error
197
+ """
198
+ try:
199
+ if input is None:
200
+ input = AgentRuntimeListInput()
201
+
202
+ results = await self.__control_api.list_agent_runtimes_async(
203
+ ListAgentRuntimesRequest().from_map(input.model_dump()),
204
+ config=config,
205
+ )
206
+ return [
207
+ AgentRuntime.from_inner_object(item) for item in results.items
208
+ ]
209
+ except HTTPError as e:
210
+ raise e.to_resource_error("AgentRuntime") from e
211
+
212
+ async def create_endpoint_async(
213
+ self,
214
+ agent_runtime_id: str,
215
+ endpoint: AgentRuntimeEndpointCreateInput,
216
+ config: Optional[Config] = None,
217
+ ) -> AgentRuntimeEndpoint:
218
+ """异步创建 Agent Runtime 端点 / Create Agent Runtime Endpoint asynchronously
219
+
220
+ Args:
221
+ agent_runtime_id: Agent Runtime ID
222
+ endpoint: 端点创建配置 / Endpoint creation configuration
223
+ config: 配置对象,可选 / Configuration object, optional
224
+
225
+ Returns:
226
+ AgentRuntimeEndpoint: 创建的端点对象 / Created endpoint object
227
+
228
+ Raises:
229
+ ResourceAlreadyExistError: 资源已存在 / Resource already exists
230
+ ResourceNotExistError: Agent Runtime 不存在 / Agent Runtime does not exist
231
+ HTTPError: HTTP 请求错误 / HTTP request error
232
+ """
233
+ try:
234
+ result = (
235
+ await self.__control_api.create_agent_runtime_endpoint_async(
236
+ agent_runtime_id,
237
+ CreateAgentRuntimeEndpointInput().from_map(
238
+ endpoint.model_dump()
239
+ ),
240
+ config=config,
241
+ )
242
+ )
243
+ except HTTPError as e:
244
+ raise e.to_resource_error(
245
+ "AgentRuntimeEndpoint",
246
+ "/".join([
247
+ agent_runtime_id,
248
+ endpoint.agent_runtime_endpoint_name or "",
249
+ ]),
250
+ ) from e
251
+
252
+ return AgentRuntimeEndpoint.from_inner_object(result)
253
+
254
+ async def delete_endpoint_async(
255
+ self,
256
+ agent_runtime_id: str,
257
+ endpoint_id: str,
258
+ config: Optional[Config] = None,
259
+ ) -> AgentRuntimeEndpoint:
260
+ """异步删除 Agent Runtime 端点 / Delete Agent Runtime Endpoint asynchronously
261
+
262
+ Args:
263
+ agent_runtime_id: Agent Runtime ID
264
+ endpoint_id: 端点 ID / Endpoint ID
265
+ config: 配置对象,可选 / Configuration object, optional
266
+
267
+ Returns:
268
+ AgentRuntimeEndpoint: 删除的端点对象 / Deleted endpoint object
269
+
270
+ Raises:
271
+ ResourceNotExistError: 资源不存在 / Resource does not exist
272
+ HTTPError: HTTP 请求错误 / HTTP request error
273
+ """
274
+ try:
275
+ result = (
276
+ await self.__control_api.delete_agent_runtime_endpoint_async(
277
+ agent_runtime_id,
278
+ endpoint_id,
279
+ config=config,
280
+ )
281
+ )
282
+ except HTTPError as e:
283
+ raise e.to_resource_error(
284
+ "AgentRuntimeEndpoint",
285
+ "/".join([
286
+ agent_runtime_id,
287
+ endpoint_id,
288
+ ]),
289
+ ) from e
290
+
291
+ return AgentRuntimeEndpoint.from_inner_object(result)
292
+
293
+ async def update_endpoint_async(
294
+ self,
295
+ agent_runtime_id: str,
296
+ endpoint_id: str,
297
+ endpoint: AgentRuntimeEndpointUpdateInput,
298
+ config: Optional[Config] = None,
299
+ ) -> AgentRuntimeEndpoint:
300
+ """异步更新 Agent Runtime 端点 / Update Agent Runtime Endpoint asynchronously
301
+
302
+ Args:
303
+ agent_runtime_id: Agent Runtime ID
304
+ endpoint_id: 端点 ID / Endpoint ID
305
+ endpoint: 端点更新配置 / Endpoint update configuration
306
+ config: 配置对象,可选 / Configuration object, optional
307
+
308
+ Returns:
309
+ AgentRuntimeEndpoint: 更新后的端点对象 / Updated endpoint object
310
+
311
+ Raises:
312
+ ResourceNotExistError: 资源不存在 / Resource does not exist
313
+ HTTPError: HTTP 请求错误 / HTTP request error
314
+ """
315
+ try:
316
+ result = (
317
+ await self.__control_api.update_agent_runtime_endpoint_async(
318
+ agent_runtime_id,
319
+ endpoint_id,
320
+ UpdateAgentRuntimeEndpointInput().from_map(
321
+ endpoint.model_dump()
322
+ ),
323
+ config=config,
324
+ )
325
+ )
326
+ except HTTPError as e:
327
+ raise e.to_resource_error(
328
+ "AgentRuntimeEndpoint",
329
+ "/".join([
330
+ agent_runtime_id,
331
+ endpoint_id,
332
+ ]),
333
+ ) from e
334
+
335
+ return AgentRuntimeEndpoint.from_inner_object(result)
336
+
337
+ async def get_endpoint_async(
338
+ self,
339
+ agent_runtime_id: str,
340
+ endpoint_id: str,
341
+ config: Optional[Config] = None,
342
+ ) -> AgentRuntimeEndpoint:
343
+ """异步获取 Agent Runtime 端点 / Get Agent Runtime Endpoint asynchronously
344
+
345
+ Args:
346
+ agent_runtime_id: Agent Runtime ID
347
+ endpoint_id: 端点 ID / Endpoint ID
348
+ config: 配置对象,可选 / Configuration object, optional
349
+
350
+ Returns:
351
+ AgentRuntimeEndpoint: 端点对象 / Endpoint object
352
+
353
+ Raises:
354
+ ResourceNotExistError: 资源不存在 / Resource does not exist
355
+ HTTPError: HTTP 请求错误 / HTTP request error
356
+ """
357
+ try:
358
+ result = await self.__control_api.get_agent_runtime_endpoint_async(
359
+ agent_runtime_id,
360
+ endpoint_id,
361
+ config=config,
362
+ )
363
+ except HTTPError as e:
364
+ raise e.to_resource_error(
365
+ "AgentRuntimeEndpoint",
366
+ "/".join([
367
+ agent_runtime_id,
368
+ endpoint_id,
369
+ ]),
370
+ ) from e
371
+
372
+ return AgentRuntimeEndpoint.from_inner_object(result)
373
+
374
+ async def list_endpoints_async(
375
+ self,
376
+ agent_runtime_id: str,
377
+ input: Optional[AgentRuntimeEndpointListInput] = None,
378
+ config: Optional[Config] = None,
379
+ ) -> List[AgentRuntimeEndpoint]:
380
+ """异步列出 Agent Runtime 端点 / List Agent Runtime Endpoints asynchronously
381
+
382
+ Args:
383
+ agent_runtime_id: Agent Runtime ID
384
+ input: 列表查询配置,可选 / List query configuration, optional
385
+ config: 配置对象,可选 / Configuration object, optional
386
+
387
+ Returns:
388
+ List[AgentRuntimeEndpoint]: 端点对象列表 / List of endpoint objects
389
+
390
+ Raises:
391
+ HTTPError: HTTP 请求错误 / HTTP request error
392
+ """
393
+ try:
394
+ if input is None:
395
+ input = AgentRuntimeEndpointListInput()
396
+
397
+ results = (
398
+ await self.__control_api.list_agent_runtime_endpoints_async(
399
+ agent_runtime_id,
400
+ ListAgentRuntimeEndpointsRequest().from_map(
401
+ input.model_dump()
402
+ ),
403
+ config=config,
404
+ )
405
+ )
406
+ return [
407
+ AgentRuntimeEndpoint.from_inner_object(item)
408
+ for item in results.items
409
+ ]
410
+ except HTTPError as e:
411
+ raise e.to_resource_error("AgentRuntime", agent_runtime_id) from e
412
+
413
+ async def list_versions_async(
414
+ self,
415
+ agent_runtime_id: str,
416
+ input: Optional[AgentRuntimeVersionListInput] = None,
417
+ config: Optional[Config] = None,
418
+ ) -> List[AgentRuntimeVersion]:
419
+ """异步列出 Agent Runtime 版本 / List Agent Runtime Versions asynchronously
420
+
421
+ Args:
422
+ agent_runtime_id: Agent Runtime ID
423
+ input: 列表查询配置,可选 / List query configuration, optional
424
+ config: 配置对象,可选 / Configuration object, optional
425
+
426
+ Returns:
427
+ List[AgentRuntimeVersion]: 版本对象列表 / List of version objects
428
+
429
+ Raises:
430
+ HTTPError: HTTP 请求错误 / HTTP request error
431
+ """
432
+ try:
433
+ if input is None:
434
+ input = AgentRuntimeVersionListInput()
435
+
436
+ results = (
437
+ await self.__control_api.list_agent_runtime_versions_async(
438
+ agent_runtime_id,
439
+ ListAgentRuntimeVersionsRequest().from_map(
440
+ input.model_dump()
441
+ ),
442
+ config=config,
443
+ )
444
+ )
445
+ return [
446
+ AgentRuntimeVersion.from_inner_object(item)
447
+ for item in results.items
448
+ ]
449
+ except HTTPError as e:
450
+ raise e.to_resource_error("AgentRuntime", agent_runtime_id) from e
451
+
452
+ async def invoke_openai_async(
453
+ self,
454
+ agent_runtime_name: str,
455
+ agent_runtime_endpoint_name: str = "Default",
456
+ **kwargs: Unpack[InvokeArgs],
457
+ ):
458
+ cfg = Config.with_configs(self.config, kwargs.get("config"))
459
+ kwargs["config"] = cfg
460
+
461
+ data_api = AgentRuntimeDataAPI(
462
+ agent_runtime_name=agent_runtime_name,
463
+ agent_runtime_endpoint_name=agent_runtime_endpoint_name,
464
+ config=cfg,
465
+ )
466
+ return await data_api.invoke_openai_async(**kwargs)