asteroid-odyssey 0.1.21__py3-none-any.whl → 1.0.0__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.
- asteroid_odyssey/__init__.py +20 -34
- asteroid_odyssey/client.py +387 -337
- asteroid_odyssey/openapi_client/__init__.py +73 -0
- asteroid_odyssey/openapi_client/api/__init__.py +7 -0
- asteroid_odyssey/openapi_client/api/api_api.py +516 -0
- asteroid_odyssey/openapi_client/api/execution_api.py +335 -0
- asteroid_odyssey/openapi_client/api/sdk_api.py +1434 -0
- asteroid_odyssey/openapi_client/api_client.py +801 -0
- asteroid_odyssey/openapi_client/api_response.py +21 -0
- asteroid_odyssey/openapi_client/configuration.py +606 -0
- asteroid_odyssey/openapi_client/exceptions.py +216 -0
- asteroid_odyssey/openapi_client/models/__init__.py +27 -0
- asteroid_odyssey/openapi_client/models/browser_session_recording_response.py +87 -0
- asteroid_odyssey/openapi_client/models/error_response.py +87 -0
- asteroid_odyssey/openapi_client/models/execution_response.py +87 -0
- asteroid_odyssey/openapi_client/models/execution_result.py +101 -0
- asteroid_odyssey/openapi_client/models/execution_result_response.py +100 -0
- asteroid_odyssey/openapi_client/models/execution_status_response.py +95 -0
- asteroid_odyssey/openapi_client/models/health_check200_response.py +87 -0
- asteroid_odyssey/openapi_client/models/health_check500_response.py +87 -0
- asteroid_odyssey/openapi_client/models/status.py +43 -0
- asteroid_odyssey/openapi_client/models/structured_agent_execution_request.py +89 -0
- asteroid_odyssey/openapi_client/models/upload_execution_files200_response.py +89 -0
- asteroid_odyssey/openapi_client/rest.py +258 -0
- asteroid_odyssey-1.0.0.dist-info/METADATA +208 -0
- asteroid_odyssey-1.0.0.dist-info/RECORD +29 -0
- {asteroid_odyssey-0.1.21.dist-info → asteroid_odyssey-1.0.0.dist-info}/WHEEL +1 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/__init__.py +0 -8
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/__init__.py +0 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/agent/get_agents.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/api/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/api/get_open_api.py +0 -79
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/api/health_check.py +0 -131
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/credentials/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/credentials/get_credentials_public_key.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/delete_execution.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_browser_session.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution_files.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_execution_progress.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/get_executions_for_workflow.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/execution/update_execution_status.py +0 -115
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/notifications/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/notifications/set_slack_channel.py +0 -107
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/optimiser/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/optimiser/queue_optimisation_job.py +0 -103
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/__init__.py +0 -0
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/add_workflow_credential.py +0 -111
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/create_workflow.py +0 -174
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/delete_workflow.py +0 -156
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/delete_workflow_credentials.py +0 -96
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/execute_workflow.py +0 -179
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_agent_workflow_executions.py +0 -155
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow_credentials.py +0 -154
- asteroid_odyssey/api/generated/asteroid_agents_api_client/api/workflow/get_workflow_versions.py +0 -159
- asteroid_odyssey/api/generated/asteroid_agents_api_client/client.py +0 -268
- asteroid_odyssey/api/generated/asteroid_agents_api_client/errors.py +0 -16
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/__init__.py +0 -61
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/agent.py +0 -90
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/browser_session.py +0 -136
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request.py +0 -126
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request_fields.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/create_workflow_request_provider.py +0 -9
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credential.py +0 -66
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credentials_request.py +0 -72
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/credentials_response.py +0 -80
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_execution_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_execution_response_404.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_workflow_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/delete_workflow_response_404.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution.py +0 -147
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_dynamic_data.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_result.py +0 -43
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/execution_status.py +0 -89
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/file.py +0 -127
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/health_check_response_200.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/health_check_response_500.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/optimisation_request.py +0 -59
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/progress_update.py +0 -77
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/result_schema.py +0 -51
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/slack_channel_request.py +0 -58
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/status.py +0 -13
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow.py +0 -152
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_execution.py +0 -82
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_execution_request.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/models/workflow_fields.py +0 -48
- asteroid_odyssey/api/generated/asteroid_agents_api_client/py.typed +0 -1
- asteroid_odyssey/api/generated/asteroid_agents_api_client/types.py +0 -45
- asteroid_odyssey/exceptions.py +0 -15
- asteroid_odyssey-0.1.21.dist-info/METADATA +0 -31
- asteroid_odyssey-0.1.21.dist-info/RECORD +0 -72
- asteroid_odyssey-0.1.21.dist-info/entry_points.txt +0 -2
- /asteroid_odyssey/{api/generated/asteroid_agents_api_client/api/agent/__init__.py → openapi_client/py.typed} +0 -0
- {asteroid_odyssey-0.1.21.dist-info → asteroid_odyssey-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Asteroid Agents API
|
|
5
|
+
|
|
6
|
+
Version 1 of the Asteroid Agents API
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
import ssl
|
|
19
|
+
|
|
20
|
+
import urllib3
|
|
21
|
+
|
|
22
|
+
from openapi_client.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
|
25
|
+
RESTResponseType = urllib3.HTTPResponse
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_socks_proxy_url(url):
|
|
29
|
+
if url is None:
|
|
30
|
+
return False
|
|
31
|
+
split_section = url.split("://")
|
|
32
|
+
if len(split_section) < 2:
|
|
33
|
+
return False
|
|
34
|
+
else:
|
|
35
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class RESTResponse(io.IOBase):
|
|
39
|
+
|
|
40
|
+
def __init__(self, resp) -> None:
|
|
41
|
+
self.response = resp
|
|
42
|
+
self.status = resp.status
|
|
43
|
+
self.reason = resp.reason
|
|
44
|
+
self.data = None
|
|
45
|
+
|
|
46
|
+
def read(self):
|
|
47
|
+
if self.data is None:
|
|
48
|
+
self.data = self.response.data
|
|
49
|
+
return self.data
|
|
50
|
+
|
|
51
|
+
def getheaders(self):
|
|
52
|
+
"""Returns a dictionary of the response headers."""
|
|
53
|
+
return self.response.headers
|
|
54
|
+
|
|
55
|
+
def getheader(self, name, default=None):
|
|
56
|
+
"""Returns a given response header."""
|
|
57
|
+
return self.response.headers.get(name, default)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RESTClientObject:
|
|
61
|
+
|
|
62
|
+
def __init__(self, configuration) -> None:
|
|
63
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
65
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
66
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
67
|
+
|
|
68
|
+
# cert_reqs
|
|
69
|
+
if configuration.verify_ssl:
|
|
70
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
71
|
+
else:
|
|
72
|
+
cert_reqs = ssl.CERT_NONE
|
|
73
|
+
|
|
74
|
+
pool_args = {
|
|
75
|
+
"cert_reqs": cert_reqs,
|
|
76
|
+
"ca_certs": configuration.ssl_ca_cert,
|
|
77
|
+
"cert_file": configuration.cert_file,
|
|
78
|
+
"key_file": configuration.key_file,
|
|
79
|
+
"ca_cert_data": configuration.ca_cert_data,
|
|
80
|
+
}
|
|
81
|
+
if configuration.assert_hostname is not None:
|
|
82
|
+
pool_args['assert_hostname'] = (
|
|
83
|
+
configuration.assert_hostname
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
if configuration.retries is not None:
|
|
87
|
+
pool_args['retries'] = configuration.retries
|
|
88
|
+
|
|
89
|
+
if configuration.tls_server_name:
|
|
90
|
+
pool_args['server_hostname'] = configuration.tls_server_name
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if configuration.socket_options is not None:
|
|
94
|
+
pool_args['socket_options'] = configuration.socket_options
|
|
95
|
+
|
|
96
|
+
if configuration.connection_pool_maxsize is not None:
|
|
97
|
+
pool_args['maxsize'] = configuration.connection_pool_maxsize
|
|
98
|
+
|
|
99
|
+
# https pool manager
|
|
100
|
+
self.pool_manager: urllib3.PoolManager
|
|
101
|
+
|
|
102
|
+
if configuration.proxy:
|
|
103
|
+
if is_socks_proxy_url(configuration.proxy):
|
|
104
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
|
105
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
106
|
+
pool_args["headers"] = configuration.proxy_headers
|
|
107
|
+
self.pool_manager = SOCKSProxyManager(**pool_args)
|
|
108
|
+
else:
|
|
109
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
110
|
+
pool_args["proxy_headers"] = configuration.proxy_headers
|
|
111
|
+
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
|
112
|
+
else:
|
|
113
|
+
self.pool_manager = urllib3.PoolManager(**pool_args)
|
|
114
|
+
|
|
115
|
+
def request(
|
|
116
|
+
self,
|
|
117
|
+
method,
|
|
118
|
+
url,
|
|
119
|
+
headers=None,
|
|
120
|
+
body=None,
|
|
121
|
+
post_params=None,
|
|
122
|
+
_request_timeout=None
|
|
123
|
+
):
|
|
124
|
+
"""Perform requests.
|
|
125
|
+
|
|
126
|
+
:param method: http request method
|
|
127
|
+
:param url: http request url
|
|
128
|
+
:param headers: http request headers
|
|
129
|
+
:param body: request json body, for `application/json`
|
|
130
|
+
:param post_params: request post parameters,
|
|
131
|
+
`application/x-www-form-urlencoded`
|
|
132
|
+
and `multipart/form-data`
|
|
133
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
134
|
+
number provided, it will be total request
|
|
135
|
+
timeout. It can also be a pair (tuple) of
|
|
136
|
+
(connection, read) timeouts.
|
|
137
|
+
"""
|
|
138
|
+
method = method.upper()
|
|
139
|
+
assert method in [
|
|
140
|
+
'GET',
|
|
141
|
+
'HEAD',
|
|
142
|
+
'DELETE',
|
|
143
|
+
'POST',
|
|
144
|
+
'PUT',
|
|
145
|
+
'PATCH',
|
|
146
|
+
'OPTIONS'
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
if post_params and body:
|
|
150
|
+
raise ApiValueError(
|
|
151
|
+
"body parameter cannot be used with post_params parameter."
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
post_params = post_params or {}
|
|
155
|
+
headers = headers or {}
|
|
156
|
+
|
|
157
|
+
timeout = None
|
|
158
|
+
if _request_timeout:
|
|
159
|
+
if isinstance(_request_timeout, (int, float)):
|
|
160
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
161
|
+
elif (
|
|
162
|
+
isinstance(_request_timeout, tuple)
|
|
163
|
+
and len(_request_timeout) == 2
|
|
164
|
+
):
|
|
165
|
+
timeout = urllib3.Timeout(
|
|
166
|
+
connect=_request_timeout[0],
|
|
167
|
+
read=_request_timeout[1]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
try:
|
|
171
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
172
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
|
173
|
+
|
|
174
|
+
# no content type provided or payload is json
|
|
175
|
+
content_type = headers.get('Content-Type')
|
|
176
|
+
if (
|
|
177
|
+
not content_type
|
|
178
|
+
or re.search('json', content_type, re.IGNORECASE)
|
|
179
|
+
):
|
|
180
|
+
request_body = None
|
|
181
|
+
if body is not None:
|
|
182
|
+
request_body = json.dumps(body)
|
|
183
|
+
r = self.pool_manager.request(
|
|
184
|
+
method,
|
|
185
|
+
url,
|
|
186
|
+
body=request_body,
|
|
187
|
+
timeout=timeout,
|
|
188
|
+
headers=headers,
|
|
189
|
+
preload_content=False
|
|
190
|
+
)
|
|
191
|
+
elif content_type == 'application/x-www-form-urlencoded':
|
|
192
|
+
r = self.pool_manager.request(
|
|
193
|
+
method,
|
|
194
|
+
url,
|
|
195
|
+
fields=post_params,
|
|
196
|
+
encode_multipart=False,
|
|
197
|
+
timeout=timeout,
|
|
198
|
+
headers=headers,
|
|
199
|
+
preload_content=False
|
|
200
|
+
)
|
|
201
|
+
elif content_type == 'multipart/form-data':
|
|
202
|
+
# must del headers['Content-Type'], or the correct
|
|
203
|
+
# Content-Type which generated by urllib3 will be
|
|
204
|
+
# overwritten.
|
|
205
|
+
del headers['Content-Type']
|
|
206
|
+
# Ensures that dict objects are serialized
|
|
207
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
|
208
|
+
r = self.pool_manager.request(
|
|
209
|
+
method,
|
|
210
|
+
url,
|
|
211
|
+
fields=post_params,
|
|
212
|
+
encode_multipart=True,
|
|
213
|
+
timeout=timeout,
|
|
214
|
+
headers=headers,
|
|
215
|
+
preload_content=False
|
|
216
|
+
)
|
|
217
|
+
# Pass a `string` parameter directly in the body to support
|
|
218
|
+
# other content types than JSON when `body` argument is
|
|
219
|
+
# provided in serialized form.
|
|
220
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
221
|
+
r = self.pool_manager.request(
|
|
222
|
+
method,
|
|
223
|
+
url,
|
|
224
|
+
body=body,
|
|
225
|
+
timeout=timeout,
|
|
226
|
+
headers=headers,
|
|
227
|
+
preload_content=False
|
|
228
|
+
)
|
|
229
|
+
elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
|
|
230
|
+
request_body = "true" if body else "false"
|
|
231
|
+
r = self.pool_manager.request(
|
|
232
|
+
method,
|
|
233
|
+
url,
|
|
234
|
+
body=request_body,
|
|
235
|
+
preload_content=False,
|
|
236
|
+
timeout=timeout,
|
|
237
|
+
headers=headers)
|
|
238
|
+
else:
|
|
239
|
+
# Cannot generate the request from given parameters
|
|
240
|
+
msg = """Cannot prepare a request message for provided
|
|
241
|
+
arguments. Please check that your arguments match
|
|
242
|
+
declared content type."""
|
|
243
|
+
raise ApiException(status=0, reason=msg)
|
|
244
|
+
# For `GET`, `HEAD`
|
|
245
|
+
else:
|
|
246
|
+
r = self.pool_manager.request(
|
|
247
|
+
method,
|
|
248
|
+
url,
|
|
249
|
+
fields={},
|
|
250
|
+
timeout=timeout,
|
|
251
|
+
headers=headers,
|
|
252
|
+
preload_content=False
|
|
253
|
+
)
|
|
254
|
+
except urllib3.exceptions.SSLError as e:
|
|
255
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
256
|
+
raise ApiException(status=0, reason=msg)
|
|
257
|
+
|
|
258
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asteroid-odyssey
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A Python SDK for browser automation using Asteroid platform.
|
|
5
|
+
Author-email: David Mlcoch <founders@asteroid.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/asteroid/asteroid-odyssey-py
|
|
8
|
+
Project-URL: Homepage, https://asteroid.ai
|
|
9
|
+
Project-URL: Documentation, https://docs.asteroid.ai
|
|
10
|
+
Keywords: OpenAPI,OpenAPI-Generator,Asteroid Agents API,browser automation,AI agents
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Browsers
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
20
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
21
|
+
Requires-Dist: pydantic>=2
|
|
22
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
23
|
+
Requires-Dist: requests>=2.28.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.2.1; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=2.8.1; extra == "dev"
|
|
27
|
+
Requires-Dist: tox>=3.9.0; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: types-python-dateutil>=2.8.19.14; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.5; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
32
|
+
|
|
33
|
+
# Asteroid Odyssey
|
|
34
|
+
|
|
35
|
+
The official Python SDK for interacting with the Asteroid Agents API.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install asteroid-odyssey
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Please head to our documentation at https://docs.asteroid.ai/sdk/python
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
The Asteroid Odyssey SDK is available under the MIT License.
|
|
50
|
+
|
|
51
|
+
### Tests
|
|
52
|
+
|
|
53
|
+
Execute `pytest` to run the tests.
|
|
54
|
+
|
|
55
|
+
## Getting Started
|
|
56
|
+
|
|
57
|
+
The SDK provides a high-level `AsteroidClient` class that makes it easy to interact with the Asteroid Agents API:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
from asteroid_odyssey import AsteroidClient
|
|
61
|
+
|
|
62
|
+
# Create a client with your API key
|
|
63
|
+
client = AsteroidClient('your-api-key')
|
|
64
|
+
|
|
65
|
+
# Execute an agent
|
|
66
|
+
execution_id = client.execute_agent('my-agent-id', {'input': 'some dynamic value'})
|
|
67
|
+
|
|
68
|
+
# Wait for the execution to complete and get the result
|
|
69
|
+
result = client.wait_for_execution_result(execution_id)
|
|
70
|
+
print(result)
|
|
71
|
+
|
|
72
|
+
# Or check status manually
|
|
73
|
+
status = client.get_execution_status(execution_id)
|
|
74
|
+
print(f"Status: {status.status}")
|
|
75
|
+
|
|
76
|
+
# Upload files to an execution
|
|
77
|
+
hello_content = "Hello World!".encode()
|
|
78
|
+
response = client.upload_execution_files(execution_id, [hello_content])
|
|
79
|
+
print(f"Uploaded files: {response.file_ids}")
|
|
80
|
+
|
|
81
|
+
# Get browser session recording (for completed executions)
|
|
82
|
+
recording_url = client.get_browser_session_recording(execution_id)
|
|
83
|
+
print(f"Recording available at: {recording_url}")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Context Manager Usage
|
|
87
|
+
|
|
88
|
+
The client can also be used as a context manager:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from asteroid_odyssey import AsteroidClient
|
|
92
|
+
|
|
93
|
+
with AsteroidClient('your-api-key') as client:
|
|
94
|
+
execution_id = client.execute_agent('my-agent-id', {'input': 'test'})
|
|
95
|
+
result = client.wait_for_execution_result(execution_id)
|
|
96
|
+
print(result)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Convenience Functions
|
|
100
|
+
|
|
101
|
+
The SDK also provides convenience functions:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from asteroid_odyssey import create_client, execute_agent, wait_for_execution_result
|
|
105
|
+
|
|
106
|
+
client = create_client('your-api-key')
|
|
107
|
+
execution_id = execute_agent(client, 'my-agent-id', {'input': 'test'})
|
|
108
|
+
result = wait_for_execution_result(client, execution_id)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
### AsteroidClient
|
|
114
|
+
|
|
115
|
+
The main client class provides the following methods:
|
|
116
|
+
|
|
117
|
+
- `execute_agent(agent_id, agent_profile_id, execution_data)` - Execute an agent and return execution ID
|
|
118
|
+
- `get_execution_status(execution_id)` - Get current execution status
|
|
119
|
+
- `get_execution_result(execution_id)` - Get final execution result
|
|
120
|
+
- `wait_for_execution_result(execution_id, interval=1.0, timeout=3600.0)` - Wait for completion
|
|
121
|
+
- `upload_execution_files(execution_id, files, default_filename="file.txt")` - Upload files
|
|
122
|
+
- `get_browser_session_recording(execution_id)` - Get browser recording URL
|
|
123
|
+
|
|
124
|
+
### Low-Level API Access
|
|
125
|
+
|
|
126
|
+
If you need direct access to the generated OpenAPI client, you can still use it:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import openapi_client
|
|
130
|
+
from openapi_client.rest import ApiException
|
|
131
|
+
from pprint import pprint
|
|
132
|
+
|
|
133
|
+
# Defining the host is optional and defaults to https://odyssey.asteroid.ai/api/v1
|
|
134
|
+
configuration = openapi_client.Configuration(
|
|
135
|
+
host = "https://odyssey.asteroid.ai/api/v1"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# Enter a context with an instance of the API client
|
|
139
|
+
with openapi_client.ApiClient(configuration) as api_client:
|
|
140
|
+
# Create an instance of the API class
|
|
141
|
+
api_instance = openapi_client.APIApi(api_client)
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
# Get the OpenAPI schema
|
|
145
|
+
api_instance.get_open_api()
|
|
146
|
+
except ApiException as e:
|
|
147
|
+
print("Exception when calling APIApi->get_open_api: %s\n" % e)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Documentation for API Endpoints
|
|
151
|
+
|
|
152
|
+
All URIs are relative to *https://odyssey.asteroid.ai/api/v1*
|
|
153
|
+
|
|
154
|
+
Class | Method | HTTP request | Description
|
|
155
|
+
------------ | ------------- | ------------- | -------------
|
|
156
|
+
*APIApi* | [**get_open_api**](docs/APIApi.md#get_open_api) | **GET** /openapi.yaml | Get the OpenAPI schema
|
|
157
|
+
*APIApi* | [**health_check**](docs/APIApi.md#health_check) | **GET** /health | Check the health of the API
|
|
158
|
+
*ExecutionApi* | [**upload_execution_files**](docs/ExecutionApi.md#upload_execution_files) | **POST** /execution/{id}/files | Upload files to an execution
|
|
159
|
+
*SDKApi* | [**execute_agent**](docs/SDKApi.md#execute_structured_agent) | **POST** /agent/{id} | Execute an agent
|
|
160
|
+
*SDKApi* | [**get_browser_session_recording**](docs/SDKApi.md#get_browser_session_recording) | **GET** /execution/{id}/browser_session/recording | Get browser session recording
|
|
161
|
+
*SDKApi* | [**get_execution_result**](docs/SDKApi.md#get_execution_result) | **GET** /execution/{id}/result | Get execution result
|
|
162
|
+
*SDKApi* | [**get_execution_status**](docs/SDKApi.md#get_execution_status) | **GET** /execution/{id}/status | Get execution status
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
## Documentation For Models
|
|
166
|
+
|
|
167
|
+
- [BrowserSessionRecordingResponse](docs/BrowserSessionRecordingResponse.md)
|
|
168
|
+
- [ErrorResponse](docs/ErrorResponse.md)
|
|
169
|
+
- [ExecutionResponse](docs/ExecutionResponse.md)
|
|
170
|
+
- [ExecutionResult](docs/ExecutionResult.md)
|
|
171
|
+
- [ExecutionResultResponse](docs/ExecutionResultResponse.md)
|
|
172
|
+
- [ExecutionStatusResponse](docs/ExecutionStatusResponse.md)
|
|
173
|
+
- [HealthCheck200Response](docs/HealthCheck200Response.md)
|
|
174
|
+
- [HealthCheck500Response](docs/HealthCheck500Response.md)
|
|
175
|
+
- [Status](docs/Status.md)
|
|
176
|
+
- [UploadExecutionFiles200Response](docs/UploadExecutionFiles200Response.md)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<a id="documentation-for-authorization"></a>
|
|
180
|
+
## Documentation For Authorization
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
Authentication schemes defined for the API:
|
|
184
|
+
<a id="ApiKeyAuth"></a>
|
|
185
|
+
### ApiKeyAuth
|
|
186
|
+
|
|
187
|
+
- **Type**: API key
|
|
188
|
+
- **API key parameter name**: X-Asteroid-Agents-Api-Key
|
|
189
|
+
- **Location**: HTTP header
|
|
190
|
+
|
|
191
|
+
## Regenerating the SDK
|
|
192
|
+
|
|
193
|
+
To update the SDK, regenerate the code by running
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npx @openapitools/openapi-generator-cli generate \
|
|
197
|
+
-i https://odyssey.asteroid.ai/api/v1/openapi.yaml \
|
|
198
|
+
-g python \
|
|
199
|
+
-o .
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
After generation, ensure `pyproject.toml` is configured correctly and that files are modified correctly. Check for new files and if they are needed.
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
asteroid_odyssey/__init__.py,sha256=A05KbHfr1FWd2-j1LGJMXYmBVXpYMjr9qP0x_E5NbLk,461
|
|
2
|
+
asteroid_odyssey/client.py,sha256=N-FNpY8RlJmz5BSRndcJeylBBVGO3eN0nTrMmLyws5Y,15492
|
|
3
|
+
asteroid_odyssey/openapi_client/__init__.py,sha256=lxTbQnKCVUHmsFg93FVLCVcCmAgpdthUvTAyDlFKrWk,2949
|
|
4
|
+
asteroid_odyssey/openapi_client/api_client.py,sha256=j8J2-n-ezwiE63J968ROX3rAEvxG9E3QG6inl_vHrc4,27651
|
|
5
|
+
asteroid_odyssey/openapi_client/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
|
|
6
|
+
asteroid_odyssey/openapi_client/configuration.py,sha256=9Mkmh9vPdV-_oFkm8spWzLjfcJ26-s4-m_cEVqgP-SY,19028
|
|
7
|
+
asteroid_odyssey/openapi_client/exceptions.py,sha256=xauMukb96TkgN7Rx5c_d_XWOJb7ldCY5SuTmybyKTr8,6414
|
|
8
|
+
asteroid_odyssey/openapi_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
asteroid_odyssey/openapi_client/rest.py,sha256=F1h0XprTS5M6OXTFi3jLUTmXvgSxpP0CgRLT3_SKc4o,9411
|
|
10
|
+
asteroid_odyssey/openapi_client/api/__init__.py,sha256=uKn6SJ-FgH_Q7lqwKUqayFQw3tjI7_qmP59oddM80e0,198
|
|
11
|
+
asteroid_odyssey/openapi_client/api/api_api.py,sha256=aj4VH6iGhXuti3nJ4J4pdvXECIY41VsRjwW__wfGhdE,19153
|
|
12
|
+
asteroid_odyssey/openapi_client/api/execution_api.py,sha256=bRbWKM_7XCRkdTLwqVPag8sl-oSrmHtLCiil8TuJRDY,12892
|
|
13
|
+
asteroid_odyssey/openapi_client/api/sdk_api.py,sha256=2ZCuGXfjTUPfKMobgklnRwG-pqD56k1nJ1P-s0-X0kw,55592
|
|
14
|
+
asteroid_odyssey/openapi_client/models/__init__.py,sha256=DfnM-5BL1qFdQ95TeT0mA_gRx6KtQGRJbYIc7DSoYD4,1195
|
|
15
|
+
asteroid_odyssey/openapi_client/models/browser_session_recording_response.py,sha256=OgYXsMiADk5IIDKkWJTy0RfnnBO3Zbaq9mEUyaxTaH0,2590
|
|
16
|
+
asteroid_odyssey/openapi_client/models/error_response.py,sha256=njnDeKZeMPiteuX4l3MsWTHkG4qEiv8sbIUTv0Z8yQY,2459
|
|
17
|
+
asteroid_odyssey/openapi_client/models/execution_response.py,sha256=c4PJNQDsWlQwumSonH1Sxqcb1q521FhNGgZugoinZNA,2513
|
|
18
|
+
asteroid_odyssey/openapi_client/models/execution_result.py,sha256=o6V8oHt9QR7vfRcCrnHwk8exwALUollWBfShze_lzBM,3354
|
|
19
|
+
asteroid_odyssey/openapi_client/models/execution_result_response.py,sha256=zMRZv9lWpuVZ9Ruzf9lAInqXjV1bzqqfGWvkYOz4Pj4,3571
|
|
20
|
+
asteroid_odyssey/openapi_client/models/execution_status_response.py,sha256=yQBJnrqu3kfKW__UknXGLMG8AAGfkuHuQrh_iNXERIY,3034
|
|
21
|
+
asteroid_odyssey/openapi_client/models/health_check200_response.py,sha256=x_6F6rhTvqpuMUFtD5ynLrUFY4vuVdkWfDRkTx2hVp0,2548
|
|
22
|
+
asteroid_odyssey/openapi_client/models/health_check500_response.py,sha256=b6pG-pqUKkQ5oqmWWyakdr7YYjnTYYeZjoVHkcU-TSY,2533
|
|
23
|
+
asteroid_odyssey/openapi_client/models/status.py,sha256=7IYNk8aTppEzZD5-88No_rLpji6l9N9eIkbwAfmh7IU,885
|
|
24
|
+
asteroid_odyssey/openapi_client/models/structured_agent_execution_request.py,sha256=VZyW85pVz9T27aiG4ZlGywnnxTOaJCAjHSDz8D2YxY8,2913
|
|
25
|
+
asteroid_odyssey/openapi_client/models/upload_execution_files200_response.py,sha256=u85oEP2bEuhszonE78VcrB_keT0UZpv16CTGvfse_v4,2735
|
|
26
|
+
asteroid_odyssey-1.0.0.dist-info/METADATA,sha256=ANKzZvpFbNAwhYfyPVPxbF5-H0Bw0ojcdj66whUojj0,7127
|
|
27
|
+
asteroid_odyssey-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
asteroid_odyssey-1.0.0.dist-info/top_level.txt,sha256=h4T6NKscnThJ4Nhzors2NKlJeZzepnM7XvDgsnfi5HA,17
|
|
29
|
+
asteroid_odyssey-1.0.0.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Contains methods for accessing the API"""
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import AuthenticatedClient, Client
|
|
8
|
-
from ...models.agent import Agent
|
|
9
|
-
from ...types import Response
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def _get_kwargs() -> Dict[str, Any]:
|
|
13
|
-
_kwargs: Dict[str, Any] = {
|
|
14
|
-
"method": "get",
|
|
15
|
-
"url": "/agents",
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return _kwargs
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List["Agent"]]:
|
|
22
|
-
if response.status_code == 200:
|
|
23
|
-
response_200 = []
|
|
24
|
-
_response_200 = response.json()
|
|
25
|
-
for response_200_item_data in _response_200:
|
|
26
|
-
response_200_item = Agent.from_dict(response_200_item_data)
|
|
27
|
-
|
|
28
|
-
response_200.append(response_200_item)
|
|
29
|
-
|
|
30
|
-
return response_200
|
|
31
|
-
if client.raise_on_unexpected_status:
|
|
32
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
33
|
-
else:
|
|
34
|
-
return None
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List["Agent"]]:
|
|
38
|
-
return Response(
|
|
39
|
-
status_code=HTTPStatus(response.status_code),
|
|
40
|
-
content=response.content,
|
|
41
|
-
headers=response.headers,
|
|
42
|
-
parsed=_parse_response(client=client, response=response),
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def sync_detailed(
|
|
47
|
-
*,
|
|
48
|
-
client: Union[AuthenticatedClient, Client],
|
|
49
|
-
) -> Response[List["Agent"]]:
|
|
50
|
-
"""Get all agents
|
|
51
|
-
|
|
52
|
-
Raises:
|
|
53
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
54
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
55
|
-
|
|
56
|
-
Returns:
|
|
57
|
-
Response[List['Agent']]
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
kwargs = _get_kwargs()
|
|
61
|
-
|
|
62
|
-
response = client.get_httpx_client().request(
|
|
63
|
-
**kwargs,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
return _build_response(client=client, response=response)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
def sync(
|
|
70
|
-
*,
|
|
71
|
-
client: Union[AuthenticatedClient, Client],
|
|
72
|
-
) -> Optional[List["Agent"]]:
|
|
73
|
-
"""Get all agents
|
|
74
|
-
|
|
75
|
-
Raises:
|
|
76
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
77
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
78
|
-
|
|
79
|
-
Returns:
|
|
80
|
-
List['Agent']
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
return sync_detailed(
|
|
84
|
-
client=client,
|
|
85
|
-
).parsed
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
async def asyncio_detailed(
|
|
89
|
-
*,
|
|
90
|
-
client: Union[AuthenticatedClient, Client],
|
|
91
|
-
) -> Response[List["Agent"]]:
|
|
92
|
-
"""Get all agents
|
|
93
|
-
|
|
94
|
-
Raises:
|
|
95
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
Response[List['Agent']]
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
kwargs = _get_kwargs()
|
|
103
|
-
|
|
104
|
-
response = await client.get_async_httpx_client().request(**kwargs)
|
|
105
|
-
|
|
106
|
-
return _build_response(client=client, response=response)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
async def asyncio(
|
|
110
|
-
*,
|
|
111
|
-
client: Union[AuthenticatedClient, Client],
|
|
112
|
-
) -> Optional[List["Agent"]]:
|
|
113
|
-
"""Get all agents
|
|
114
|
-
|
|
115
|
-
Raises:
|
|
116
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
117
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
118
|
-
|
|
119
|
-
Returns:
|
|
120
|
-
List['Agent']
|
|
121
|
-
"""
|
|
122
|
-
|
|
123
|
-
return (
|
|
124
|
-
await asyncio_detailed(
|
|
125
|
-
client=client,
|
|
126
|
-
)
|
|
127
|
-
).parsed
|
|
File without changes
|