Skip to content

Commit d29fb68

Browse files
authored
release: 1.0.0.140 (#45)
* release: 1.0.0.140 * refactor: add example
1 parent de692a7 commit d29fb68

24 files changed

+1575
-7
lines changed

sdk/python/agent_sandbox/__init__.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
Annotations,
1414
AnnotationsAudienceItem,
1515
AudioContent,
16+
AvailableTool,
1617
BashCommandStatus,
1718
BlobResourceContents,
1819
BrowserInfoResult,
@@ -47,6 +48,7 @@
4748
HttpValidationError,
4849
Icon,
4950
ImageContent,
51+
JupyterCreateSessionResponse,
5052
JupyterExecuteResponse,
5153
JupyterInfoResponse,
5254
JupyterOutput,
@@ -62,6 +64,7 @@
6264
NodeJsOutput,
6365
NodeJsRuntimeInfo,
6466
PressAction,
67+
Resolution,
6568
Resource,
6669
ResourceLink,
6770
Response,
@@ -78,6 +81,7 @@
7881
ResponseFileSearchResult,
7982
ResponseFileUploadResult,
8083
ResponseFileWriteResult,
84+
ResponseJupyterCreateSessionResponse,
8185
ResponseJupyterExecuteResponse,
8286
ResponseJupyterInfoResponse,
8387
ResponseListStr,
@@ -93,6 +97,8 @@
9397
ResponseStr,
9498
ResponseStrReplaceEditorResult,
9599
RightClickAction,
100+
RuntimeEnv,
101+
SandboxDetail,
96102
SandboxResponse,
97103
ScrollAction,
98104
SessionInfo,
@@ -104,10 +110,13 @@
104110
ShellWaitResult,
105111
ShellWriteResult,
106112
StrReplaceEditorResult,
113+
SystemEnv,
107114
TextContent,
108115
TextResourceContents,
109116
Tool,
110117
ToolAnnotations,
118+
ToolCategory,
119+
ToolSpec,
111120
TypingAction,
112121
ValidationError,
113122
ValidationErrorLocItem,
@@ -161,6 +170,7 @@
161170
"AnnotationsAudienceItem": ".types",
162171
"AsyncSandbox": ".client",
163172
"AudioContent": ".types",
173+
"AvailableTool": ".types",
164174
"BashCommandStatus": ".types",
165175
"BlobResourceContents": ".types",
166176
"BrowserInfoResult": ".types",
@@ -196,6 +206,7 @@
196206
"HttpValidationError": ".types",
197207
"Icon": ".types",
198208
"ImageContent": ".types",
209+
"JupyterCreateSessionResponse": ".types",
199210
"JupyterExecuteResponse": ".types",
200211
"JupyterInfoResponse": ".types",
201212
"JupyterOutput": ".types",
@@ -211,6 +222,7 @@
211222
"NodeJsOutput": ".types",
212223
"NodeJsRuntimeInfo": ".types",
213224
"PressAction": ".types",
225+
"Resolution": ".types",
214226
"Resource": ".types",
215227
"ResourceLink": ".types",
216228
"Response": ".types",
@@ -227,6 +239,7 @@
227239
"ResponseFileSearchResult": ".types",
228240
"ResponseFileUploadResult": ".types",
229241
"ResponseFileWriteResult": ".types",
242+
"ResponseJupyterCreateSessionResponse": ".types",
230243
"ResponseJupyterExecuteResponse": ".types",
231244
"ResponseJupyterInfoResponse": ".types",
232245
"ResponseListStr": ".types",
@@ -242,7 +255,9 @@
242255
"ResponseStr": ".types",
243256
"ResponseStrReplaceEditorResult": ".types",
244257
"RightClickAction": ".types",
258+
"RuntimeEnv": ".types",
245259
"Sandbox": ".client",
260+
"SandboxDetail": ".types",
246261
"SandboxResponse": ".types",
247262
"ScrollAction": ".types",
248263
"SessionInfo": ".types",
@@ -254,10 +269,13 @@
254269
"ShellWaitResult": ".types",
255270
"ShellWriteResult": ".types",
256271
"StrReplaceEditorResult": ".types",
272+
"SystemEnv": ".types",
257273
"TextContent": ".types",
258274
"TextResourceContents": ".types",
259275
"Tool": ".types",
260276
"ToolAnnotations": ".types",
277+
"ToolCategory": ".types",
278+
"ToolSpec": ".types",
261279
"TypingAction": ".types",
262280
"UnprocessableEntityError": ".errors",
263281
"ValidationError": ".types",
@@ -319,6 +337,7 @@ def __dir__():
319337
"AnnotationsAudienceItem",
320338
"AsyncSandbox",
321339
"AudioContent",
340+
"AvailableTool",
322341
"BashCommandStatus",
323342
"BlobResourceContents",
324343
"BrowserInfoResult",
@@ -354,6 +373,7 @@ def __dir__():
354373
"HttpValidationError",
355374
"Icon",
356375
"ImageContent",
376+
"JupyterCreateSessionResponse",
357377
"JupyterExecuteResponse",
358378
"JupyterInfoResponse",
359379
"JupyterOutput",
@@ -369,6 +389,7 @@ def __dir__():
369389
"NodeJsOutput",
370390
"NodeJsRuntimeInfo",
371391
"PressAction",
392+
"Resolution",
372393
"Resource",
373394
"ResourceLink",
374395
"Response",
@@ -385,6 +406,7 @@ def __dir__():
385406
"ResponseFileSearchResult",
386407
"ResponseFileUploadResult",
387408
"ResponseFileWriteResult",
409+
"ResponseJupyterCreateSessionResponse",
388410
"ResponseJupyterExecuteResponse",
389411
"ResponseJupyterInfoResponse",
390412
"ResponseListStr",
@@ -400,7 +422,9 @@ def __dir__():
400422
"ResponseStr",
401423
"ResponseStrReplaceEditorResult",
402424
"RightClickAction",
425+
"RuntimeEnv",
403426
"Sandbox",
427+
"SandboxDetail",
404428
"SandboxResponse",
405429
"ScrollAction",
406430
"SessionInfo",
@@ -412,10 +436,13 @@ def __dir__():
412436
"ShellWaitResult",
413437
"ShellWriteResult",
414438
"StrReplaceEditorResult",
439+
"SystemEnv",
415440
"TextContent",
416441
"TextResourceContents",
417442
"Tool",
418443
"ToolAnnotations",
444+
"ToolCategory",
445+
"ToolSpec",
419446
"TypingAction",
420447
"UnprocessableEntityError",
421448
"ValidationError",

sdk/python/agent_sandbox/browser/client.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
66
from ..core.request_options import RequestOptions
77
from ..types.action_response import ActionResponse
8+
from ..types.resolution import Resolution
9+
from ..types.response import Response
810
from ..types.response_browser_info_result import ResponseBrowserInfoResult
911
from .raw_client import AsyncRawBrowserClient, RawBrowserClient
1012
from .types.action import Action
@@ -110,6 +112,37 @@ def execute_action(
110112
_response = self._raw_client.execute_action(request=request, request_options=request_options)
111113
return _response.data
112114

115+
def set_config(
116+
self, *, resolution: typing.Optional[Resolution] = OMIT, request_options: typing.Optional[RequestOptions] = None
117+
) -> Response:
118+
"""
119+
Execute a validated action on the current display.
120+
121+
Parameters
122+
----------
123+
resolution : typing.Optional[Resolution]
124+
The desired screen resolution, allowed values are: 1920x1080, 640x480, 1360x768, 1280x720, 800x600, 1024x768, 1280x800, 1920x1200, 1280x960, 1400x1050, 1680x1050, 1280x1024, 1600x1200.
125+
126+
request_options : typing.Optional[RequestOptions]
127+
Request-specific configuration.
128+
129+
Returns
130+
-------
131+
Response
132+
Successful Response
133+
134+
Examples
135+
--------
136+
from agent_sandbox import Sandbox
137+
138+
client = Sandbox(
139+
base_url="https://yourhost.com/path/to/api",
140+
)
141+
client.browser.set_config()
142+
"""
143+
_response = self._raw_client.set_config(resolution=resolution, request_options=request_options)
144+
return _response.data
145+
113146

114147
class AsyncBrowserClient:
115148
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -226,3 +259,42 @@ async def main() -> None:
226259
"""
227260
_response = await self._raw_client.execute_action(request=request, request_options=request_options)
228261
return _response.data
262+
263+
async def set_config(
264+
self, *, resolution: typing.Optional[Resolution] = OMIT, request_options: typing.Optional[RequestOptions] = None
265+
) -> Response:
266+
"""
267+
Execute a validated action on the current display.
268+
269+
Parameters
270+
----------
271+
resolution : typing.Optional[Resolution]
272+
The desired screen resolution, allowed values are: 1920x1080, 640x480, 1360x768, 1280x720, 800x600, 1024x768, 1280x800, 1920x1200, 1280x960, 1400x1050, 1680x1050, 1280x1024, 1600x1200.
273+
274+
request_options : typing.Optional[RequestOptions]
275+
Request-specific configuration.
276+
277+
Returns
278+
-------
279+
Response
280+
Successful Response
281+
282+
Examples
283+
--------
284+
import asyncio
285+
286+
from agent_sandbox import AsyncSandbox
287+
288+
client = AsyncSandbox(
289+
base_url="https://yourhost.com/path/to/api",
290+
)
291+
292+
293+
async def main() -> None:
294+
await client.browser.set_config()
295+
296+
297+
asyncio.run(main())
298+
"""
299+
_response = await self._raw_client.set_config(resolution=resolution, request_options=request_options)
300+
return _response.data

sdk/python/agent_sandbox/browser/raw_client.py

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from ..errors.unprocessable_entity_error import UnprocessableEntityError
1414
from ..types.action_response import ActionResponse
1515
from ..types.http_validation_error import HttpValidationError
16+
from ..types.resolution import Resolution
17+
from ..types.response import Response
1618
from ..types.response_browser_info_result import ResponseBrowserInfoResult
1719
from .types.action import Action
1820

@@ -157,6 +159,65 @@ def execute_action(
157159
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
158160
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
159161

162+
def set_config(
163+
self, *, resolution: typing.Optional[Resolution] = OMIT, request_options: typing.Optional[RequestOptions] = None
164+
) -> HttpResponse[Response]:
165+
"""
166+
Execute a validated action on the current display.
167+
168+
Parameters
169+
----------
170+
resolution : typing.Optional[Resolution]
171+
The desired screen resolution, allowed values are: 1920x1080, 640x480, 1360x768, 1280x720, 800x600, 1024x768, 1280x800, 1920x1200, 1280x960, 1400x1050, 1680x1050, 1280x1024, 1600x1200.
172+
173+
request_options : typing.Optional[RequestOptions]
174+
Request-specific configuration.
175+
176+
Returns
177+
-------
178+
HttpResponse[Response]
179+
Successful Response
180+
"""
181+
_response = self._client_wrapper.httpx_client.request(
182+
"v1/browser/config",
183+
method="POST",
184+
json={
185+
"resolution": convert_and_respect_annotation_metadata(
186+
object_=resolution, annotation=Resolution, direction="write"
187+
),
188+
},
189+
headers={
190+
"content-type": "application/json",
191+
},
192+
request_options=request_options,
193+
omit=OMIT,
194+
)
195+
try:
196+
if 200 <= _response.status_code < 300:
197+
_data = typing.cast(
198+
Response,
199+
parse_obj_as(
200+
type_=Response, # type: ignore
201+
object_=_response.json(),
202+
),
203+
)
204+
return HttpResponse(response=_response, data=_data)
205+
if _response.status_code == 422:
206+
raise UnprocessableEntityError(
207+
headers=dict(_response.headers),
208+
body=typing.cast(
209+
HttpValidationError,
210+
parse_obj_as(
211+
type_=HttpValidationError, # type: ignore
212+
object_=_response.json(),
213+
),
214+
),
215+
)
216+
_response_json = _response.json()
217+
except JSONDecodeError:
218+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
219+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
220+
160221

161222
class AsyncRawBrowserClient:
162223
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -295,3 +356,62 @@ async def execute_action(
295356
except JSONDecodeError:
296357
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
297358
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
359+
360+
async def set_config(
361+
self, *, resolution: typing.Optional[Resolution] = OMIT, request_options: typing.Optional[RequestOptions] = None
362+
) -> AsyncHttpResponse[Response]:
363+
"""
364+
Execute a validated action on the current display.
365+
366+
Parameters
367+
----------
368+
resolution : typing.Optional[Resolution]
369+
The desired screen resolution, allowed values are: 1920x1080, 640x480, 1360x768, 1280x720, 800x600, 1024x768, 1280x800, 1920x1200, 1280x960, 1400x1050, 1680x1050, 1280x1024, 1600x1200.
370+
371+
request_options : typing.Optional[RequestOptions]
372+
Request-specific configuration.
373+
374+
Returns
375+
-------
376+
AsyncHttpResponse[Response]
377+
Successful Response
378+
"""
379+
_response = await self._client_wrapper.httpx_client.request(
380+
"v1/browser/config",
381+
method="POST",
382+
json={
383+
"resolution": convert_and_respect_annotation_metadata(
384+
object_=resolution, annotation=Resolution, direction="write"
385+
),
386+
},
387+
headers={
388+
"content-type": "application/json",
389+
},
390+
request_options=request_options,
391+
omit=OMIT,
392+
)
393+
try:
394+
if 200 <= _response.status_code < 300:
395+
_data = typing.cast(
396+
Response,
397+
parse_obj_as(
398+
type_=Response, # type: ignore
399+
object_=_response.json(),
400+
),
401+
)
402+
return AsyncHttpResponse(response=_response, data=_data)
403+
if _response.status_code == 422:
404+
raise UnprocessableEntityError(
405+
headers=dict(_response.headers),
406+
body=typing.cast(
407+
HttpValidationError,
408+
parse_obj_as(
409+
type_=HttpValidationError, # type: ignore
410+
object_=_response.json(),
411+
),
412+
),
413+
)
414+
_response_json = _response.json()
415+
except JSONDecodeError:
416+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
417+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

0 commit comments

Comments
 (0)