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.
- agentrun/__init__.py +325 -0
- agentrun/agent_runtime/__client_async_template.py +466 -0
- agentrun/agent_runtime/__endpoint_async_template.py +345 -0
- agentrun/agent_runtime/__init__.py +53 -0
- agentrun/agent_runtime/__runtime_async_template.py +477 -0
- agentrun/agent_runtime/api/__data_async_template.py +58 -0
- agentrun/agent_runtime/api/__init__.py +6 -0
- agentrun/agent_runtime/api/control.py +1362 -0
- agentrun/agent_runtime/api/data.py +98 -0
- agentrun/agent_runtime/client.py +868 -0
- agentrun/agent_runtime/endpoint.py +649 -0
- agentrun/agent_runtime/model.py +362 -0
- agentrun/agent_runtime/runtime.py +904 -0
- agentrun/credential/__client_async_template.py +177 -0
- agentrun/credential/__credential_async_template.py +216 -0
- agentrun/credential/__init__.py +28 -0
- agentrun/credential/api/__init__.py +5 -0
- agentrun/credential/api/control.py +606 -0
- agentrun/credential/client.py +319 -0
- agentrun/credential/credential.py +381 -0
- agentrun/credential/model.py +248 -0
- agentrun/integration/__init__.py +21 -0
- agentrun/integration/agentscope/__init__.py +12 -0
- agentrun/integration/agentscope/adapter.py +17 -0
- agentrun/integration/agentscope/builtin.py +65 -0
- agentrun/integration/agentscope/message_adapter.py +185 -0
- agentrun/integration/agentscope/model_adapter.py +60 -0
- agentrun/integration/agentscope/tool_adapter.py +59 -0
- agentrun/integration/builtin/__init__.py +16 -0
- agentrun/integration/builtin/model.py +93 -0
- agentrun/integration/builtin/sandbox.py +1234 -0
- agentrun/integration/builtin/toolset.py +47 -0
- agentrun/integration/crewai/__init__.py +12 -0
- agentrun/integration/crewai/adapter.py +9 -0
- agentrun/integration/crewai/builtin.py +65 -0
- agentrun/integration/crewai/model_adapter.py +31 -0
- agentrun/integration/crewai/tool_adapter.py +26 -0
- agentrun/integration/google_adk/__init__.py +12 -0
- agentrun/integration/google_adk/adapter.py +15 -0
- agentrun/integration/google_adk/builtin.py +65 -0
- agentrun/integration/google_adk/message_adapter.py +144 -0
- agentrun/integration/google_adk/model_adapter.py +46 -0
- agentrun/integration/google_adk/tool_adapter.py +235 -0
- agentrun/integration/langchain/__init__.py +30 -0
- agentrun/integration/langchain/adapter.py +15 -0
- agentrun/integration/langchain/builtin.py +71 -0
- agentrun/integration/langchain/message_adapter.py +141 -0
- agentrun/integration/langchain/model_adapter.py +37 -0
- agentrun/integration/langchain/tool_adapter.py +50 -0
- agentrun/integration/langgraph/__init__.py +35 -0
- agentrun/integration/langgraph/adapter.py +20 -0
- agentrun/integration/langgraph/agent_converter.py +1073 -0
- agentrun/integration/langgraph/builtin.py +65 -0
- agentrun/integration/pydantic_ai/__init__.py +12 -0
- agentrun/integration/pydantic_ai/adapter.py +13 -0
- agentrun/integration/pydantic_ai/builtin.py +65 -0
- agentrun/integration/pydantic_ai/model_adapter.py +44 -0
- agentrun/integration/pydantic_ai/tool_adapter.py +19 -0
- agentrun/integration/utils/__init__.py +112 -0
- agentrun/integration/utils/adapter.py +560 -0
- agentrun/integration/utils/canonical.py +164 -0
- agentrun/integration/utils/converter.py +134 -0
- agentrun/integration/utils/model.py +110 -0
- agentrun/integration/utils/tool.py +1759 -0
- agentrun/model/__client_async_template.py +357 -0
- agentrun/model/__init__.py +57 -0
- agentrun/model/__model_proxy_async_template.py +270 -0
- agentrun/model/__model_service_async_template.py +267 -0
- agentrun/model/api/__init__.py +6 -0
- agentrun/model/api/control.py +1173 -0
- agentrun/model/api/data.py +196 -0
- agentrun/model/client.py +674 -0
- agentrun/model/model.py +235 -0
- agentrun/model/model_proxy.py +439 -0
- agentrun/model/model_service.py +438 -0
- agentrun/sandbox/__aio_sandbox_async_template.py +523 -0
- agentrun/sandbox/__browser_sandbox_async_template.py +110 -0
- agentrun/sandbox/__client_async_template.py +491 -0
- agentrun/sandbox/__code_interpreter_sandbox_async_template.py +463 -0
- agentrun/sandbox/__init__.py +69 -0
- agentrun/sandbox/__sandbox_async_template.py +463 -0
- agentrun/sandbox/__template_async_template.py +152 -0
- agentrun/sandbox/aio_sandbox.py +905 -0
- agentrun/sandbox/api/__aio_data_async_template.py +335 -0
- agentrun/sandbox/api/__browser_data_async_template.py +140 -0
- agentrun/sandbox/api/__code_interpreter_data_async_template.py +206 -0
- agentrun/sandbox/api/__init__.py +19 -0
- agentrun/sandbox/api/__sandbox_data_async_template.py +107 -0
- agentrun/sandbox/api/aio_data.py +551 -0
- agentrun/sandbox/api/browser_data.py +172 -0
- agentrun/sandbox/api/code_interpreter_data.py +396 -0
- agentrun/sandbox/api/control.py +1051 -0
- agentrun/sandbox/api/playwright_async.py +492 -0
- agentrun/sandbox/api/playwright_sync.py +492 -0
- agentrun/sandbox/api/sandbox_data.py +154 -0
- agentrun/sandbox/browser_sandbox.py +185 -0
- agentrun/sandbox/client.py +925 -0
- agentrun/sandbox/code_interpreter_sandbox.py +823 -0
- agentrun/sandbox/model.py +397 -0
- agentrun/sandbox/sandbox.py +848 -0
- agentrun/sandbox/template.py +217 -0
- agentrun/server/__init__.py +191 -0
- agentrun/server/agui_normalizer.py +180 -0
- agentrun/server/agui_protocol.py +797 -0
- agentrun/server/invoker.py +309 -0
- agentrun/server/model.py +427 -0
- agentrun/server/openai_protocol.py +535 -0
- agentrun/server/protocol.py +140 -0
- agentrun/server/server.py +208 -0
- agentrun/toolset/__client_async_template.py +62 -0
- agentrun/toolset/__init__.py +51 -0
- agentrun/toolset/__toolset_async_template.py +204 -0
- agentrun/toolset/api/__init__.py +17 -0
- agentrun/toolset/api/control.py +262 -0
- agentrun/toolset/api/mcp.py +100 -0
- agentrun/toolset/api/openapi.py +1251 -0
- agentrun/toolset/client.py +102 -0
- agentrun/toolset/model.py +321 -0
- agentrun/toolset/toolset.py +270 -0
- agentrun/utils/__data_api_async_template.py +720 -0
- agentrun/utils/__init__.py +5 -0
- agentrun/utils/__resource_async_template.py +158 -0
- agentrun/utils/config.py +258 -0
- agentrun/utils/control_api.py +78 -0
- agentrun/utils/data_api.py +1120 -0
- agentrun/utils/exception.py +151 -0
- agentrun/utils/helper.py +108 -0
- agentrun/utils/log.py +77 -0
- agentrun/utils/model.py +168 -0
- agentrun/utils/resource.py +291 -0
- agentrun_inner_test-0.0.46.dist-info/METADATA +263 -0
- agentrun_inner_test-0.0.46.dist-info/RECORD +135 -0
- agentrun_inner_test-0.0.46.dist-info/WHEEL +5 -0
- agentrun_inner_test-0.0.46.dist-info/licenses/LICENSE +201 -0
- agentrun_inner_test-0.0.46.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This file is auto generated by the code generation script.
|
|
3
|
+
Do not modify this file manually.
|
|
4
|
+
Use the `make codegen` command to regenerate.
|
|
5
|
+
|
|
6
|
+
当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
7
|
+
使用 `make codegen` 命令重新生成。
|
|
8
|
+
|
|
9
|
+
source: codegen/configs/agent_runtime_control_api.yaml
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Agent Runtime 管控链路 API
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from typing import Dict, Optional
|
|
16
|
+
|
|
17
|
+
from alibabacloud_agentrun20250910.models import (
|
|
18
|
+
AgentRuntime,
|
|
19
|
+
AgentRuntimeEndpoint,
|
|
20
|
+
CreateAgentRuntimeEndpointInput,
|
|
21
|
+
CreateAgentRuntimeEndpointRequest,
|
|
22
|
+
CreateAgentRuntimeInput,
|
|
23
|
+
CreateAgentRuntimeRequest,
|
|
24
|
+
GetAgentRuntimeRequest,
|
|
25
|
+
ListAgentRuntimeEndpointsOutput,
|
|
26
|
+
ListAgentRuntimeEndpointsRequest,
|
|
27
|
+
ListAgentRuntimesOutput,
|
|
28
|
+
ListAgentRuntimesRequest,
|
|
29
|
+
ListAgentRuntimeVersionsOutput,
|
|
30
|
+
ListAgentRuntimeVersionsRequest,
|
|
31
|
+
UpdateAgentRuntimeEndpointInput,
|
|
32
|
+
UpdateAgentRuntimeEndpointRequest,
|
|
33
|
+
UpdateAgentRuntimeInput,
|
|
34
|
+
UpdateAgentRuntimeRequest,
|
|
35
|
+
)
|
|
36
|
+
from alibabacloud_tea_openapi.exceptions._client import ClientException
|
|
37
|
+
from alibabacloud_tea_openapi.exceptions._server import ServerException
|
|
38
|
+
from alibabacloud_tea_util.models import RuntimeOptions
|
|
39
|
+
import pydash
|
|
40
|
+
|
|
41
|
+
from agentrun.utils.config import Config
|
|
42
|
+
from agentrun.utils.control_api import ControlAPI
|
|
43
|
+
from agentrun.utils.exception import ClientError, ServerError
|
|
44
|
+
from agentrun.utils.log import logger
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class AgentRuntimeControlAPI(ControlAPI):
|
|
48
|
+
"""Agent Runtime 管控链路 API"""
|
|
49
|
+
|
|
50
|
+
def __init__(self, config: Optional[Config] = None):
|
|
51
|
+
"""初始化 API 客户端
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
config: 全局配置对象
|
|
55
|
+
"""
|
|
56
|
+
super().__init__(config)
|
|
57
|
+
|
|
58
|
+
def create_agent_runtime(
|
|
59
|
+
self,
|
|
60
|
+
input: CreateAgentRuntimeInput,
|
|
61
|
+
headers: Optional[Dict[str, str]] = None,
|
|
62
|
+
config: Optional[Config] = None,
|
|
63
|
+
) -> AgentRuntime:
|
|
64
|
+
"""创建 Agent Runtime
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
input: Agent Runtime 配置
|
|
68
|
+
|
|
69
|
+
headers: 请求头
|
|
70
|
+
config: 配置
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
AgentRuntimeError: 调用失败时抛出
|
|
77
|
+
ClientError: 客户端错误
|
|
78
|
+
ServerError: 服务器错误
|
|
79
|
+
APIError: 运行时错误
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
client = self._get_client(config)
|
|
84
|
+
response = client.create_agent_runtime_with_options(
|
|
85
|
+
CreateAgentRuntimeRequest(body=input),
|
|
86
|
+
headers=headers or {},
|
|
87
|
+
runtime=RuntimeOptions(),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
logger.debug(
|
|
91
|
+
"request api create_agent_runtime, request Request ID:"
|
|
92
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
93
|
+
f" response: {response.body.data}"
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return response.body.data
|
|
97
|
+
except ClientException as e:
|
|
98
|
+
raise ClientError(
|
|
99
|
+
e.status_code,
|
|
100
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
101
|
+
request_id=e.request_id,
|
|
102
|
+
request=[
|
|
103
|
+
input,
|
|
104
|
+
],
|
|
105
|
+
) from e
|
|
106
|
+
except ServerException as e:
|
|
107
|
+
raise ServerError(
|
|
108
|
+
e.status_code,
|
|
109
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
110
|
+
request_id=e.request_id,
|
|
111
|
+
) from e
|
|
112
|
+
|
|
113
|
+
async def create_agent_runtime_async(
|
|
114
|
+
self,
|
|
115
|
+
input: CreateAgentRuntimeInput,
|
|
116
|
+
headers: Optional[Dict[str, str]] = None,
|
|
117
|
+
config: Optional[Config] = None,
|
|
118
|
+
) -> AgentRuntime:
|
|
119
|
+
"""创建 Agent Runtime
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
input: Agent Runtime 配置
|
|
123
|
+
|
|
124
|
+
headers: 请求头
|
|
125
|
+
config: 配置
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
AgentRuntimeError: 调用失败时抛出
|
|
132
|
+
ClientError: 客户端错误
|
|
133
|
+
ServerError: 服务器错误
|
|
134
|
+
APIError: 运行时错误
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
try:
|
|
138
|
+
client = self._get_client(config)
|
|
139
|
+
response = await client.create_agent_runtime_with_options_async(
|
|
140
|
+
CreateAgentRuntimeRequest(body=input),
|
|
141
|
+
headers=headers or {},
|
|
142
|
+
runtime=RuntimeOptions(),
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
logger.debug(
|
|
146
|
+
"request api create_agent_runtime, request Request ID:"
|
|
147
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
148
|
+
f" response: {response.body.data}"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
return response.body.data
|
|
152
|
+
except ClientException as e:
|
|
153
|
+
raise ClientError(
|
|
154
|
+
e.status_code,
|
|
155
|
+
e.data.get("message", e.message),
|
|
156
|
+
request_id=e.request_id,
|
|
157
|
+
request=[
|
|
158
|
+
input,
|
|
159
|
+
],
|
|
160
|
+
) from e
|
|
161
|
+
except ServerException as e:
|
|
162
|
+
raise ServerError(
|
|
163
|
+
e.status_code,
|
|
164
|
+
e.data.get("message", e.message),
|
|
165
|
+
request_id=e.request_id,
|
|
166
|
+
) from e
|
|
167
|
+
|
|
168
|
+
def delete_agent_runtime(
|
|
169
|
+
self,
|
|
170
|
+
agent_id: str,
|
|
171
|
+
headers: Optional[Dict[str, str]] = None,
|
|
172
|
+
config: Optional[Config] = None,
|
|
173
|
+
) -> AgentRuntime:
|
|
174
|
+
"""删除 Agent Runtime
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
agent_id: Agent Runtime ID
|
|
178
|
+
|
|
179
|
+
headers: 请求头
|
|
180
|
+
config: 配置
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
AgentRuntime: 删除结果
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
AgentRuntimeError: 调用失败时抛出
|
|
187
|
+
ClientError: 客户端错误
|
|
188
|
+
ServerError: 服务器错误
|
|
189
|
+
APIError: 运行时错误
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
try:
|
|
193
|
+
client = self._get_client(config)
|
|
194
|
+
response = client.delete_agent_runtime_with_options(
|
|
195
|
+
agent_id,
|
|
196
|
+
headers=headers or {},
|
|
197
|
+
runtime=RuntimeOptions(),
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
logger.debug(
|
|
201
|
+
"request api delete_agent_runtime, request Request ID:"
|
|
202
|
+
f" {response.body.request_id}\n request: {[agent_id,]}\n "
|
|
203
|
+
f" response: {response.body.data}"
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
return response.body.data
|
|
207
|
+
except ClientException as e:
|
|
208
|
+
raise ClientError(
|
|
209
|
+
e.status_code,
|
|
210
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
211
|
+
request_id=e.request_id,
|
|
212
|
+
request=[
|
|
213
|
+
agent_id,
|
|
214
|
+
],
|
|
215
|
+
) from e
|
|
216
|
+
except ServerException as e:
|
|
217
|
+
raise ServerError(
|
|
218
|
+
e.status_code,
|
|
219
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
220
|
+
request_id=e.request_id,
|
|
221
|
+
) from e
|
|
222
|
+
|
|
223
|
+
async def delete_agent_runtime_async(
|
|
224
|
+
self,
|
|
225
|
+
agent_id: str,
|
|
226
|
+
headers: Optional[Dict[str, str]] = None,
|
|
227
|
+
config: Optional[Config] = None,
|
|
228
|
+
) -> AgentRuntime:
|
|
229
|
+
"""删除 Agent Runtime
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
agent_id: Agent Runtime ID
|
|
233
|
+
|
|
234
|
+
headers: 请求头
|
|
235
|
+
config: 配置
|
|
236
|
+
|
|
237
|
+
Returns:
|
|
238
|
+
AgentRuntime: 删除结果
|
|
239
|
+
|
|
240
|
+
Raises:
|
|
241
|
+
AgentRuntimeError: 调用失败时抛出
|
|
242
|
+
ClientError: 客户端错误
|
|
243
|
+
ServerError: 服务器错误
|
|
244
|
+
APIError: 运行时错误
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
client = self._get_client(config)
|
|
249
|
+
response = await client.delete_agent_runtime_with_options_async(
|
|
250
|
+
agent_id,
|
|
251
|
+
headers=headers or {},
|
|
252
|
+
runtime=RuntimeOptions(),
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
logger.debug(
|
|
256
|
+
"request api delete_agent_runtime, request Request ID:"
|
|
257
|
+
f" {response.body.request_id}\n request: {[agent_id,]}\n "
|
|
258
|
+
f" response: {response.body.data}"
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
return response.body.data
|
|
262
|
+
except ClientException as e:
|
|
263
|
+
raise ClientError(
|
|
264
|
+
e.status_code,
|
|
265
|
+
e.data.get("message", e.message),
|
|
266
|
+
request_id=e.request_id,
|
|
267
|
+
request=[
|
|
268
|
+
agent_id,
|
|
269
|
+
],
|
|
270
|
+
) from e
|
|
271
|
+
except ServerException as e:
|
|
272
|
+
raise ServerError(
|
|
273
|
+
e.status_code,
|
|
274
|
+
e.data.get("message", e.message),
|
|
275
|
+
request_id=e.request_id,
|
|
276
|
+
) from e
|
|
277
|
+
|
|
278
|
+
def update_agent_runtime(
|
|
279
|
+
self,
|
|
280
|
+
agent_id: str,
|
|
281
|
+
input: UpdateAgentRuntimeInput,
|
|
282
|
+
headers: Optional[Dict[str, str]] = None,
|
|
283
|
+
config: Optional[Config] = None,
|
|
284
|
+
) -> AgentRuntime:
|
|
285
|
+
"""创建 Agent Runtime
|
|
286
|
+
|
|
287
|
+
Args:
|
|
288
|
+
agent_id: Agent Runtime ID
|
|
289
|
+
input: Agent Runtime 配置
|
|
290
|
+
|
|
291
|
+
headers: 请求头
|
|
292
|
+
config: 配置
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
296
|
+
|
|
297
|
+
Raises:
|
|
298
|
+
AgentRuntimeError: 调用失败时抛出
|
|
299
|
+
ClientError: 客户端错误
|
|
300
|
+
ServerError: 服务器错误
|
|
301
|
+
APIError: 运行时错误
|
|
302
|
+
"""
|
|
303
|
+
|
|
304
|
+
try:
|
|
305
|
+
client = self._get_client(config)
|
|
306
|
+
response = client.update_agent_runtime_with_options(
|
|
307
|
+
agent_id,
|
|
308
|
+
UpdateAgentRuntimeRequest(body=input),
|
|
309
|
+
headers=headers or {},
|
|
310
|
+
runtime=RuntimeOptions(),
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
logger.debug(
|
|
314
|
+
"request api update_agent_runtime, request Request ID:"
|
|
315
|
+
f" {response.body.request_id}\n request:"
|
|
316
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
317
|
+
f" {response.body.data}"
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
return response.body.data
|
|
321
|
+
except ClientException as e:
|
|
322
|
+
raise ClientError(
|
|
323
|
+
e.status_code,
|
|
324
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
325
|
+
request_id=e.request_id,
|
|
326
|
+
request=[
|
|
327
|
+
agent_id,
|
|
328
|
+
input,
|
|
329
|
+
],
|
|
330
|
+
) from e
|
|
331
|
+
except ServerException as e:
|
|
332
|
+
raise ServerError(
|
|
333
|
+
e.status_code,
|
|
334
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
335
|
+
request_id=e.request_id,
|
|
336
|
+
) from e
|
|
337
|
+
|
|
338
|
+
async def update_agent_runtime_async(
|
|
339
|
+
self,
|
|
340
|
+
agent_id: str,
|
|
341
|
+
input: UpdateAgentRuntimeInput,
|
|
342
|
+
headers: Optional[Dict[str, str]] = None,
|
|
343
|
+
config: Optional[Config] = None,
|
|
344
|
+
) -> AgentRuntime:
|
|
345
|
+
"""创建 Agent Runtime
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
agent_id: Agent Runtime ID
|
|
349
|
+
input: Agent Runtime 配置
|
|
350
|
+
|
|
351
|
+
headers: 请求头
|
|
352
|
+
config: 配置
|
|
353
|
+
|
|
354
|
+
Returns:
|
|
355
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
356
|
+
|
|
357
|
+
Raises:
|
|
358
|
+
AgentRuntimeError: 调用失败时抛出
|
|
359
|
+
ClientError: 客户端错误
|
|
360
|
+
ServerError: 服务器错误
|
|
361
|
+
APIError: 运行时错误
|
|
362
|
+
"""
|
|
363
|
+
|
|
364
|
+
try:
|
|
365
|
+
client = self._get_client(config)
|
|
366
|
+
response = await client.update_agent_runtime_with_options_async(
|
|
367
|
+
agent_id,
|
|
368
|
+
UpdateAgentRuntimeRequest(body=input),
|
|
369
|
+
headers=headers or {},
|
|
370
|
+
runtime=RuntimeOptions(),
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
logger.debug(
|
|
374
|
+
"request api update_agent_runtime, request Request ID:"
|
|
375
|
+
f" {response.body.request_id}\n request:"
|
|
376
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
377
|
+
f" {response.body.data}"
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
return response.body.data
|
|
381
|
+
except ClientException as e:
|
|
382
|
+
raise ClientError(
|
|
383
|
+
e.status_code,
|
|
384
|
+
e.data.get("message", e.message),
|
|
385
|
+
request_id=e.request_id,
|
|
386
|
+
request=[
|
|
387
|
+
agent_id,
|
|
388
|
+
input,
|
|
389
|
+
],
|
|
390
|
+
) from e
|
|
391
|
+
except ServerException as e:
|
|
392
|
+
raise ServerError(
|
|
393
|
+
e.status_code,
|
|
394
|
+
e.data.get("message", e.message),
|
|
395
|
+
request_id=e.request_id,
|
|
396
|
+
) from e
|
|
397
|
+
|
|
398
|
+
def get_agent_runtime(
|
|
399
|
+
self,
|
|
400
|
+
agent_id: str,
|
|
401
|
+
input: GetAgentRuntimeRequest,
|
|
402
|
+
headers: Optional[Dict[str, str]] = None,
|
|
403
|
+
config: Optional[Config] = None,
|
|
404
|
+
) -> AgentRuntime:
|
|
405
|
+
"""获取 Agent Runtime
|
|
406
|
+
|
|
407
|
+
Args:
|
|
408
|
+
agent_id: Agent Runtime ID
|
|
409
|
+
input: Agent Runtime 配置
|
|
410
|
+
|
|
411
|
+
headers: 请求头
|
|
412
|
+
config: 配置
|
|
413
|
+
|
|
414
|
+
Returns:
|
|
415
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
416
|
+
|
|
417
|
+
Raises:
|
|
418
|
+
AgentRuntimeError: 调用失败时抛出
|
|
419
|
+
ClientError: 客户端错误
|
|
420
|
+
ServerError: 服务器错误
|
|
421
|
+
APIError: 运行时错误
|
|
422
|
+
"""
|
|
423
|
+
|
|
424
|
+
try:
|
|
425
|
+
client = self._get_client(config)
|
|
426
|
+
response = client.get_agent_runtime_with_options(
|
|
427
|
+
agent_id,
|
|
428
|
+
input,
|
|
429
|
+
headers=headers or {},
|
|
430
|
+
runtime=RuntimeOptions(),
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
logger.debug(
|
|
434
|
+
"request api get_agent_runtime, request Request ID:"
|
|
435
|
+
f" {response.body.request_id}\n request:"
|
|
436
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
437
|
+
f" {response.body.data}"
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
return response.body.data
|
|
441
|
+
except ClientException as e:
|
|
442
|
+
raise ClientError(
|
|
443
|
+
e.status_code,
|
|
444
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
445
|
+
request_id=e.request_id,
|
|
446
|
+
request=[
|
|
447
|
+
agent_id,
|
|
448
|
+
input,
|
|
449
|
+
],
|
|
450
|
+
) from e
|
|
451
|
+
except ServerException as e:
|
|
452
|
+
raise ServerError(
|
|
453
|
+
e.status_code,
|
|
454
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
455
|
+
request_id=e.request_id,
|
|
456
|
+
) from e
|
|
457
|
+
|
|
458
|
+
async def get_agent_runtime_async(
|
|
459
|
+
self,
|
|
460
|
+
agent_id: str,
|
|
461
|
+
input: GetAgentRuntimeRequest,
|
|
462
|
+
headers: Optional[Dict[str, str]] = None,
|
|
463
|
+
config: Optional[Config] = None,
|
|
464
|
+
) -> AgentRuntime:
|
|
465
|
+
"""获取 Agent Runtime
|
|
466
|
+
|
|
467
|
+
Args:
|
|
468
|
+
agent_id: Agent Runtime ID
|
|
469
|
+
input: Agent Runtime 配置
|
|
470
|
+
|
|
471
|
+
headers: 请求头
|
|
472
|
+
config: 配置
|
|
473
|
+
|
|
474
|
+
Returns:
|
|
475
|
+
AgentRuntime: 创建的 Runtime 对象
|
|
476
|
+
|
|
477
|
+
Raises:
|
|
478
|
+
AgentRuntimeError: 调用失败时抛出
|
|
479
|
+
ClientError: 客户端错误
|
|
480
|
+
ServerError: 服务器错误
|
|
481
|
+
APIError: 运行时错误
|
|
482
|
+
"""
|
|
483
|
+
|
|
484
|
+
try:
|
|
485
|
+
client = self._get_client(config)
|
|
486
|
+
response = await client.get_agent_runtime_with_options_async(
|
|
487
|
+
agent_id,
|
|
488
|
+
input,
|
|
489
|
+
headers=headers or {},
|
|
490
|
+
runtime=RuntimeOptions(),
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
logger.debug(
|
|
494
|
+
"request api get_agent_runtime, request Request ID:"
|
|
495
|
+
f" {response.body.request_id}\n request:"
|
|
496
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
497
|
+
f" {response.body.data}"
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
return response.body.data
|
|
501
|
+
except ClientException as e:
|
|
502
|
+
raise ClientError(
|
|
503
|
+
e.status_code,
|
|
504
|
+
e.data.get("message", e.message),
|
|
505
|
+
request_id=e.request_id,
|
|
506
|
+
request=[
|
|
507
|
+
agent_id,
|
|
508
|
+
input,
|
|
509
|
+
],
|
|
510
|
+
) from e
|
|
511
|
+
except ServerException as e:
|
|
512
|
+
raise ServerError(
|
|
513
|
+
e.status_code,
|
|
514
|
+
e.data.get("message", e.message),
|
|
515
|
+
request_id=e.request_id,
|
|
516
|
+
) from e
|
|
517
|
+
|
|
518
|
+
def list_agent_runtimes(
|
|
519
|
+
self,
|
|
520
|
+
input: ListAgentRuntimesRequest,
|
|
521
|
+
headers: Optional[Dict[str, str]] = None,
|
|
522
|
+
config: Optional[Config] = None,
|
|
523
|
+
) -> ListAgentRuntimesOutput:
|
|
524
|
+
"""枚举 Agent Runtime
|
|
525
|
+
|
|
526
|
+
Args:
|
|
527
|
+
input: 枚举的配置
|
|
528
|
+
|
|
529
|
+
headers: 请求头
|
|
530
|
+
config: 配置
|
|
531
|
+
|
|
532
|
+
Returns:
|
|
533
|
+
ListAgentRuntimesOutput: 创建的 Runtime 对象
|
|
534
|
+
|
|
535
|
+
Raises:
|
|
536
|
+
AgentRuntimeError: 调用失败时抛出
|
|
537
|
+
ClientError: 客户端错误
|
|
538
|
+
ServerError: 服务器错误
|
|
539
|
+
APIError: 运行时错误
|
|
540
|
+
"""
|
|
541
|
+
|
|
542
|
+
try:
|
|
543
|
+
client = self._get_client(config)
|
|
544
|
+
response = client.list_agent_runtimes_with_options(
|
|
545
|
+
input,
|
|
546
|
+
headers=headers or {},
|
|
547
|
+
runtime=RuntimeOptions(),
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
logger.debug(
|
|
551
|
+
"request api list_agent_runtimes, request Request ID:"
|
|
552
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
553
|
+
f" response: {response.body.data}"
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
return response.body.data
|
|
557
|
+
except ClientException as e:
|
|
558
|
+
raise ClientError(
|
|
559
|
+
e.status_code,
|
|
560
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
561
|
+
request_id=e.request_id,
|
|
562
|
+
request=[
|
|
563
|
+
input,
|
|
564
|
+
],
|
|
565
|
+
) from e
|
|
566
|
+
except ServerException as e:
|
|
567
|
+
raise ServerError(
|
|
568
|
+
e.status_code,
|
|
569
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
570
|
+
request_id=e.request_id,
|
|
571
|
+
) from e
|
|
572
|
+
|
|
573
|
+
async def list_agent_runtimes_async(
|
|
574
|
+
self,
|
|
575
|
+
input: ListAgentRuntimesRequest,
|
|
576
|
+
headers: Optional[Dict[str, str]] = None,
|
|
577
|
+
config: Optional[Config] = None,
|
|
578
|
+
) -> ListAgentRuntimesOutput:
|
|
579
|
+
"""枚举 Agent Runtime
|
|
580
|
+
|
|
581
|
+
Args:
|
|
582
|
+
input: 枚举的配置
|
|
583
|
+
|
|
584
|
+
headers: 请求头
|
|
585
|
+
config: 配置
|
|
586
|
+
|
|
587
|
+
Returns:
|
|
588
|
+
ListAgentRuntimesOutput: 创建的 Runtime 对象
|
|
589
|
+
|
|
590
|
+
Raises:
|
|
591
|
+
AgentRuntimeError: 调用失败时抛出
|
|
592
|
+
ClientError: 客户端错误
|
|
593
|
+
ServerError: 服务器错误
|
|
594
|
+
APIError: 运行时错误
|
|
595
|
+
"""
|
|
596
|
+
|
|
597
|
+
try:
|
|
598
|
+
client = self._get_client(config)
|
|
599
|
+
response = await client.list_agent_runtimes_with_options_async(
|
|
600
|
+
input,
|
|
601
|
+
headers=headers or {},
|
|
602
|
+
runtime=RuntimeOptions(),
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
logger.debug(
|
|
606
|
+
"request api list_agent_runtimes, request Request ID:"
|
|
607
|
+
f" {response.body.request_id}\n request: {[input.to_map(),]}\n"
|
|
608
|
+
f" response: {response.body.data}"
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
return response.body.data
|
|
612
|
+
except ClientException as e:
|
|
613
|
+
raise ClientError(
|
|
614
|
+
e.status_code,
|
|
615
|
+
e.data.get("message", e.message),
|
|
616
|
+
request_id=e.request_id,
|
|
617
|
+
request=[
|
|
618
|
+
input,
|
|
619
|
+
],
|
|
620
|
+
) from e
|
|
621
|
+
except ServerException as e:
|
|
622
|
+
raise ServerError(
|
|
623
|
+
e.status_code,
|
|
624
|
+
e.data.get("message", e.message),
|
|
625
|
+
request_id=e.request_id,
|
|
626
|
+
) from e
|
|
627
|
+
|
|
628
|
+
def create_agent_runtime_endpoint(
|
|
629
|
+
self,
|
|
630
|
+
agent_id: str,
|
|
631
|
+
input: CreateAgentRuntimeEndpointInput,
|
|
632
|
+
headers: Optional[Dict[str, str]] = None,
|
|
633
|
+
config: Optional[Config] = None,
|
|
634
|
+
) -> AgentRuntimeEndpoint:
|
|
635
|
+
"""创建 Agent Runtime 访问端点
|
|
636
|
+
|
|
637
|
+
Args:
|
|
638
|
+
agent_id: Agent Runtime ID
|
|
639
|
+
input: 端点配置
|
|
640
|
+
|
|
641
|
+
headers: 请求头
|
|
642
|
+
config: 配置
|
|
643
|
+
|
|
644
|
+
Returns:
|
|
645
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
646
|
+
|
|
647
|
+
Raises:
|
|
648
|
+
AgentRuntimeError: 调用失败时抛出
|
|
649
|
+
ClientError: 客户端错误
|
|
650
|
+
ServerError: 服务器错误
|
|
651
|
+
APIError: 运行时错误
|
|
652
|
+
"""
|
|
653
|
+
|
|
654
|
+
try:
|
|
655
|
+
client = self._get_client(config)
|
|
656
|
+
response = client.create_agent_runtime_endpoint_with_options(
|
|
657
|
+
agent_id,
|
|
658
|
+
CreateAgentRuntimeEndpointRequest(body=input),
|
|
659
|
+
headers=headers or {},
|
|
660
|
+
runtime=RuntimeOptions(),
|
|
661
|
+
)
|
|
662
|
+
|
|
663
|
+
logger.debug(
|
|
664
|
+
"request api create_agent_runtime_endpoint, request Request"
|
|
665
|
+
f" ID: {response.body.request_id}\n request:"
|
|
666
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
667
|
+
f" {response.body.data}"
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
return response.body.data
|
|
671
|
+
except ClientException as e:
|
|
672
|
+
raise ClientError(
|
|
673
|
+
e.status_code,
|
|
674
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
675
|
+
request_id=e.request_id,
|
|
676
|
+
request=[
|
|
677
|
+
agent_id,
|
|
678
|
+
input,
|
|
679
|
+
],
|
|
680
|
+
) from e
|
|
681
|
+
except ServerException as e:
|
|
682
|
+
raise ServerError(
|
|
683
|
+
e.status_code,
|
|
684
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
685
|
+
request_id=e.request_id,
|
|
686
|
+
) from e
|
|
687
|
+
|
|
688
|
+
async def create_agent_runtime_endpoint_async(
|
|
689
|
+
self,
|
|
690
|
+
agent_id: str,
|
|
691
|
+
input: CreateAgentRuntimeEndpointInput,
|
|
692
|
+
headers: Optional[Dict[str, str]] = None,
|
|
693
|
+
config: Optional[Config] = None,
|
|
694
|
+
) -> AgentRuntimeEndpoint:
|
|
695
|
+
"""创建 Agent Runtime 访问端点
|
|
696
|
+
|
|
697
|
+
Args:
|
|
698
|
+
agent_id: Agent Runtime ID
|
|
699
|
+
input: 端点配置
|
|
700
|
+
|
|
701
|
+
headers: 请求头
|
|
702
|
+
config: 配置
|
|
703
|
+
|
|
704
|
+
Returns:
|
|
705
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
706
|
+
|
|
707
|
+
Raises:
|
|
708
|
+
AgentRuntimeError: 调用失败时抛出
|
|
709
|
+
ClientError: 客户端错误
|
|
710
|
+
ServerError: 服务器错误
|
|
711
|
+
APIError: 运行时错误
|
|
712
|
+
"""
|
|
713
|
+
|
|
714
|
+
try:
|
|
715
|
+
client = self._get_client(config)
|
|
716
|
+
response = (
|
|
717
|
+
await client.create_agent_runtime_endpoint_with_options_async(
|
|
718
|
+
agent_id,
|
|
719
|
+
CreateAgentRuntimeEndpointRequest(body=input),
|
|
720
|
+
headers=headers or {},
|
|
721
|
+
runtime=RuntimeOptions(),
|
|
722
|
+
)
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
logger.debug(
|
|
726
|
+
"request api create_agent_runtime_endpoint, request Request"
|
|
727
|
+
f" ID: {response.body.request_id}\n request:"
|
|
728
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
729
|
+
f" {response.body.data}"
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
return response.body.data
|
|
733
|
+
except ClientException as e:
|
|
734
|
+
raise ClientError(
|
|
735
|
+
e.status_code,
|
|
736
|
+
e.data.get("message", e.message),
|
|
737
|
+
request_id=e.request_id,
|
|
738
|
+
request=[
|
|
739
|
+
agent_id,
|
|
740
|
+
input,
|
|
741
|
+
],
|
|
742
|
+
) from e
|
|
743
|
+
except ServerException as e:
|
|
744
|
+
raise ServerError(
|
|
745
|
+
e.status_code,
|
|
746
|
+
e.data.get("message", e.message),
|
|
747
|
+
request_id=e.request_id,
|
|
748
|
+
) from e
|
|
749
|
+
|
|
750
|
+
def delete_agent_runtime_endpoint(
|
|
751
|
+
self,
|
|
752
|
+
agent_id: str,
|
|
753
|
+
endpoint_id: str,
|
|
754
|
+
headers: Optional[Dict[str, str]] = None,
|
|
755
|
+
config: Optional[Config] = None,
|
|
756
|
+
) -> AgentRuntimeEndpoint:
|
|
757
|
+
"""删除 Agent Runtime 访问端点
|
|
758
|
+
|
|
759
|
+
Args:
|
|
760
|
+
agent_id: Agent Runtime ID
|
|
761
|
+
endpoint_id: 端点 ID
|
|
762
|
+
|
|
763
|
+
headers: 请求头
|
|
764
|
+
config: 配置
|
|
765
|
+
|
|
766
|
+
Returns:
|
|
767
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
768
|
+
|
|
769
|
+
Raises:
|
|
770
|
+
AgentRuntimeError: 调用失败时抛出
|
|
771
|
+
ClientError: 客户端错误
|
|
772
|
+
ServerError: 服务器错误
|
|
773
|
+
APIError: 运行时错误
|
|
774
|
+
"""
|
|
775
|
+
|
|
776
|
+
try:
|
|
777
|
+
client = self._get_client(config)
|
|
778
|
+
response = client.delete_agent_runtime_endpoint_with_options(
|
|
779
|
+
agent_id,
|
|
780
|
+
endpoint_id,
|
|
781
|
+
headers=headers or {},
|
|
782
|
+
runtime=RuntimeOptions(),
|
|
783
|
+
)
|
|
784
|
+
|
|
785
|
+
logger.debug(
|
|
786
|
+
"request api delete_agent_runtime_endpoint, request Request"
|
|
787
|
+
f" ID: {response.body.request_id}\n request:"
|
|
788
|
+
f" {[agent_id,endpoint_id,]}\n response: {response.body.data}"
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
return response.body.data
|
|
792
|
+
except ClientException as e:
|
|
793
|
+
raise ClientError(
|
|
794
|
+
e.status_code,
|
|
795
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
796
|
+
request_id=e.request_id,
|
|
797
|
+
request=[
|
|
798
|
+
agent_id,
|
|
799
|
+
endpoint_id,
|
|
800
|
+
],
|
|
801
|
+
) from e
|
|
802
|
+
except ServerException as e:
|
|
803
|
+
raise ServerError(
|
|
804
|
+
e.status_code,
|
|
805
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
806
|
+
request_id=e.request_id,
|
|
807
|
+
) from e
|
|
808
|
+
|
|
809
|
+
async def delete_agent_runtime_endpoint_async(
|
|
810
|
+
self,
|
|
811
|
+
agent_id: str,
|
|
812
|
+
endpoint_id: str,
|
|
813
|
+
headers: Optional[Dict[str, str]] = None,
|
|
814
|
+
config: Optional[Config] = None,
|
|
815
|
+
) -> AgentRuntimeEndpoint:
|
|
816
|
+
"""删除 Agent Runtime 访问端点
|
|
817
|
+
|
|
818
|
+
Args:
|
|
819
|
+
agent_id: Agent Runtime ID
|
|
820
|
+
endpoint_id: 端点 ID
|
|
821
|
+
|
|
822
|
+
headers: 请求头
|
|
823
|
+
config: 配置
|
|
824
|
+
|
|
825
|
+
Returns:
|
|
826
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
827
|
+
|
|
828
|
+
Raises:
|
|
829
|
+
AgentRuntimeError: 调用失败时抛出
|
|
830
|
+
ClientError: 客户端错误
|
|
831
|
+
ServerError: 服务器错误
|
|
832
|
+
APIError: 运行时错误
|
|
833
|
+
"""
|
|
834
|
+
|
|
835
|
+
try:
|
|
836
|
+
client = self._get_client(config)
|
|
837
|
+
response = (
|
|
838
|
+
await client.delete_agent_runtime_endpoint_with_options_async(
|
|
839
|
+
agent_id,
|
|
840
|
+
endpoint_id,
|
|
841
|
+
headers=headers or {},
|
|
842
|
+
runtime=RuntimeOptions(),
|
|
843
|
+
)
|
|
844
|
+
)
|
|
845
|
+
|
|
846
|
+
logger.debug(
|
|
847
|
+
"request api delete_agent_runtime_endpoint, request Request"
|
|
848
|
+
f" ID: {response.body.request_id}\n request:"
|
|
849
|
+
f" {[agent_id,endpoint_id,]}\n response: {response.body.data}"
|
|
850
|
+
)
|
|
851
|
+
|
|
852
|
+
return response.body.data
|
|
853
|
+
except ClientException as e:
|
|
854
|
+
raise ClientError(
|
|
855
|
+
e.status_code,
|
|
856
|
+
e.data.get("message", e.message),
|
|
857
|
+
request_id=e.request_id,
|
|
858
|
+
request=[
|
|
859
|
+
agent_id,
|
|
860
|
+
endpoint_id,
|
|
861
|
+
],
|
|
862
|
+
) from e
|
|
863
|
+
except ServerException as e:
|
|
864
|
+
raise ServerError(
|
|
865
|
+
e.status_code,
|
|
866
|
+
e.data.get("message", e.message),
|
|
867
|
+
request_id=e.request_id,
|
|
868
|
+
) from e
|
|
869
|
+
|
|
870
|
+
def update_agent_runtime_endpoint(
|
|
871
|
+
self,
|
|
872
|
+
agent_id: str,
|
|
873
|
+
endpoint_id: str,
|
|
874
|
+
input: UpdateAgentRuntimeEndpointInput,
|
|
875
|
+
headers: Optional[Dict[str, str]] = None,
|
|
876
|
+
config: Optional[Config] = None,
|
|
877
|
+
) -> AgentRuntimeEndpoint:
|
|
878
|
+
"""更新 Agent Runtime 访问端点
|
|
879
|
+
|
|
880
|
+
Args:
|
|
881
|
+
agent_id: Agent Runtime ID
|
|
882
|
+
endpoint_id: 端点 ID
|
|
883
|
+
input: 端点配置
|
|
884
|
+
|
|
885
|
+
headers: 请求头
|
|
886
|
+
config: 配置
|
|
887
|
+
|
|
888
|
+
Returns:
|
|
889
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
890
|
+
|
|
891
|
+
Raises:
|
|
892
|
+
AgentRuntimeError: 调用失败时抛出
|
|
893
|
+
ClientError: 客户端错误
|
|
894
|
+
ServerError: 服务器错误
|
|
895
|
+
APIError: 运行时错误
|
|
896
|
+
"""
|
|
897
|
+
|
|
898
|
+
try:
|
|
899
|
+
client = self._get_client(config)
|
|
900
|
+
response = client.update_agent_runtime_endpoint_with_options(
|
|
901
|
+
agent_id,
|
|
902
|
+
endpoint_id,
|
|
903
|
+
UpdateAgentRuntimeEndpointRequest(body=input),
|
|
904
|
+
headers=headers or {},
|
|
905
|
+
runtime=RuntimeOptions(),
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
logger.debug(
|
|
909
|
+
"request api update_agent_runtime_endpoint, request Request"
|
|
910
|
+
f" ID: {response.body.request_id}\n request:"
|
|
911
|
+
f" {[agent_id,endpoint_id,input.to_map(),]}\n response:"
|
|
912
|
+
f" {response.body.data}"
|
|
913
|
+
)
|
|
914
|
+
|
|
915
|
+
return response.body.data
|
|
916
|
+
except ClientException as e:
|
|
917
|
+
raise ClientError(
|
|
918
|
+
e.status_code,
|
|
919
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
920
|
+
request_id=e.request_id,
|
|
921
|
+
request=[
|
|
922
|
+
agent_id,
|
|
923
|
+
endpoint_id,
|
|
924
|
+
input,
|
|
925
|
+
],
|
|
926
|
+
) from e
|
|
927
|
+
except ServerException as e:
|
|
928
|
+
raise ServerError(
|
|
929
|
+
e.status_code,
|
|
930
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
931
|
+
request_id=e.request_id,
|
|
932
|
+
) from e
|
|
933
|
+
|
|
934
|
+
async def update_agent_runtime_endpoint_async(
|
|
935
|
+
self,
|
|
936
|
+
agent_id: str,
|
|
937
|
+
endpoint_id: str,
|
|
938
|
+
input: UpdateAgentRuntimeEndpointInput,
|
|
939
|
+
headers: Optional[Dict[str, str]] = None,
|
|
940
|
+
config: Optional[Config] = None,
|
|
941
|
+
) -> AgentRuntimeEndpoint:
|
|
942
|
+
"""更新 Agent Runtime 访问端点
|
|
943
|
+
|
|
944
|
+
Args:
|
|
945
|
+
agent_id: Agent Runtime ID
|
|
946
|
+
endpoint_id: 端点 ID
|
|
947
|
+
input: 端点配置
|
|
948
|
+
|
|
949
|
+
headers: 请求头
|
|
950
|
+
config: 配置
|
|
951
|
+
|
|
952
|
+
Returns:
|
|
953
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
954
|
+
|
|
955
|
+
Raises:
|
|
956
|
+
AgentRuntimeError: 调用失败时抛出
|
|
957
|
+
ClientError: 客户端错误
|
|
958
|
+
ServerError: 服务器错误
|
|
959
|
+
APIError: 运行时错误
|
|
960
|
+
"""
|
|
961
|
+
|
|
962
|
+
try:
|
|
963
|
+
client = self._get_client(config)
|
|
964
|
+
response = (
|
|
965
|
+
await client.update_agent_runtime_endpoint_with_options_async(
|
|
966
|
+
agent_id,
|
|
967
|
+
endpoint_id,
|
|
968
|
+
UpdateAgentRuntimeEndpointRequest(body=input),
|
|
969
|
+
headers=headers or {},
|
|
970
|
+
runtime=RuntimeOptions(),
|
|
971
|
+
)
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
logger.debug(
|
|
975
|
+
"request api update_agent_runtime_endpoint, request Request"
|
|
976
|
+
f" ID: {response.body.request_id}\n request:"
|
|
977
|
+
f" {[agent_id,endpoint_id,input.to_map(),]}\n response:"
|
|
978
|
+
f" {response.body.data}"
|
|
979
|
+
)
|
|
980
|
+
|
|
981
|
+
return response.body.data
|
|
982
|
+
except ClientException as e:
|
|
983
|
+
raise ClientError(
|
|
984
|
+
e.status_code,
|
|
985
|
+
e.data.get("message", e.message),
|
|
986
|
+
request_id=e.request_id,
|
|
987
|
+
request=[
|
|
988
|
+
agent_id,
|
|
989
|
+
endpoint_id,
|
|
990
|
+
input,
|
|
991
|
+
],
|
|
992
|
+
) from e
|
|
993
|
+
except ServerException as e:
|
|
994
|
+
raise ServerError(
|
|
995
|
+
e.status_code,
|
|
996
|
+
e.data.get("message", e.message),
|
|
997
|
+
request_id=e.request_id,
|
|
998
|
+
) from e
|
|
999
|
+
|
|
1000
|
+
def get_agent_runtime_endpoint(
|
|
1001
|
+
self,
|
|
1002
|
+
agent_id: str,
|
|
1003
|
+
endpoint_id: str,
|
|
1004
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1005
|
+
config: Optional[Config] = None,
|
|
1006
|
+
) -> AgentRuntimeEndpoint:
|
|
1007
|
+
"""获取 Agent Runtime 访问端点
|
|
1008
|
+
|
|
1009
|
+
Args:
|
|
1010
|
+
agent_id: Agent Runtime ID
|
|
1011
|
+
endpoint_id: 端点 ID
|
|
1012
|
+
|
|
1013
|
+
headers: 请求头
|
|
1014
|
+
config: 配置
|
|
1015
|
+
|
|
1016
|
+
Returns:
|
|
1017
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
1018
|
+
|
|
1019
|
+
Raises:
|
|
1020
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1021
|
+
ClientError: 客户端错误
|
|
1022
|
+
ServerError: 服务器错误
|
|
1023
|
+
APIError: 运行时错误
|
|
1024
|
+
"""
|
|
1025
|
+
|
|
1026
|
+
try:
|
|
1027
|
+
client = self._get_client(config)
|
|
1028
|
+
response = client.get_agent_runtime_endpoint_with_options(
|
|
1029
|
+
agent_id,
|
|
1030
|
+
endpoint_id,
|
|
1031
|
+
headers=headers or {},
|
|
1032
|
+
runtime=RuntimeOptions(),
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
logger.debug(
|
|
1036
|
+
"request api get_agent_runtime_endpoint, request Request ID:"
|
|
1037
|
+
f" {response.body.request_id}\n request:"
|
|
1038
|
+
f" {[agent_id,endpoint_id,]}\n response: {response.body.data}"
|
|
1039
|
+
)
|
|
1040
|
+
|
|
1041
|
+
return response.body.data
|
|
1042
|
+
except ClientException as e:
|
|
1043
|
+
raise ClientError(
|
|
1044
|
+
e.status_code,
|
|
1045
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1046
|
+
request_id=e.request_id,
|
|
1047
|
+
request=[
|
|
1048
|
+
agent_id,
|
|
1049
|
+
endpoint_id,
|
|
1050
|
+
],
|
|
1051
|
+
) from e
|
|
1052
|
+
except ServerException as e:
|
|
1053
|
+
raise ServerError(
|
|
1054
|
+
e.status_code,
|
|
1055
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1056
|
+
request_id=e.request_id,
|
|
1057
|
+
) from e
|
|
1058
|
+
|
|
1059
|
+
async def get_agent_runtime_endpoint_async(
|
|
1060
|
+
self,
|
|
1061
|
+
agent_id: str,
|
|
1062
|
+
endpoint_id: str,
|
|
1063
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1064
|
+
config: Optional[Config] = None,
|
|
1065
|
+
) -> AgentRuntimeEndpoint:
|
|
1066
|
+
"""获取 Agent Runtime 访问端点
|
|
1067
|
+
|
|
1068
|
+
Args:
|
|
1069
|
+
agent_id: Agent Runtime ID
|
|
1070
|
+
endpoint_id: 端点 ID
|
|
1071
|
+
|
|
1072
|
+
headers: 请求头
|
|
1073
|
+
config: 配置
|
|
1074
|
+
|
|
1075
|
+
Returns:
|
|
1076
|
+
AgentRuntimeEndpoint: 创建的 Runtime 对象
|
|
1077
|
+
|
|
1078
|
+
Raises:
|
|
1079
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1080
|
+
ClientError: 客户端错误
|
|
1081
|
+
ServerError: 服务器错误
|
|
1082
|
+
APIError: 运行时错误
|
|
1083
|
+
"""
|
|
1084
|
+
|
|
1085
|
+
try:
|
|
1086
|
+
client = self._get_client(config)
|
|
1087
|
+
response = (
|
|
1088
|
+
await client.get_agent_runtime_endpoint_with_options_async(
|
|
1089
|
+
agent_id,
|
|
1090
|
+
endpoint_id,
|
|
1091
|
+
headers=headers or {},
|
|
1092
|
+
runtime=RuntimeOptions(),
|
|
1093
|
+
)
|
|
1094
|
+
)
|
|
1095
|
+
|
|
1096
|
+
logger.debug(
|
|
1097
|
+
"request api get_agent_runtime_endpoint, request Request ID:"
|
|
1098
|
+
f" {response.body.request_id}\n request:"
|
|
1099
|
+
f" {[agent_id,endpoint_id,]}\n response: {response.body.data}"
|
|
1100
|
+
)
|
|
1101
|
+
|
|
1102
|
+
return response.body.data
|
|
1103
|
+
except ClientException as e:
|
|
1104
|
+
raise ClientError(
|
|
1105
|
+
e.status_code,
|
|
1106
|
+
e.data.get("message", e.message),
|
|
1107
|
+
request_id=e.request_id,
|
|
1108
|
+
request=[
|
|
1109
|
+
agent_id,
|
|
1110
|
+
endpoint_id,
|
|
1111
|
+
],
|
|
1112
|
+
) from e
|
|
1113
|
+
except ServerException as e:
|
|
1114
|
+
raise ServerError(
|
|
1115
|
+
e.status_code,
|
|
1116
|
+
e.data.get("message", e.message),
|
|
1117
|
+
request_id=e.request_id,
|
|
1118
|
+
) from e
|
|
1119
|
+
|
|
1120
|
+
def list_agent_runtime_endpoints(
|
|
1121
|
+
self,
|
|
1122
|
+
agent_id: str,
|
|
1123
|
+
input: ListAgentRuntimeEndpointsRequest,
|
|
1124
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1125
|
+
config: Optional[Config] = None,
|
|
1126
|
+
) -> ListAgentRuntimeEndpointsOutput:
|
|
1127
|
+
"""枚举 Agent Runtime 访问端点
|
|
1128
|
+
|
|
1129
|
+
Args:
|
|
1130
|
+
agent_id: Agent Runtime ID
|
|
1131
|
+
input: 枚举的配置
|
|
1132
|
+
|
|
1133
|
+
headers: 请求头
|
|
1134
|
+
config: 配置
|
|
1135
|
+
|
|
1136
|
+
Returns:
|
|
1137
|
+
ListAgentRuntimeEndpointsOutput: 创建的 Runtime 对象
|
|
1138
|
+
|
|
1139
|
+
Raises:
|
|
1140
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1141
|
+
ClientError: 客户端错误
|
|
1142
|
+
ServerError: 服务器错误
|
|
1143
|
+
APIError: 运行时错误
|
|
1144
|
+
"""
|
|
1145
|
+
|
|
1146
|
+
try:
|
|
1147
|
+
client = self._get_client(config)
|
|
1148
|
+
response = client.list_agent_runtime_endpoints_with_options(
|
|
1149
|
+
agent_id,
|
|
1150
|
+
input,
|
|
1151
|
+
headers=headers or {},
|
|
1152
|
+
runtime=RuntimeOptions(),
|
|
1153
|
+
)
|
|
1154
|
+
|
|
1155
|
+
logger.debug(
|
|
1156
|
+
"request api list_agent_runtime_endpoints, request Request ID:"
|
|
1157
|
+
f" {response.body.request_id}\n request:"
|
|
1158
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
1159
|
+
f" {response.body.data}"
|
|
1160
|
+
)
|
|
1161
|
+
|
|
1162
|
+
return response.body.data
|
|
1163
|
+
except ClientException as e:
|
|
1164
|
+
raise ClientError(
|
|
1165
|
+
e.status_code,
|
|
1166
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1167
|
+
request_id=e.request_id,
|
|
1168
|
+
request=[
|
|
1169
|
+
agent_id,
|
|
1170
|
+
input,
|
|
1171
|
+
],
|
|
1172
|
+
) from e
|
|
1173
|
+
except ServerException as e:
|
|
1174
|
+
raise ServerError(
|
|
1175
|
+
e.status_code,
|
|
1176
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1177
|
+
request_id=e.request_id,
|
|
1178
|
+
) from e
|
|
1179
|
+
|
|
1180
|
+
async def list_agent_runtime_endpoints_async(
|
|
1181
|
+
self,
|
|
1182
|
+
agent_id: str,
|
|
1183
|
+
input: ListAgentRuntimeEndpointsRequest,
|
|
1184
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1185
|
+
config: Optional[Config] = None,
|
|
1186
|
+
) -> ListAgentRuntimeEndpointsOutput:
|
|
1187
|
+
"""枚举 Agent Runtime 访问端点
|
|
1188
|
+
|
|
1189
|
+
Args:
|
|
1190
|
+
agent_id: Agent Runtime ID
|
|
1191
|
+
input: 枚举的配置
|
|
1192
|
+
|
|
1193
|
+
headers: 请求头
|
|
1194
|
+
config: 配置
|
|
1195
|
+
|
|
1196
|
+
Returns:
|
|
1197
|
+
ListAgentRuntimeEndpointsOutput: 创建的 Runtime 对象
|
|
1198
|
+
|
|
1199
|
+
Raises:
|
|
1200
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1201
|
+
ClientError: 客户端错误
|
|
1202
|
+
ServerError: 服务器错误
|
|
1203
|
+
APIError: 运行时错误
|
|
1204
|
+
"""
|
|
1205
|
+
|
|
1206
|
+
try:
|
|
1207
|
+
client = self._get_client(config)
|
|
1208
|
+
response = (
|
|
1209
|
+
await client.list_agent_runtime_endpoints_with_options_async(
|
|
1210
|
+
agent_id,
|
|
1211
|
+
input,
|
|
1212
|
+
headers=headers or {},
|
|
1213
|
+
runtime=RuntimeOptions(),
|
|
1214
|
+
)
|
|
1215
|
+
)
|
|
1216
|
+
|
|
1217
|
+
logger.debug(
|
|
1218
|
+
"request api list_agent_runtime_endpoints, request Request ID:"
|
|
1219
|
+
f" {response.body.request_id}\n request:"
|
|
1220
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
1221
|
+
f" {response.body.data}"
|
|
1222
|
+
)
|
|
1223
|
+
|
|
1224
|
+
return response.body.data
|
|
1225
|
+
except ClientException as e:
|
|
1226
|
+
raise ClientError(
|
|
1227
|
+
e.status_code,
|
|
1228
|
+
e.data.get("message", e.message),
|
|
1229
|
+
request_id=e.request_id,
|
|
1230
|
+
request=[
|
|
1231
|
+
agent_id,
|
|
1232
|
+
input,
|
|
1233
|
+
],
|
|
1234
|
+
) from e
|
|
1235
|
+
except ServerException as e:
|
|
1236
|
+
raise ServerError(
|
|
1237
|
+
e.status_code,
|
|
1238
|
+
e.data.get("message", e.message),
|
|
1239
|
+
request_id=e.request_id,
|
|
1240
|
+
) from e
|
|
1241
|
+
|
|
1242
|
+
def list_agent_runtime_versions(
|
|
1243
|
+
self,
|
|
1244
|
+
agent_id: str,
|
|
1245
|
+
input: ListAgentRuntimeVersionsRequest,
|
|
1246
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1247
|
+
config: Optional[Config] = None,
|
|
1248
|
+
) -> ListAgentRuntimeVersionsOutput:
|
|
1249
|
+
"""枚举 Agent Runtime 版本
|
|
1250
|
+
|
|
1251
|
+
Args:
|
|
1252
|
+
agent_id: Agent Runtime ID
|
|
1253
|
+
input: 版本配置
|
|
1254
|
+
|
|
1255
|
+
headers: 请求头
|
|
1256
|
+
config: 配置
|
|
1257
|
+
|
|
1258
|
+
Returns:
|
|
1259
|
+
ListAgentRuntimeVersionsOutput: Agent Runtime 版本
|
|
1260
|
+
|
|
1261
|
+
Raises:
|
|
1262
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1263
|
+
ClientError: 客户端错误
|
|
1264
|
+
ServerError: 服务器错误
|
|
1265
|
+
APIError: 运行时错误
|
|
1266
|
+
"""
|
|
1267
|
+
|
|
1268
|
+
try:
|
|
1269
|
+
client = self._get_client(config)
|
|
1270
|
+
response = client.list_agent_runtime_versions_with_options(
|
|
1271
|
+
agent_id,
|
|
1272
|
+
input,
|
|
1273
|
+
headers=headers or {},
|
|
1274
|
+
runtime=RuntimeOptions(),
|
|
1275
|
+
)
|
|
1276
|
+
|
|
1277
|
+
logger.debug(
|
|
1278
|
+
"request api list_agent_runtime_versions, request Request ID:"
|
|
1279
|
+
f" {response.body.request_id}\n request:"
|
|
1280
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
1281
|
+
f" {response.body.data}"
|
|
1282
|
+
)
|
|
1283
|
+
|
|
1284
|
+
return response.body.data
|
|
1285
|
+
except ClientException as e:
|
|
1286
|
+
raise ClientError(
|
|
1287
|
+
e.status_code,
|
|
1288
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1289
|
+
request_id=e.request_id,
|
|
1290
|
+
request=[
|
|
1291
|
+
agent_id,
|
|
1292
|
+
input,
|
|
1293
|
+
],
|
|
1294
|
+
) from e
|
|
1295
|
+
except ServerException as e:
|
|
1296
|
+
raise ServerError(
|
|
1297
|
+
e.status_code,
|
|
1298
|
+
pydash.get(e, "data.message", pydash.get(e, "message", "")),
|
|
1299
|
+
request_id=e.request_id,
|
|
1300
|
+
) from e
|
|
1301
|
+
|
|
1302
|
+
async def list_agent_runtime_versions_async(
|
|
1303
|
+
self,
|
|
1304
|
+
agent_id: str,
|
|
1305
|
+
input: ListAgentRuntimeVersionsRequest,
|
|
1306
|
+
headers: Optional[Dict[str, str]] = None,
|
|
1307
|
+
config: Optional[Config] = None,
|
|
1308
|
+
) -> ListAgentRuntimeVersionsOutput:
|
|
1309
|
+
"""枚举 Agent Runtime 版本
|
|
1310
|
+
|
|
1311
|
+
Args:
|
|
1312
|
+
agent_id: Agent Runtime ID
|
|
1313
|
+
input: 版本配置
|
|
1314
|
+
|
|
1315
|
+
headers: 请求头
|
|
1316
|
+
config: 配置
|
|
1317
|
+
|
|
1318
|
+
Returns:
|
|
1319
|
+
ListAgentRuntimeVersionsOutput: Agent Runtime 版本
|
|
1320
|
+
|
|
1321
|
+
Raises:
|
|
1322
|
+
AgentRuntimeError: 调用失败时抛出
|
|
1323
|
+
ClientError: 客户端错误
|
|
1324
|
+
ServerError: 服务器错误
|
|
1325
|
+
APIError: 运行时错误
|
|
1326
|
+
"""
|
|
1327
|
+
|
|
1328
|
+
try:
|
|
1329
|
+
client = self._get_client(config)
|
|
1330
|
+
response = (
|
|
1331
|
+
await client.list_agent_runtime_versions_with_options_async(
|
|
1332
|
+
agent_id,
|
|
1333
|
+
input,
|
|
1334
|
+
headers=headers or {},
|
|
1335
|
+
runtime=RuntimeOptions(),
|
|
1336
|
+
)
|
|
1337
|
+
)
|
|
1338
|
+
|
|
1339
|
+
logger.debug(
|
|
1340
|
+
"request api list_agent_runtime_versions, request Request ID:"
|
|
1341
|
+
f" {response.body.request_id}\n request:"
|
|
1342
|
+
f" {[agent_id,input.to_map(),]}\n response:"
|
|
1343
|
+
f" {response.body.data}"
|
|
1344
|
+
)
|
|
1345
|
+
|
|
1346
|
+
return response.body.data
|
|
1347
|
+
except ClientException as e:
|
|
1348
|
+
raise ClientError(
|
|
1349
|
+
e.status_code,
|
|
1350
|
+
e.data.get("message", e.message),
|
|
1351
|
+
request_id=e.request_id,
|
|
1352
|
+
request=[
|
|
1353
|
+
agent_id,
|
|
1354
|
+
input,
|
|
1355
|
+
],
|
|
1356
|
+
) from e
|
|
1357
|
+
except ServerException as e:
|
|
1358
|
+
raise ServerError(
|
|
1359
|
+
e.status_code,
|
|
1360
|
+
e.data.get("message", e.message),
|
|
1361
|
+
request_id=e.request_id,
|
|
1362
|
+
) from e
|