antchain-antdigital-agentcrew 1.0.1__tar.gz

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.
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.1
2
+ Name: antchain_antdigital_agentcrew
3
+ Version: 1.0.1
4
+ Summary: Ant Chain AGENTCREW SDK Library for Python
5
+ Home-page: https://github.com/alipay/antchain-openapi-prod-sdk
6
+ Author: Ant Chain SDK
7
+ Author-email: sdk-team@alibabacloud.com
8
+ License: Apache License 2.0
9
+ Description: UNKNOWN
10
+ Keywords: antchain,agentcrew
11
+ Platform: any
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.6
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Topic :: Software Development
22
+ Requires-Python: >=3.6
23
+ Description-Content-Type: text/markdown
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.1
2
+ Name: antchain-antdigital-agentcrew
3
+ Version: 1.0.1
4
+ Summary: Ant Chain AGENTCREW SDK Library for Python
5
+ Home-page: https://github.com/alipay/antchain-openapi-prod-sdk
6
+ Author: Ant Chain SDK
7
+ Author-email: sdk-team@alibabacloud.com
8
+ License: Apache License 2.0
9
+ Description: UNKNOWN
10
+ Keywords: antchain,agentcrew
11
+ Platform: any
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.6
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Topic :: Software Development
22
+ Requires-Python: >=3.6
23
+ Description-Content-Type: text/markdown
@@ -0,0 +1,9 @@
1
+ setup.py
2
+ antchain_antdigital_agentcrew.egg-info/PKG-INFO
3
+ antchain_antdigital_agentcrew.egg-info/SOURCES.txt
4
+ antchain_antdigital_agentcrew.egg-info/dependency_links.txt
5
+ antchain_antdigital_agentcrew.egg-info/requires.txt
6
+ antchain_antdigital_agentcrew.egg-info/top_level.txt
7
+ antchain_sdk_agentcrew/__init__.py
8
+ antchain_sdk_agentcrew/client.py
9
+ antchain_sdk_agentcrew/models.py
@@ -0,0 +1,3 @@
1
+ antchain_alipay_util<2.0.0,>=1.0.1
2
+ alibabacloud_tea_util<1.0.0,>=0.3.14
3
+ alibabacloud_rpc_util<1.0.0,>=0.0.4
@@ -0,0 +1 @@
1
+ __version__ = "1.0.1"
@@ -0,0 +1,388 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is auto-generated, don't edit it. Thanks.
3
+ import time
4
+
5
+ from Tea.exceptions import TeaException, UnretryableException
6
+ from Tea.request import TeaRequest
7
+ from Tea.core import TeaCore
8
+ from antchain_alipay_util.antchain_utils import AntchainUtils
9
+ from typing import Dict
10
+
11
+ from antchain_sdk_agentcrew import models as agentcrew_models
12
+ from alibabacloud_tea_util.client import Client as UtilClient
13
+ from alibabacloud_tea_util import models as util_models
14
+ from alibabacloud_rpc_util.client import Client as RPCUtilClient
15
+
16
+
17
+ class Client:
18
+ _endpoint: str = None
19
+ _region_id: str = None
20
+ _access_key_id: str = None
21
+ _access_key_secret: str = None
22
+ _protocol: str = None
23
+ _user_agent: str = None
24
+ _read_timeout: int = None
25
+ _connect_timeout: int = None
26
+ _http_proxy: str = None
27
+ _https_proxy: str = None
28
+ _socks_5proxy: str = None
29
+ _socks_5net_work: str = None
30
+ _no_proxy: str = None
31
+ _max_idle_conns: int = None
32
+ _security_token: str = None
33
+ _max_idle_time_millis: int = None
34
+ _keep_alive_duration_millis: int = None
35
+ _max_requests: int = None
36
+ _max_requests_per_host: int = None
37
+
38
+ def __init__(
39
+ self,
40
+ config: agentcrew_models.Config,
41
+ ):
42
+ """
43
+ Init client with Config
44
+ @param config: config contains the necessary information to create a client
45
+ """
46
+ if UtilClient.is_unset(config):
47
+ raise TeaException({
48
+ 'code': 'ParameterMissing',
49
+ 'message': "'config' can not be unset"
50
+ })
51
+ self._access_key_id = config.access_key_id
52
+ self._access_key_secret = config.access_key_secret
53
+ self._security_token = config.security_token
54
+ self._endpoint = config.endpoint
55
+ self._protocol = config.protocol
56
+ self._user_agent = config.user_agent
57
+ self._read_timeout = UtilClient.default_number(config.read_timeout, 20000)
58
+ self._connect_timeout = UtilClient.default_number(config.connect_timeout, 20000)
59
+ self._http_proxy = config.http_proxy
60
+ self._https_proxy = config.https_proxy
61
+ self._no_proxy = config.no_proxy
62
+ self._socks_5proxy = config.socks_5proxy
63
+ self._socks_5net_work = config.socks_5net_work
64
+ self._max_idle_conns = UtilClient.default_number(config.max_idle_conns, 60000)
65
+ self._max_idle_time_millis = UtilClient.default_number(config.max_idle_time_millis, 5)
66
+ self._keep_alive_duration_millis = UtilClient.default_number(config.keep_alive_duration_millis, 5000)
67
+ self._max_requests = UtilClient.default_number(config.max_requests, 100)
68
+ self._max_requests_per_host = UtilClient.default_number(config.max_requests_per_host, 100)
69
+
70
+ def do_request(
71
+ self,
72
+ version: str,
73
+ action: str,
74
+ protocol: str,
75
+ method: str,
76
+ pathname: str,
77
+ request: dict,
78
+ headers: Dict[str, str],
79
+ runtime: util_models.RuntimeOptions,
80
+ ) -> dict:
81
+ """
82
+ Encapsulate the request and invoke the network
83
+ @param action: api name
84
+ @param protocol: http or https
85
+ @param method: e.g. GET
86
+ @param pathname: pathname of every api
87
+ @param request: which contains request params
88
+ @param runtime: which controls some details of call api, such as retry times
89
+ @return: the response
90
+ """
91
+ runtime.validate()
92
+ _runtime = {
93
+ 'timeouted': 'retry',
94
+ 'readTimeout': UtilClient.default_number(runtime.read_timeout, self._read_timeout),
95
+ 'connectTimeout': UtilClient.default_number(runtime.connect_timeout, self._connect_timeout),
96
+ 'httpProxy': UtilClient.default_string(runtime.http_proxy, self._http_proxy),
97
+ 'httpsProxy': UtilClient.default_string(runtime.https_proxy, self._https_proxy),
98
+ 'noProxy': UtilClient.default_string(runtime.no_proxy, self._no_proxy),
99
+ 'maxIdleConns': UtilClient.default_number(runtime.max_idle_conns, self._max_idle_conns),
100
+ 'maxIdleTimeMillis': self._max_idle_time_millis,
101
+ 'keepAliveDuration': self._keep_alive_duration_millis,
102
+ 'maxRequests': self._max_requests,
103
+ 'maxRequestsPerHost': self._max_requests_per_host,
104
+ 'retry': {
105
+ 'retryable': runtime.autoretry,
106
+ 'maxAttempts': UtilClient.default_number(runtime.max_attempts, 3)
107
+ },
108
+ 'backoff': {
109
+ 'policy': UtilClient.default_string(runtime.backoff_policy, 'no'),
110
+ 'period': UtilClient.default_number(runtime.backoff_period, 1)
111
+ },
112
+ 'ignoreSSL': runtime.ignore_ssl,
113
+ # air引擎输出infoCode
114
+ }
115
+ _last_request = None
116
+ _last_exception = None
117
+ _now = time.time()
118
+ _retry_times = 0
119
+ while TeaCore.allow_retry(_runtime.get('retry'), _retry_times, _now):
120
+ if _retry_times > 0:
121
+ _backoff_time = TeaCore.get_backoff_time(_runtime.get('backoff'), _retry_times)
122
+ if _backoff_time > 0:
123
+ TeaCore.sleep(_backoff_time)
124
+ _retry_times = _retry_times + 1
125
+ try:
126
+ _request = TeaRequest()
127
+ _request.protocol = UtilClient.default_string(self._protocol, protocol)
128
+ _request.method = method
129
+ _request.pathname = pathname
130
+ _request.query = {
131
+ 'method': action,
132
+ 'version': version,
133
+ 'sign_type': 'HmacSHA1',
134
+ 'req_time': AntchainUtils.get_timestamp(),
135
+ 'req_msg_id': AntchainUtils.get_nonce(),
136
+ 'access_key': self._access_key_id,
137
+ 'base_sdk_version': 'TeaSDK-2.0',
138
+ 'sdk_version': '1.0.1',
139
+ '_prod_code': 'AGENTCREW',
140
+ '_prod_channel': 'undefined'
141
+ }
142
+ if not UtilClient.empty(self._security_token):
143
+ _request.query['security_token'] = self._security_token
144
+ _request.headers = TeaCore.merge({
145
+ 'host': UtilClient.default_string(self._endpoint, 'openapi.antchain.antgroup.com'),
146
+ 'user-agent': UtilClient.get_user_agent(self._user_agent)
147
+ }, headers)
148
+ tmp = UtilClient.anyify_map_value(RPCUtilClient.query(request))
149
+ _request.body = UtilClient.to_form_string(tmp)
150
+ _request.headers['content-type'] = 'application/x-www-form-urlencoded'
151
+ signed_param = TeaCore.merge(_request.query,
152
+ RPCUtilClient.query(request))
153
+ _request.query['sign'] = AntchainUtils.get_signature(signed_param, self._access_key_secret)
154
+ _last_request = _request
155
+ _response = TeaCore.do_action(_request, _runtime)
156
+ raw = UtilClient.read_as_string(_response.body)
157
+ obj = UtilClient.parse_json(raw)
158
+ res = UtilClient.assert_as_map(obj)
159
+ resp = UtilClient.assert_as_map(res.get('response'))
160
+ if AntchainUtils.has_error(raw, self._access_key_secret):
161
+ raise TeaException({
162
+ 'message': resp.get('result_msg'),
163
+ 'data': resp,
164
+ 'code': resp.get('result_code')
165
+ })
166
+ return resp
167
+ except Exception as e:
168
+ if TeaCore.is_retryable(e):
169
+ _last_exception = e
170
+ continue
171
+ raise e
172
+ raise UnretryableException(_last_request, _last_exception)
173
+
174
+ async def do_request_async(
175
+ self,
176
+ version: str,
177
+ action: str,
178
+ protocol: str,
179
+ method: str,
180
+ pathname: str,
181
+ request: dict,
182
+ headers: Dict[str, str],
183
+ runtime: util_models.RuntimeOptions,
184
+ ) -> dict:
185
+ """
186
+ Encapsulate the request and invoke the network
187
+ @param action: api name
188
+ @param protocol: http or https
189
+ @param method: e.g. GET
190
+ @param pathname: pathname of every api
191
+ @param request: which contains request params
192
+ @param runtime: which controls some details of call api, such as retry times
193
+ @return: the response
194
+ """
195
+ runtime.validate()
196
+ _runtime = {
197
+ 'timeouted': 'retry',
198
+ 'readTimeout': UtilClient.default_number(runtime.read_timeout, self._read_timeout),
199
+ 'connectTimeout': UtilClient.default_number(runtime.connect_timeout, self._connect_timeout),
200
+ 'httpProxy': UtilClient.default_string(runtime.http_proxy, self._http_proxy),
201
+ 'httpsProxy': UtilClient.default_string(runtime.https_proxy, self._https_proxy),
202
+ 'noProxy': UtilClient.default_string(runtime.no_proxy, self._no_proxy),
203
+ 'maxIdleConns': UtilClient.default_number(runtime.max_idle_conns, self._max_idle_conns),
204
+ 'maxIdleTimeMillis': self._max_idle_time_millis,
205
+ 'keepAliveDuration': self._keep_alive_duration_millis,
206
+ 'maxRequests': self._max_requests,
207
+ 'maxRequestsPerHost': self._max_requests_per_host,
208
+ 'retry': {
209
+ 'retryable': runtime.autoretry,
210
+ 'maxAttempts': UtilClient.default_number(runtime.max_attempts, 3)
211
+ },
212
+ 'backoff': {
213
+ 'policy': UtilClient.default_string(runtime.backoff_policy, 'no'),
214
+ 'period': UtilClient.default_number(runtime.backoff_period, 1)
215
+ },
216
+ 'ignoreSSL': runtime.ignore_ssl,
217
+ # air引擎输出infoCode
218
+ }
219
+ _last_request = None
220
+ _last_exception = None
221
+ _now = time.time()
222
+ _retry_times = 0
223
+ while TeaCore.allow_retry(_runtime.get('retry'), _retry_times, _now):
224
+ if _retry_times > 0:
225
+ _backoff_time = TeaCore.get_backoff_time(_runtime.get('backoff'), _retry_times)
226
+ if _backoff_time > 0:
227
+ TeaCore.sleep(_backoff_time)
228
+ _retry_times = _retry_times + 1
229
+ try:
230
+ _request = TeaRequest()
231
+ _request.protocol = UtilClient.default_string(self._protocol, protocol)
232
+ _request.method = method
233
+ _request.pathname = pathname
234
+ _request.query = {
235
+ 'method': action,
236
+ 'version': version,
237
+ 'sign_type': 'HmacSHA1',
238
+ 'req_time': AntchainUtils.get_timestamp(),
239
+ 'req_msg_id': AntchainUtils.get_nonce(),
240
+ 'access_key': self._access_key_id,
241
+ 'base_sdk_version': 'TeaSDK-2.0',
242
+ 'sdk_version': '1.0.1',
243
+ '_prod_code': 'AGENTCREW',
244
+ '_prod_channel': 'undefined'
245
+ }
246
+ if not UtilClient.empty(self._security_token):
247
+ _request.query['security_token'] = self._security_token
248
+ _request.headers = TeaCore.merge({
249
+ 'host': UtilClient.default_string(self._endpoint, 'openapi.antchain.antgroup.com'),
250
+ 'user-agent': UtilClient.get_user_agent(self._user_agent)
251
+ }, headers)
252
+ tmp = UtilClient.anyify_map_value(RPCUtilClient.query(request))
253
+ _request.body = UtilClient.to_form_string(tmp)
254
+ _request.headers['content-type'] = 'application/x-www-form-urlencoded'
255
+ signed_param = TeaCore.merge(_request.query,
256
+ RPCUtilClient.query(request))
257
+ _request.query['sign'] = AntchainUtils.get_signature(signed_param, self._access_key_secret)
258
+ _last_request = _request
259
+ _response = await TeaCore.async_do_action(_request, _runtime)
260
+ raw = await UtilClient.read_as_string_async(_response.body)
261
+ obj = UtilClient.parse_json(raw)
262
+ res = UtilClient.assert_as_map(obj)
263
+ resp = UtilClient.assert_as_map(res.get('response'))
264
+ if AntchainUtils.has_error(raw, self._access_key_secret):
265
+ raise TeaException({
266
+ 'message': resp.get('result_msg'),
267
+ 'data': resp,
268
+ 'code': resp.get('result_code')
269
+ })
270
+ return resp
271
+ except Exception as e:
272
+ if TeaCore.is_retryable(e):
273
+ _last_exception = e
274
+ continue
275
+ raise e
276
+ raise UnretryableException(_last_request, _last_exception)
277
+
278
+ def exec_riskplus_flow_run(
279
+ self,
280
+ request: agentcrew_models.ExecRiskplusFlowRunRequest,
281
+ ) -> agentcrew_models.ExecRiskplusFlowRunResponse:
282
+ """
283
+ Description: 发起 agent flow 的执行
284
+ Summary: 发起 agent flow 的执行
285
+ """
286
+ runtime = util_models.RuntimeOptions()
287
+ headers = {}
288
+ return self.exec_riskplus_flow_run_ex(request, headers, runtime)
289
+
290
+ async def exec_riskplus_flow_run_async(
291
+ self,
292
+ request: agentcrew_models.ExecRiskplusFlowRunRequest,
293
+ ) -> agentcrew_models.ExecRiskplusFlowRunResponse:
294
+ """
295
+ Description: 发起 agent flow 的执行
296
+ Summary: 发起 agent flow 的执行
297
+ """
298
+ runtime = util_models.RuntimeOptions()
299
+ headers = {}
300
+ return await self.exec_riskplus_flow_run_ex_async(request, headers, runtime)
301
+
302
+ def exec_riskplus_flow_run_ex(
303
+ self,
304
+ request: agentcrew_models.ExecRiskplusFlowRunRequest,
305
+ headers: Dict[str, str],
306
+ runtime: util_models.RuntimeOptions,
307
+ ) -> agentcrew_models.ExecRiskplusFlowRunResponse:
308
+ """
309
+ Description: 发起 agent flow 的执行
310
+ Summary: 发起 agent flow 的执行
311
+ """
312
+ UtilClient.validate_model(request)
313
+ return TeaCore.from_map(
314
+ agentcrew_models.ExecRiskplusFlowRunResponse(),
315
+ self.do_request('1.0', 'riskplus.flow.run.exec', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
316
+ )
317
+
318
+ async def exec_riskplus_flow_run_ex_async(
319
+ self,
320
+ request: agentcrew_models.ExecRiskplusFlowRunRequest,
321
+ headers: Dict[str, str],
322
+ runtime: util_models.RuntimeOptions,
323
+ ) -> agentcrew_models.ExecRiskplusFlowRunResponse:
324
+ """
325
+ Description: 发起 agent flow 的执行
326
+ Summary: 发起 agent flow 的执行
327
+ """
328
+ UtilClient.validate_model(request)
329
+ return TeaCore.from_map(
330
+ agentcrew_models.ExecRiskplusFlowRunResponse(),
331
+ await self.do_request_async('1.0', 'riskplus.flow.run.exec', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
332
+ )
333
+
334
+ def query_riskplus_flow_run(
335
+ self,
336
+ request: agentcrew_models.QueryRiskplusFlowRunRequest,
337
+ ) -> agentcrew_models.QueryRiskplusFlowRunResponse:
338
+ """
339
+ Description: 查询任务执行状态或者结果
340
+ Summary: 查询任务执行状态或者结果
341
+ """
342
+ runtime = util_models.RuntimeOptions()
343
+ headers = {}
344
+ return self.query_riskplus_flow_run_ex(request, headers, runtime)
345
+
346
+ async def query_riskplus_flow_run_async(
347
+ self,
348
+ request: agentcrew_models.QueryRiskplusFlowRunRequest,
349
+ ) -> agentcrew_models.QueryRiskplusFlowRunResponse:
350
+ """
351
+ Description: 查询任务执行状态或者结果
352
+ Summary: 查询任务执行状态或者结果
353
+ """
354
+ runtime = util_models.RuntimeOptions()
355
+ headers = {}
356
+ return await self.query_riskplus_flow_run_ex_async(request, headers, runtime)
357
+
358
+ def query_riskplus_flow_run_ex(
359
+ self,
360
+ request: agentcrew_models.QueryRiskplusFlowRunRequest,
361
+ headers: Dict[str, str],
362
+ runtime: util_models.RuntimeOptions,
363
+ ) -> agentcrew_models.QueryRiskplusFlowRunResponse:
364
+ """
365
+ Description: 查询任务执行状态或者结果
366
+ Summary: 查询任务执行状态或者结果
367
+ """
368
+ UtilClient.validate_model(request)
369
+ return TeaCore.from_map(
370
+ agentcrew_models.QueryRiskplusFlowRunResponse(),
371
+ self.do_request('1.0', 'riskplus.flow.run.query', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
372
+ )
373
+
374
+ async def query_riskplus_flow_run_ex_async(
375
+ self,
376
+ request: agentcrew_models.QueryRiskplusFlowRunRequest,
377
+ headers: Dict[str, str],
378
+ runtime: util_models.RuntimeOptions,
379
+ ) -> agentcrew_models.QueryRiskplusFlowRunResponse:
380
+ """
381
+ Description: 查询任务执行状态或者结果
382
+ Summary: 查询任务执行状态或者结果
383
+ """
384
+ UtilClient.validate_model(request)
385
+ return TeaCore.from_map(
386
+ agentcrew_models.QueryRiskplusFlowRunResponse(),
387
+ await self.do_request_async('1.0', 'riskplus.flow.run.query', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime)
388
+ )