blaxel 0.2.31__py3-none-any.whl → 0.2.31rc121__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.
Files changed (174) hide show
  1. blaxel/__init__.py +3 -3
  2. blaxel/core/agents/__init__.py +6 -13
  3. blaxel/core/authentication/__init__.py +1 -2
  4. blaxel/core/authentication/devicemode.py +1 -9
  5. blaxel/core/authentication/oauth.py +6 -13
  6. blaxel/core/authentication/types.py +0 -1
  7. blaxel/core/cache/cache.py +3 -10
  8. blaxel/core/client/api/agents/list_agent_revisions.py +1 -3
  9. blaxel/core/client/api/compute/delete_sandbox_preview_token.py +2 -6
  10. blaxel/core/client/api/compute/start_sandbox.py +1 -3
  11. blaxel/core/client/api/compute/stop_sandbox.py +1 -3
  12. blaxel/core/client/api/default/list_sandbox_hub_definitions.py +2 -6
  13. blaxel/core/client/api/functions/list_function_revisions.py +1 -3
  14. blaxel/core/client/api/images/cleanup_images.py +1 -3
  15. blaxel/core/client/api/integrations/list_integration_connections.py +2 -6
  16. blaxel/core/client/api/invitations/list_all_pending_invitations.py +1 -3
  17. blaxel/core/client/api/jobs/create_job_execution.py +1 -3
  18. blaxel/core/client/api/jobs/delete_job_execution.py +1 -3
  19. blaxel/core/client/api/jobs/get_job_execution.py +1 -3
  20. blaxel/core/client/api/jobs/list_job_executions.py +2 -6
  21. blaxel/core/client/api/jobs/list_job_revisions.py +1 -3
  22. blaxel/core/client/api/locations/list_locations.py +1 -3
  23. blaxel/core/client/api/models/list_model_revisions.py +1 -3
  24. blaxel/core/client/api/service_accounts/create_workspace_service_account.py +2 -6
  25. blaxel/core/client/api/service_accounts/delete_workspace_service_account.py +2 -6
  26. blaxel/core/client/api/service_accounts/get_workspace_service_accounts.py +1 -3
  27. blaxel/core/client/api/service_accounts/update_workspace_service_account.py +2 -6
  28. blaxel/core/client/api/volume_templates/list_volume_templates.py +1 -3
  29. blaxel/core/client/api/workspaces/accept_workspace_invitation.py +2 -6
  30. blaxel/core/client/api/workspaces/invite_workspace_user.py +2 -6
  31. blaxel/core/client/api/workspaces/update_workspace_user_role.py +2 -6
  32. blaxel/core/client/client.py +1 -3
  33. blaxel/core/client/models/agent.py +4 -11
  34. blaxel/core/client/models/agent_spec.py +5 -18
  35. blaxel/core/client/models/billable_time_metric.py +1 -0
  36. blaxel/core/client/models/configuration.py +1 -0
  37. blaxel/core/client/models/core_spec.py +3 -10
  38. blaxel/core/client/models/core_spec_configurations.py +1 -0
  39. blaxel/core/client/models/create_job_execution_request.py +1 -0
  40. blaxel/core/client/models/create_job_execution_response.py +1 -0
  41. blaxel/core/client/models/custom_domain.py +2 -5
  42. blaxel/core/client/models/custom_domain_metadata.py +1 -0
  43. blaxel/core/client/models/custom_domain_spec.py +2 -5
  44. blaxel/core/client/models/delete_volume_template_version_response_200.py +2 -5
  45. blaxel/core/client/models/entrypoint.py +1 -0
  46. blaxel/core/client/models/form.py +2 -5
  47. blaxel/core/client/models/function.py +4 -11
  48. blaxel/core/client/models/function_spec.py +4 -13
  49. blaxel/core/client/models/image.py +2 -5
  50. blaxel/core/client/models/image_spec.py +1 -0
  51. blaxel/core/client/models/integration.py +3 -10
  52. blaxel/core/client/models/integration_connection.py +2 -5
  53. blaxel/core/client/models/integration_connection_spec.py +1 -0
  54. blaxel/core/client/models/integration_endpoint.py +2 -5
  55. blaxel/core/client/models/integration_endpoints.py +2 -0
  56. blaxel/core/client/models/job.py +4 -11
  57. blaxel/core/client/models/job_execution.py +2 -5
  58. blaxel/core/client/models/job_execution_spec.py +1 -0
  59. blaxel/core/client/models/job_execution_task.py +2 -5
  60. blaxel/core/client/models/job_metrics.py +2 -5
  61. blaxel/core/client/models/job_spec.py +4 -13
  62. blaxel/core/client/models/jobs_network_chart.py +1 -0
  63. blaxel/core/client/models/jobs_success_failed_chart.py +3 -10
  64. blaxel/core/client/models/latency_metric.py +2 -5
  65. blaxel/core/client/models/location_response.py +1 -0
  66. blaxel/core/client/models/mcp_definition.py +2 -5
  67. blaxel/core/client/models/metadata.py +1 -0
  68. blaxel/core/client/models/metrics.py +4 -11
  69. blaxel/core/client/models/model.py +4 -11
  70. blaxel/core/client/models/model_spec.py +3 -10
  71. blaxel/core/client/models/pending_invitation_accept.py +2 -5
  72. blaxel/core/client/models/pending_invitation_render.py +3 -10
  73. blaxel/core/client/models/policy.py +2 -5
  74. blaxel/core/client/models/policy_spec.py +4 -11
  75. blaxel/core/client/models/preview.py +2 -5
  76. blaxel/core/client/models/preview_spec.py +1 -0
  77. blaxel/core/client/models/preview_token.py +2 -5
  78. blaxel/core/client/models/public_ips.py +1 -0
  79. blaxel/core/client/models/request_duration_over_time_metrics.py +1 -0
  80. blaxel/core/client/models/request_total_by_origin_metric.py +7 -16
  81. blaxel/core/client/models/request_total_metric.py +3 -8
  82. blaxel/core/client/models/resource_metrics.py +17 -58
  83. blaxel/core/client/models/runtime.py +1 -0
  84. blaxel/core/client/models/sandbox.py +4 -11
  85. blaxel/core/client/models/sandbox_definition.py +1 -0
  86. blaxel/core/client/models/sandbox_lifecycle.py +1 -0
  87. blaxel/core/client/models/sandbox_spec.py +6 -21
  88. blaxel/core/client/models/serverless_config.py +1 -0
  89. blaxel/core/client/models/start_sandbox.py +2 -5
  90. blaxel/core/client/models/stop_sandbox.py +2 -5
  91. blaxel/core/client/models/store_agent.py +1 -0
  92. blaxel/core/client/models/store_configuration.py +1 -0
  93. blaxel/core/client/models/template.py +1 -0
  94. blaxel/core/client/models/time_to_first_token_over_time_metrics.py +2 -3
  95. blaxel/core/client/models/token_rate_metrics.py +1 -0
  96. blaxel/core/client/models/trigger.py +1 -0
  97. blaxel/core/client/models/trigger_configuration.py +1 -0
  98. blaxel/core/client/models/volume.py +4 -11
  99. blaxel/core/client/models/volume_template.py +2 -5
  100. blaxel/core/client/models/workspace.py +2 -5
  101. blaxel/core/client/response_interceptor.py +1 -3
  102. blaxel/core/common/autoload.py +11 -9
  103. blaxel/core/common/env.py +8 -10
  104. blaxel/core/common/settings.py +2 -4
  105. blaxel/core/common/webhook.py +1 -0
  106. blaxel/core/jobs/__init__.py +3 -13
  107. blaxel/core/mcp/client.py +2 -8
  108. blaxel/core/mcp/server.py +2 -8
  109. blaxel/core/models/__init__.py +5 -6
  110. blaxel/core/sandbox/__init__.py +1 -1
  111. blaxel/core/sandbox/client/api/codegen/get_codegen_reranking_path.py +2 -6
  112. blaxel/core/sandbox/client/api/fastapply/put_codegen_fastapply_path.py +2 -6
  113. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_multipart_upload_id_abort.py +2 -6
  114. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_path.py +2 -6
  115. blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +2 -6
  116. blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +1 -3
  117. blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +2 -6
  118. blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +2 -6
  119. blaxel/core/sandbox/client/api/filesystem/get_watch_filesystem_path.py +2 -6
  120. blaxel/core/sandbox/client/api/filesystem/post_filesystem_multipart_upload_id_complete.py +2 -6
  121. blaxel/core/sandbox/client/api/filesystem/put_filesystem_path.py +2 -6
  122. blaxel/core/sandbox/client/api/process/delete_process_identifier.py +2 -6
  123. blaxel/core/sandbox/client/api/process/delete_process_identifier_kill.py +2 -6
  124. blaxel/core/sandbox/client/api/process/get_process.py +1 -3
  125. blaxel/core/sandbox/client/api/process/get_process_identifier.py +2 -6
  126. blaxel/core/sandbox/client/api/process/get_process_identifier_logs.py +2 -6
  127. blaxel/core/sandbox/client/api/process/get_process_identifier_logs_stream.py +2 -6
  128. blaxel/core/sandbox/client/api/process/post_process.py +2 -6
  129. blaxel/core/sandbox/client/client.py +1 -3
  130. blaxel/core/sandbox/client/models/filesystem_multipart_upload_parts.py +1 -3
  131. blaxel/core/sandbox/default/__init__.py +1 -0
  132. blaxel/core/sandbox/default/action.py +3 -3
  133. blaxel/core/sandbox/default/codegen.py +4 -2
  134. blaxel/core/sandbox/default/filesystem.py +82 -38
  135. blaxel/core/sandbox/default/interpreter.py +10 -17
  136. blaxel/core/sandbox/default/preview.py +2 -6
  137. blaxel/core/sandbox/default/process.py +7 -25
  138. blaxel/core/sandbox/default/sandbox.py +2 -7
  139. blaxel/core/sandbox/sync/__init__.py +2 -0
  140. blaxel/core/sandbox/sync/action.py +3 -2
  141. blaxel/core/sandbox/sync/codegen.py +5 -1
  142. blaxel/core/sandbox/sync/filesystem.py +6 -17
  143. blaxel/core/sandbox/sync/interpreter.py +6 -10
  144. blaxel/core/sandbox/sync/network.py +2 -0
  145. blaxel/core/sandbox/sync/preview.py +9 -21
  146. blaxel/core/sandbox/sync/process.py +8 -32
  147. blaxel/core/sandbox/sync/sandbox.py +6 -13
  148. blaxel/core/sandbox/sync/session.py +4 -6
  149. blaxel/core/sandbox/types.py +1 -2
  150. blaxel/core/tools/__init__.py +6 -30
  151. blaxel/core/tools/common.py +1 -1
  152. blaxel/core/tools/types.py +1 -2
  153. blaxel/crewai/model.py +5 -20
  154. blaxel/googleadk/__init__.py +1 -1
  155. blaxel/googleadk/tools.py +5 -3
  156. blaxel/langgraph/custom/gemini.py +133 -126
  157. blaxel/langgraph/model.py +50 -54
  158. blaxel/langgraph/tools.py +3 -9
  159. blaxel/llamaindex/custom/cohere.py +16 -25
  160. blaxel/llamaindex/model.py +57 -44
  161. blaxel/llamaindex/tools.py +3 -2
  162. blaxel/pydantic/custom/gemini.py +3 -3
  163. blaxel/pydantic/tools.py +4 -2
  164. blaxel/telemetry/exporters.py +3 -10
  165. blaxel/telemetry/instrumentation/blaxel_langgraph.py +2 -4
  166. blaxel/telemetry/instrumentation/blaxel_langgraph_gemini.py +5 -22
  167. blaxel/telemetry/instrumentation/utils.py +3 -3
  168. blaxel/telemetry/log/log.py +3 -2
  169. blaxel/telemetry/log/logger.py +15 -21
  170. blaxel/telemetry/span.py +6 -10
  171. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc121.dist-info}/METADATA +2 -2
  172. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc121.dist-info}/RECORD +174 -174
  173. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc121.dist-info}/WHEEL +0 -0
  174. {blaxel-0.2.31.dist-info → blaxel-0.2.31rc121.dist-info}/licenses/LICENSE +0 -0
@@ -42,9 +42,7 @@ def _get_kwargs(
42
42
  return _kwargs
43
43
 
44
44
 
45
- def _parse_response(
46
- *, client: Client, response: httpx.Response
47
- ) -> Union[ContentSearchResponse, ErrorResponse] | None:
45
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ContentSearchResponse, ErrorResponse] | None:
48
46
  if response.status_code == 200:
49
47
  response_200 = ContentSearchResponse.from_dict(response.json())
50
48
 
@@ -42,9 +42,7 @@ def _get_kwargs(
42
42
  return _kwargs
43
43
 
44
44
 
45
- def _parse_response(
46
- *, client: Client, response: httpx.Response
47
- ) -> Union[ErrorResponse, FindResponse] | None:
45
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, FindResponse] | None:
48
46
  if response.status_code == 200:
49
47
  response_200 = FindResponse.from_dict(response.json())
50
48
 
@@ -67,9 +65,7 @@ def _parse_response(
67
65
  return None
68
66
 
69
67
 
70
- def _build_response(
71
- *, client: Client, response: httpx.Response
72
- ) -> Response[Union[ErrorResponse, FindResponse]]:
68
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, FindResponse]]:
73
69
  return Response(
74
70
  status_code=HTTPStatus(response.status_code),
75
71
  content=response.content,
@@ -39,9 +39,7 @@ def _get_kwargs(
39
39
  return _kwargs
40
40
 
41
41
 
42
- def _parse_response(
43
- *, client: Client, response: httpx.Response
44
- ) -> Union[ErrorResponse, FuzzySearchResponse] | None:
42
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, FuzzySearchResponse] | None:
45
43
  if response.status_code == 200:
46
44
  response_200 = FuzzySearchResponse.from_dict(response.json())
47
45
 
@@ -64,9 +62,7 @@ def _parse_response(
64
62
  return None
65
63
 
66
64
 
67
- def _build_response(
68
- *, client: Client, response: httpx.Response
69
- ) -> Response[Union[ErrorResponse, FuzzySearchResponse]]:
65
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, FuzzySearchResponse]]:
70
66
  return Response(
71
67
  status_code=HTTPStatus(response.status_code),
72
68
  content=response.content,
@@ -29,9 +29,7 @@ def _get_kwargs(
29
29
  return _kwargs
30
30
 
31
31
 
32
- def _parse_response(
33
- *, client: Client, response: httpx.Response
34
- ) -> Union[ErrorResponse, str] | None:
32
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, str] | None:
35
33
  if response.status_code == 200:
36
34
  response_200 = response.text
37
35
  return response_200
@@ -49,9 +47,7 @@ def _parse_response(
49
47
  return None
50
48
 
51
49
 
52
- def _build_response(
53
- *, client: Client, response: httpx.Response
54
- ) -> Response[Union[ErrorResponse, str]]:
50
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, str]]:
55
51
  return Response(
56
52
  status_code=HTTPStatus(response.status_code),
57
53
  content=response.content,
@@ -35,9 +35,7 @@ def _get_kwargs(
35
35
  return _kwargs
36
36
 
37
37
 
38
- def _parse_response(
39
- *, client: Client, response: httpx.Response
40
- ) -> Union[ErrorResponse, SuccessResponse] | None:
38
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, SuccessResponse] | None:
41
39
  if response.status_code == 200:
42
40
  response_200 = SuccessResponse.from_dict(response.json())
43
41
 
@@ -60,9 +58,7 @@ def _parse_response(
60
58
  return None
61
59
 
62
60
 
63
- def _build_response(
64
- *, client: Client, response: httpx.Response
65
- ) -> Response[Union[ErrorResponse, SuccessResponse]]:
61
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
66
62
  return Response(
67
63
  status_code=HTTPStatus(response.status_code),
68
64
  content=response.content,
@@ -35,9 +35,7 @@ def _get_kwargs(
35
35
  return _kwargs
36
36
 
37
37
 
38
- def _parse_response(
39
- *, client: Client, response: httpx.Response
40
- ) -> Union[ErrorResponse, SuccessResponse] | None:
38
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, SuccessResponse] | None:
41
39
  if response.status_code == 200:
42
40
  response_200 = SuccessResponse.from_dict(response.json())
43
41
 
@@ -60,9 +58,7 @@ def _parse_response(
60
58
  return None
61
59
 
62
60
 
63
- def _build_response(
64
- *, client: Client, response: httpx.Response
65
- ) -> Response[Union[ErrorResponse, SuccessResponse]]:
61
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
66
62
  return Response(
67
63
  status_code=HTTPStatus(response.status_code),
68
64
  content=response.content,
@@ -21,9 +21,7 @@ def _get_kwargs(
21
21
  return _kwargs
22
22
 
23
23
 
24
- def _parse_response(
25
- *, client: Client, response: httpx.Response
26
- ) -> Union[ErrorResponse, SuccessResponse] | None:
24
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, SuccessResponse] | None:
27
25
  if response.status_code == 200:
28
26
  response_200 = SuccessResponse.from_dict(response.json())
29
27
 
@@ -46,9 +44,7 @@ def _parse_response(
46
44
  return None
47
45
 
48
46
 
49
- def _build_response(
50
- *, client: Client, response: httpx.Response
51
- ) -> Response[Union[ErrorResponse, SuccessResponse]]:
47
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
52
48
  return Response(
53
49
  status_code=HTTPStatus(response.status_code),
54
50
  content=response.content,
@@ -21,9 +21,7 @@ def _get_kwargs(
21
21
  return _kwargs
22
22
 
23
23
 
24
- def _parse_response(
25
- *, client: Client, response: httpx.Response
26
- ) -> Union[ErrorResponse, SuccessResponse] | None:
24
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, SuccessResponse] | None:
27
25
  if response.status_code == 200:
28
26
  response_200 = SuccessResponse.from_dict(response.json())
29
27
 
@@ -46,9 +44,7 @@ def _parse_response(
46
44
  return None
47
45
 
48
46
 
49
- def _build_response(
50
- *, client: Client, response: httpx.Response
51
- ) -> Response[Union[ErrorResponse, SuccessResponse]]:
47
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
52
48
  return Response(
53
49
  status_code=HTTPStatus(response.status_code),
54
50
  content=response.content,
@@ -34,9 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> list["Proces
34
34
  return None
35
35
 
36
36
 
37
- def _build_response(
38
- *, client: Client, response: httpx.Response
39
- ) -> Response[list["ProcessResponse"]]:
37
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[list["ProcessResponse"]]:
40
38
  return Response(
41
39
  status_code=HTTPStatus(response.status_code),
42
40
  content=response.content,
@@ -21,9 +21,7 @@ def _get_kwargs(
21
21
  return _kwargs
22
22
 
23
23
 
24
- def _parse_response(
25
- *, client: Client, response: httpx.Response
26
- ) -> Union[ErrorResponse, ProcessResponse] | None:
24
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, ProcessResponse] | None:
27
25
  if response.status_code == 200:
28
26
  response_200 = ProcessResponse.from_dict(response.json())
29
27
 
@@ -38,9 +36,7 @@ def _parse_response(
38
36
  return None
39
37
 
40
38
 
41
- def _build_response(
42
- *, client: Client, response: httpx.Response
43
- ) -> Response[Union[ErrorResponse, ProcessResponse]]:
39
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, ProcessResponse]]:
44
40
  return Response(
45
41
  status_code=HTTPStatus(response.status_code),
46
42
  content=response.content,
@@ -21,9 +21,7 @@ def _get_kwargs(
21
21
  return _kwargs
22
22
 
23
23
 
24
- def _parse_response(
25
- *, client: Client, response: httpx.Response
26
- ) -> Union[ErrorResponse, ProcessLogs] | None:
24
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, ProcessLogs] | None:
27
25
  if response.status_code == 200:
28
26
  response_200 = ProcessLogs.from_dict(response.json())
29
27
 
@@ -46,9 +44,7 @@ def _parse_response(
46
44
  return None
47
45
 
48
46
 
49
- def _build_response(
50
- *, client: Client, response: httpx.Response
51
- ) -> Response[Union[ErrorResponse, ProcessLogs]]:
47
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, ProcessLogs]]:
52
48
  return Response(
53
49
  status_code=HTTPStatus(response.status_code),
54
50
  content=response.content,
@@ -20,9 +20,7 @@ def _get_kwargs(
20
20
  return _kwargs
21
21
 
22
22
 
23
- def _parse_response(
24
- *, client: Client, response: httpx.Response
25
- ) -> Union[ErrorResponse, str] | None:
23
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, str] | None:
26
24
  if response.status_code == 200:
27
25
  response_200 = response.text
28
26
  return response_200
@@ -44,9 +42,7 @@ def _parse_response(
44
42
  return None
45
43
 
46
44
 
47
- def _build_response(
48
- *, client: Client, response: httpx.Response
49
- ) -> Response[Union[ErrorResponse, str]]:
45
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, str]]:
50
46
  return Response(
51
47
  status_code=HTTPStatus(response.status_code),
52
48
  content=response.content,
@@ -34,9 +34,7 @@ def _get_kwargs(
34
34
  return _kwargs
35
35
 
36
36
 
37
- def _parse_response(
38
- *, client: Client, response: httpx.Response
39
- ) -> Union[ErrorResponse, ProcessResponse] | None:
37
+ def _parse_response(*, client: Client, response: httpx.Response) -> Union[ErrorResponse, ProcessResponse] | None:
40
38
  if response.status_code == 200:
41
39
  response_200 = ProcessResponse.from_dict(response.json())
42
40
 
@@ -59,9 +57,7 @@ def _parse_response(
59
57
  return None
60
58
 
61
59
 
62
- def _build_response(
63
- *, client: Client, response: httpx.Response
64
- ) -> Response[Union[ErrorResponse, ProcessResponse]]:
60
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, ProcessResponse]]:
65
61
  return Response(
66
62
  status_code=HTTPStatus(response.status_code),
67
63
  content=response.content,
@@ -43,9 +43,7 @@ class Client:
43
43
  _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
44
44
  _auth: httpx.Auth = field(default=None, alias="auth")
45
45
  _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
46
- _verify_ssl: Union[str, bool, ssl.SSLContext] = field(
47
- default=True, kw_only=True, alias="verify_ssl"
48
- )
46
+ _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
49
47
  _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
50
48
  _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
51
49
  _client: httpx.Client | None = field(default=None, init=False)
@@ -14,9 +14,7 @@ T = TypeVar("T", bound="FilesystemMultipartUploadParts")
14
14
  class FilesystemMultipartUploadParts:
15
15
  """ """
16
16
 
17
- additional_properties: dict[str, "FilesystemUploadedPart"] = _attrs_field(
18
- init=False, factory=dict
19
- )
17
+ additional_properties: dict[str, "FilesystemUploadedPart"] = _attrs_field(init=False, factory=dict)
20
18
 
21
19
  def to_dict(self) -> dict[str, Any]:
22
20
  field_dict: dict[str, Any] = {}
@@ -1,3 +1,4 @@
1
+
1
2
  from .interpreter import CodeInterpreter
2
3
  from .sandbox import (
3
4
  SandboxCodegen,
@@ -1,4 +1,6 @@
1
+
1
2
  import httpx
3
+ from contextlib import asynccontextmanager
2
4
 
3
5
  from ...common.internal import get_forced_url, get_global_unique_hash
4
6
  from ...common.settings import settings
@@ -59,9 +61,7 @@ class SandboxAction:
59
61
  base_url = self.sandbox_config.force_url or self.url
60
62
  self._client = httpx.AsyncClient(
61
63
  base_url=base_url,
62
- headers=self.sandbox_config.headers
63
- if self.sandbox_config.force_url
64
- else {**settings.headers, **self.sandbox_config.headers},
64
+ headers=self.sandbox_config.headers if self.sandbox_config.force_url else {**settings.headers, **self.sandbox_config.headers},
65
65
  http2=False,
66
66
  limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
67
67
  timeout=httpx.Timeout(300.0, connect=10.0),
@@ -1,3 +1,4 @@
1
+
1
2
  from ...common.settings import settings
2
3
  from ..client.api.codegen.get_codegen_reranking_path import (
3
4
  asyncio as get_codegen_reranking_path,
@@ -38,7 +39,7 @@ class SandboxCodegen(SandboxAction):
38
39
  # Create a Client instance with the sandbox URL and headers
39
40
  client = Client(
40
41
  base_url=self.url,
41
- headers={**settings.headers, **self.sandbox_config.headers},
42
+ headers={**settings.headers, **self.sandbox_config.headers}
42
43
  )
43
44
 
44
45
  async with client:
@@ -76,7 +77,7 @@ class SandboxCodegen(SandboxAction):
76
77
  # Create a Client instance with the sandbox URL and headers
77
78
  client = Client(
78
79
  base_url=self.url,
79
- headers={**settings.headers, **self.sandbox_config.headers},
80
+ headers={**settings.headers, **self.sandbox_config.headers}
80
81
  )
81
82
 
82
83
  async with client:
@@ -93,3 +94,4 @@ class SandboxCodegen(SandboxAction):
93
94
  if isinstance(response, ErrorResponse):
94
95
  raise Exception(f"Reranking failed: {response}")
95
96
  return response
97
+
@@ -47,11 +47,11 @@ class SandboxFileSystem(SandboxAction):
47
47
  path = self.format_path(path)
48
48
 
49
49
  # Calculate content size in bytes
50
- content_size = len(content.encode("utf-8"))
50
+ content_size = len(content.encode('utf-8'))
51
51
 
52
52
  # Use multipart upload for large files
53
53
  if content_size > MULTIPART_THRESHOLD:
54
- content_bytes = content.encode("utf-8")
54
+ content_bytes = content.encode('utf-8')
55
55
  return await self._upload_with_multipart(path, content_bytes, "0644")
56
56
 
57
57
  # Use regular upload for small files
@@ -66,9 +66,7 @@ class SandboxFileSystem(SandboxAction):
66
66
  finally:
67
67
  await response.aclose()
68
68
 
69
- async def write_binary(
70
- self, path: str, content: Union[bytes, bytearray, str]
71
- ) -> SuccessResponse:
69
+ async def write_binary(self, path: str, content: Union[bytes, bytearray, str]) -> SuccessResponse:
72
70
  """Write binary content to a file.
73
71
 
74
72
  Args:
@@ -98,11 +96,7 @@ class SandboxFileSystem(SandboxAction):
98
96
 
99
97
  # Prepare multipart form data
100
98
  files = {
101
- "file": (
102
- "binary-file.bin",
103
- binary_file,
104
- "application/octet-stream",
105
- ),
99
+ "file": ("binary-file.bin", binary_file, "application/octet-stream"),
106
100
  }
107
101
  data = {"permissions": "0644", "path": path}
108
102
 
@@ -115,7 +109,7 @@ class SandboxFileSystem(SandboxAction):
115
109
  try:
116
110
  content_bytes = await response.aread()
117
111
  if not response.is_success:
118
- error_text = content_bytes.decode("utf-8", errors="ignore")
112
+ error_text = content_bytes.decode('utf-8', errors='ignore')
119
113
  raise Exception(f"Failed to write binary: {response.status_code} {error_text}")
120
114
  return SuccessResponse.from_dict(json.loads(content_bytes))
121
115
  finally:
@@ -252,18 +246,18 @@ class SandboxFileSystem(SandboxAction):
252
246
  FindResponse with matching files/directories
253
247
  """
254
248
  path = self.format_path(path)
255
-
249
+
256
250
  params = {}
257
251
  if type is not None:
258
- params["type"] = type
252
+ params['type'] = type
259
253
  if patterns is not None and len(patterns) > 0:
260
- params["patterns"] = ",".join(patterns)
254
+ params['patterns'] = ','.join(patterns)
261
255
  if max_results is not None:
262
- params["maxResults"] = max_results
256
+ params['maxResults'] = max_results
263
257
  if exclude_dirs is not None and len(exclude_dirs) > 0:
264
- params["excludeDirs"] = ",".join(exclude_dirs)
258
+ params['excludeDirs'] = ','.join(exclude_dirs)
265
259
  if exclude_hidden is not None:
266
- params["excludeHidden"] = exclude_hidden
260
+ params['excludeHidden'] = exclude_hidden
267
261
 
268
262
  url = f"{self.url}/filesystem-find/{path}"
269
263
  headers = {**settings.headers, **self.sandbox_config.headers}
@@ -273,9 +267,8 @@ class SandboxFileSystem(SandboxAction):
273
267
  try:
274
268
  data = json.loads(await response.aread())
275
269
  self.handle_response_error(response)
276
-
270
+
277
271
  from ..client.models.find_response import FindResponse
278
-
279
272
  return FindResponse.from_dict(data)
280
273
  finally:
281
274
  await response.aclose()
@@ -305,18 +298,18 @@ class SandboxFileSystem(SandboxAction):
305
298
  ContentSearchResponse with matching lines
306
299
  """
307
300
  path = self.format_path(path)
308
-
309
- params = {"query": query}
301
+
302
+ params = {'query': query}
310
303
  if case_sensitive is not None:
311
- params["caseSensitive"] = case_sensitive
304
+ params['caseSensitive'] = case_sensitive
312
305
  if context_lines is not None:
313
- params["contextLines"] = context_lines
306
+ params['contextLines'] = context_lines
314
307
  if max_results is not None:
315
- params["maxResults"] = max_results
308
+ params['maxResults'] = max_results
316
309
  if file_pattern is not None:
317
- params["filePattern"] = file_pattern
310
+ params['filePattern'] = file_pattern
318
311
  if exclude_dirs is not None and len(exclude_dirs) > 0:
319
- params["excludeDirs"] = ",".join(exclude_dirs)
312
+ params['excludeDirs'] = ','.join(exclude_dirs)
320
313
 
321
314
  url = f"{self.url}/filesystem-content-search/{path}"
322
315
  headers = {**settings.headers, **self.sandbox_config.headers}
@@ -326,15 +319,58 @@ class SandboxFileSystem(SandboxAction):
326
319
  try:
327
320
  data = json.loads(await response.aread())
328
321
  self.handle_response_error(response)
329
-
330
- from ..client.models.content_search_response import (
331
- ContentSearchResponse,
332
- )
333
-
322
+
323
+ from ..client.models.content_search_response import ContentSearchResponse
334
324
  return ContentSearchResponse.from_dict(data)
335
325
  finally:
336
326
  await response.aclose()
337
327
 
328
+ async def find(
329
+ self,
330
+ path: str,
331
+ type: str | None = None,
332
+ patterns: List[str] | None = None,
333
+ max_results: int | None = None,
334
+ exclude_dirs: List[str] | None = None,
335
+ exclude_hidden: bool | None = None,
336
+ ):
337
+ """Find files and directories.
338
+
339
+ Args:
340
+ path: Path to search in
341
+ type: Type of search ('file' or 'directory')
342
+ patterns: File patterns to include (e.g., ['*.py', '*.json'])
343
+ max_results: Maximum number of results to return
344
+ exclude_dirs: Directory names to skip
345
+ exclude_hidden: Exclude hidden files and directories
346
+
347
+ Returns:
348
+ FindResponse with matching files/directories
349
+ """
350
+ path = self.format_path(path)
351
+
352
+ params = {}
353
+ if type is not None:
354
+ params['type'] = type
355
+ if patterns is not None and len(patterns) > 0:
356
+ params['patterns'] = ','.join(patterns)
357
+ if max_results is not None:
358
+ params['maxResults'] = max_results
359
+ if exclude_dirs is not None and len(exclude_dirs) > 0:
360
+ params['excludeDirs'] = ','.join(exclude_dirs)
361
+ if exclude_hidden is not None:
362
+ params['excludeHidden'] = exclude_hidden
363
+
364
+ url = f"{self.url}/filesystem-find/{path}"
365
+ headers = {**settings.headers, **self.sandbox_config.headers}
366
+
367
+ async with self.get_client() as client_instance:
368
+ response = await client_instance.get(url, params=params, headers=headers)
369
+ self.handle_response_error(response)
370
+
371
+ from ..client.models.find_response import FindResponse
372
+ return FindResponse.from_dict(response.json())
373
+
338
374
  async def cp(self, source: str, destination: str, max_wait: int = 180000) -> CopyResponse:
339
375
  """Copy files or directories using the cp command.
340
376
 
@@ -347,7 +383,9 @@ class SandboxFileSystem(SandboxAction):
347
383
  raise Exception("Process instance not available. Cannot execute cp command.")
348
384
 
349
385
  # Execute cp -r command
350
- process = await self.process.exec({"command": f"cp -r {source} {destination}"})
386
+ process = await self.process.exec({
387
+ "command": f"cp -r {source} {destination}"
388
+ })
351
389
 
352
390
  # Wait for process to complete
353
391
  process = await self.process.wait(process.pid, max_wait=max_wait, interval=100)
@@ -357,7 +395,11 @@ class SandboxFileSystem(SandboxAction):
357
395
  logs = process.logs if hasattr(process, "logs") else "Unknown error"
358
396
  raise Exception(f"Could not copy {source} to {destination} cause: {logs}")
359
397
 
360
- return CopyResponse(message="Files copied", source=source, destination=destination)
398
+ return CopyResponse(
399
+ message="Files copied",
400
+ source=source,
401
+ destination=destination
402
+ )
361
403
 
362
404
  def watch(
363
405
  self,
@@ -454,9 +496,7 @@ class SandboxFileSystem(SandboxAction):
454
496
  return path
455
497
 
456
498
  # Multipart upload helper methods
457
- async def _initiate_multipart_upload(
458
- self, path: str, permissions: str = "0644"
459
- ) -> Dict[str, Any]:
499
+ async def _initiate_multipart_upload(self, path: str, permissions: str = "0644") -> Dict[str, Any]:
460
500
  """Initiate a multipart upload session."""
461
501
  path = self.format_path(path)
462
502
  url = f"{self.url}/filesystem-multipart/initiate/{path}"
@@ -472,7 +512,9 @@ class SandboxFileSystem(SandboxAction):
472
512
  finally:
473
513
  await response.aclose()
474
514
 
475
- async def _upload_part(self, upload_id: str, part_number: int, data: bytes) -> Dict[str, Any]:
515
+ async def _upload_part(
516
+ self, upload_id: str, part_number: int, data: bytes
517
+ ) -> Dict[str, Any]:
476
518
  """Upload a single part of a multipart upload."""
477
519
  url = f"{self.url}/filesystem-multipart/{upload_id}/part"
478
520
  headers = {**settings.headers, **self.sandbox_config.headers}
@@ -482,7 +524,9 @@ class SandboxFileSystem(SandboxAction):
482
524
  files = {"file": ("part", io.BytesIO(data), "application/octet-stream")}
483
525
 
484
526
  client = self.get_client()
485
- response = await client.put(url, files=files, params=params, headers=headers)
527
+ response = await client.put(
528
+ url, files=files, params=params, headers=headers
529
+ )
486
530
  try:
487
531
  data = json.loads(await response.aread())
488
532
  self.handle_response_error(response)
@@ -17,9 +17,7 @@ class CodeInterpreter(SandboxInstance):
17
17
  DEFAULT_PORTS = [
18
18
  {"name": "jupyter", "target": 8888, "protocol": "HTTP"},
19
19
  ]
20
- DEFAULT_LIFECYCLE = {
21
- "expirationPolicies": [{"type": "ttl-idle", "value": "30m", "action": "delete"}]
22
- }
20
+ DEFAULT_LIFECYCLE = {"expirationPolicies": [{"type": "ttl-idle", "value": "30m", "action": "delete"}]}
23
21
 
24
22
  @classmethod
25
23
  async def get(cls, sandbox_name: str) -> CodeInterpreter:
@@ -150,15 +148,11 @@ class CodeInterpreter(SandboxInstance):
150
148
  elif data_type == "stdout":
151
149
  execution.logs.stdout.append(data["text"])
152
150
  if on_stdout:
153
- return on_stdout(
154
- CodeInterpreter.OutputMessage(data["text"], data.get("timestamp"), False)
155
- )
151
+ return on_stdout(CodeInterpreter.OutputMessage(data["text"], data.get("timestamp"), False))
156
152
  elif data_type == "stderr":
157
153
  execution.logs.stderr.append(data["text"])
158
154
  if on_stderr:
159
- return on_stderr(
160
- CodeInterpreter.OutputMessage(data["text"], data.get("timestamp"), True)
161
- )
155
+ return on_stderr(CodeInterpreter.OutputMessage(data["text"], data.get("timestamp"), True))
162
156
  elif data_type == "error":
163
157
  execution.error = CodeInterpreter.ExecutionError(
164
158
  data.get("name", ""), data.get("value"), data.get("traceback")
@@ -206,10 +200,7 @@ class CodeInterpreter(SandboxInstance):
206
200
 
207
201
  client = self.process.get_client()
208
202
  timeout_cfg = httpx.Timeout(
209
- connect=connect_timeout,
210
- read=read_timeout,
211
- write=write_timeout,
212
- pool=pool_timeout,
203
+ connect=connect_timeout, read=read_timeout, write=write_timeout, pool=pool_timeout
213
204
  )
214
205
  async with client.stream(
215
206
  "POST",
@@ -252,7 +243,7 @@ class CodeInterpreter(SandboxInstance):
252
243
  on_error=on_error,
253
244
  )
254
245
  except json.JSONDecodeError:
255
- # Fallback: treat as stdout text-only message
246
+ # Fallback: treat as stdout text-only message
256
247
  execution.logs.stdout.append(decoded)
257
248
  if on_stdout:
258
249
  on_stdout(CodeInterpreter.OutputMessage(decoded, None, False))
@@ -280,10 +271,10 @@ class CodeInterpreter(SandboxInstance):
280
271
  try:
281
272
  # Always read response body first
282
273
  body_bytes = await response.aread()
283
-
274
+
284
275
  if response.status_code >= 400:
285
276
  try:
286
- body_text = body_bytes.decode("utf-8", errors="ignore")
277
+ body_text = body_bytes.decode('utf-8', errors='ignore')
287
278
  except Exception:
288
279
  body_text = "<unavailable>"
289
280
  method = getattr(response.request, "method", "UNKNOWN")
@@ -296,8 +287,10 @@ class CodeInterpreter(SandboxInstance):
296
287
  )
297
288
  self.logger.debug(details)
298
289
  raise RuntimeError(details)
299
-
290
+
300
291
  data = json.loads(body_bytes)
301
292
  return CodeInterpreter.Context.from_json(data)
302
293
  finally:
303
294
  await response.aclose()
295
+
296
+