blaxel 0.2.33__py3-none-any.whl → 0.2.35__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 (278) hide show
  1. blaxel/__init__.py +2 -2
  2. blaxel/core/__init__.py +2 -1
  3. blaxel/core/client/api/agents/create_agent.py +64 -19
  4. blaxel/core/client/api/agents/delete_agent.py +44 -15
  5. blaxel/core/client/api/agents/get_agent.py +43 -14
  6. blaxel/core/client/api/agents/list_agents.py +40 -11
  7. blaxel/core/client/api/agents/update_agent.py +60 -19
  8. blaxel/core/client/api/compute/create_sandbox.py +60 -23
  9. blaxel/core/client/api/compute/delete_sandbox.py +40 -19
  10. blaxel/core/client/api/compute/get_sandbox.py +39 -18
  11. blaxel/core/client/api/compute/list_sandboxes.py +40 -19
  12. blaxel/core/client/api/compute/update_sandbox.py +56 -23
  13. blaxel/core/client/api/configurations/get_configuration.py +16 -4
  14. blaxel/core/client/api/customdomains/create_custom_domain.py +12 -0
  15. blaxel/core/client/api/customdomains/list_custom_domains.py +16 -4
  16. blaxel/core/client/api/default/get_template.py +8 -4
  17. blaxel/core/client/api/functions/create_function.py +62 -19
  18. blaxel/core/client/api/functions/delete_function.py +46 -15
  19. blaxel/core/client/api/functions/get_function.py +45 -14
  20. blaxel/core/client/api/functions/list_functions.py +44 -15
  21. blaxel/core/client/api/functions/update_function.py +62 -19
  22. blaxel/core/client/api/images/cleanup_images.py +12 -12
  23. blaxel/core/client/api/images/delete_image.py +12 -8
  24. blaxel/core/client/api/images/delete_image_tag.py +12 -8
  25. blaxel/core/client/api/images/get_image.py +12 -8
  26. blaxel/core/client/api/images/list_images.py +12 -8
  27. blaxel/core/client/api/integrations/create_integration_connection.py +56 -23
  28. blaxel/core/client/api/integrations/delete_integration_connection.py +48 -19
  29. blaxel/core/client/api/integrations/get_integration.py +12 -8
  30. blaxel/core/client/api/integrations/get_integration_connection.py +44 -19
  31. blaxel/core/client/api/integrations/get_integration_connection_model.py +2 -2
  32. blaxel/core/client/api/integrations/list_integration_connections.py +36 -19
  33. blaxel/core/client/api/integrations/update_integration_connection.py +52 -19
  34. blaxel/core/client/api/jobs/create_job.py +20 -12
  35. blaxel/core/client/api/jobs/create_job_execution.py +22 -16
  36. blaxel/core/client/api/jobs/delete_job.py +12 -8
  37. blaxel/core/client/api/jobs/delete_job_execution.py +12 -8
  38. blaxel/core/client/api/jobs/get_job.py +24 -20
  39. blaxel/core/client/api/jobs/get_job_execution.py +8 -4
  40. blaxel/core/client/api/jobs/list_job_executions.py +8 -4
  41. blaxel/core/client/api/jobs/list_jobs.py +12 -8
  42. blaxel/core/client/api/jobs/update_job.py +20 -12
  43. blaxel/core/client/api/locations/list_locations.py +12 -8
  44. blaxel/core/client/api/{default → mcphub}/list_mcp_hub_definitions.py +20 -4
  45. blaxel/core/client/api/models/create_model.py +52 -23
  46. blaxel/core/client/api/models/delete_model.py +40 -19
  47. blaxel/core/client/api/models/get_model.py +40 -19
  48. blaxel/core/client/api/models/list_models.py +40 -19
  49. blaxel/core/client/api/models/update_model.py +52 -23
  50. blaxel/core/client/api/policies/create_policy.py +12 -8
  51. blaxel/core/client/api/policies/delete_policy.py +12 -8
  52. blaxel/core/client/api/policies/get_policy.py +12 -8
  53. blaxel/core/client/api/policies/list_policies.py +12 -8
  54. blaxel/core/client/api/policies/update_policy.py +12 -8
  55. blaxel/core/client/api/public_ipslist/list_public_ips.py +37 -5
  56. blaxel/core/client/api/sandboxhub/__init__.py +0 -0
  57. blaxel/core/client/api/{default → sandboxhub}/list_sandbox_hub_definitions.py +20 -4
  58. blaxel/core/client/api/service_accounts/create_api_key_for_service_account.py +12 -8
  59. blaxel/core/client/api/service_accounts/create_workspace_service_account.py +12 -8
  60. blaxel/core/client/api/service_accounts/delete_api_key_for_service_account.py +6 -4
  61. blaxel/core/client/api/service_accounts/delete_workspace_service_account.py +12 -8
  62. blaxel/core/client/api/service_accounts/get_workspace_service_accounts.py +12 -8
  63. blaxel/core/client/api/service_accounts/list_api_keys_for_service_account.py +12 -8
  64. blaxel/core/client/api/service_accounts/update_workspace_service_account.py +8 -8
  65. blaxel/core/client/api/templates/list_templates.py +12 -8
  66. blaxel/core/client/api/volume_templates/create_volume_template.py +8 -4
  67. blaxel/core/client/api/volume_templates/list_volume_templates.py +8 -4
  68. blaxel/core/client/api/volumes/create_volume.py +56 -23
  69. blaxel/core/client/api/volumes/delete_volume.py +44 -19
  70. blaxel/core/client/api/volumes/get_volume.py +40 -19
  71. blaxel/core/client/api/volumes/list_volumes.py +40 -19
  72. blaxel/core/client/api/workspaces/create_workspace.py +54 -23
  73. blaxel/core/client/api/workspaces/delete_workspace.py +42 -19
  74. blaxel/core/client/api/workspaces/get_workspace.py +42 -19
  75. blaxel/core/client/api/workspaces/invite_workspace_user.py +8 -4
  76. blaxel/core/client/api/workspaces/list_workspace_users.py +12 -8
  77. blaxel/core/client/api/workspaces/list_workspaces.py +36 -19
  78. blaxel/core/client/api/workspaces/update_workspace.py +50 -19
  79. blaxel/core/client/models/__init__.py +76 -146
  80. blaxel/core/client/models/agent.py +43 -47
  81. blaxel/core/client/models/agent_runtime.py +139 -0
  82. blaxel/core/client/models/agent_runtime_generation.py +18 -0
  83. blaxel/core/client/models/agent_spec.py +33 -110
  84. blaxel/core/client/models/api_key.py +5 -4
  85. blaxel/core/client/models/core_event.py +5 -5
  86. blaxel/core/client/models/create_api_key_for_service_account_body.py +2 -1
  87. blaxel/core/client/models/create_job_execution_request.py +1 -1
  88. blaxel/core/client/models/create_job_execution_response.py +13 -9
  89. blaxel/core/client/models/custom_domain.py +19 -36
  90. blaxel/core/client/models/custom_domain_metadata.py +4 -3
  91. blaxel/core/client/models/custom_domain_spec.py +14 -5
  92. blaxel/core/client/models/custom_domain_spec_status.py +19 -0
  93. blaxel/core/client/models/entrypoint.py +39 -13
  94. blaxel/core/client/models/{workspace_labels.py → entrypoint_args_item.py} +6 -6
  95. blaxel/core/client/models/entrypoint_env.py +3 -3
  96. blaxel/core/client/models/{job_metrics_executions_total.py → entrypoint_super_gateway_args_item.py} +6 -6
  97. blaxel/core/client/models/{spec_configuration.py → env.py} +17 -8
  98. blaxel/core/{sandbox/client/models/welcome_response.py → client/models/error.py} +26 -23
  99. blaxel/core/client/models/expiration_policy.py +30 -11
  100. blaxel/core/client/models/expiration_policy_action.py +17 -0
  101. blaxel/core/client/models/expiration_policy_type.py +19 -0
  102. blaxel/core/client/models/flavor.py +13 -5
  103. blaxel/core/client/models/flavor_type.py +18 -0
  104. blaxel/core/client/models/form.py +6 -6
  105. blaxel/core/client/models/function.py +43 -47
  106. blaxel/core/client/models/function_runtime.py +138 -0
  107. blaxel/core/client/models/function_runtime_generation.py +18 -0
  108. blaxel/core/client/models/function_spec.py +27 -73
  109. blaxel/core/client/models/function_spec_transport.py +18 -0
  110. blaxel/core/client/models/image.py +19 -36
  111. blaxel/core/client/models/integration_connection.py +25 -39
  112. blaxel/core/client/models/integration_connection_spec.py +8 -5
  113. blaxel/core/client/models/integration_connection_spec_config.py +1 -1
  114. blaxel/core/client/models/integration_connection_spec_secret.py +1 -1
  115. blaxel/core/client/models/integration_endpoint.py +41 -11
  116. blaxel/core/client/models/integration_endpoint_ignore_models_item.py +45 -0
  117. blaxel/core/client/models/{mcp_definition_entrypoint.py → integration_endpoint_models_item.py} +6 -6
  118. blaxel/core/client/models/job.py +43 -47
  119. blaxel/core/client/models/job_execution.py +30 -37
  120. blaxel/core/client/models/job_execution_metadata.py +3 -3
  121. blaxel/core/client/models/job_execution_spec.py +2 -2
  122. blaxel/core/client/models/job_execution_stats.py +5 -5
  123. blaxel/core/client/models/job_execution_status.py +24 -0
  124. blaxel/core/client/models/job_execution_task.py +12 -4
  125. blaxel/core/client/models/job_execution_task_metadata.py +1 -1
  126. blaxel/core/client/models/job_execution_task_spec.py +2 -2
  127. blaxel/core/client/models/job_execution_task_status.py +23 -0
  128. blaxel/core/client/models/job_runtime.py +172 -0
  129. blaxel/core/client/models/job_runtime_generation.py +18 -0
  130. blaxel/core/client/models/job_spec.py +20 -88
  131. blaxel/core/client/models/location_response.py +5 -5
  132. blaxel/core/client/models/mcp_definition.py +30 -17
  133. blaxel/core/client/models/{job_metrics_tasks_total.py → mcp_definition_categories_item.py} +6 -6
  134. blaxel/core/client/models/metadata.py +23 -17
  135. blaxel/core/client/models/metadata_labels.py +4 -1
  136. blaxel/core/client/models/model.py +43 -47
  137. blaxel/core/client/models/model_runtime.py +99 -0
  138. blaxel/core/client/models/model_runtime_type.py +34 -0
  139. blaxel/core/client/models/model_spec.py +12 -58
  140. blaxel/core/client/models/o_auth.py +23 -6
  141. blaxel/core/client/models/{form_oauth.py → o_auth_scope_item.py} +6 -6
  142. blaxel/core/client/models/pending_invitation_accept.py +2 -1
  143. blaxel/core/client/models/pending_invitation_workspace_details.py +27 -6
  144. blaxel/core/client/models/{metrics_request_total_per_code.py → pending_invitation_workspace_details_emails_item.py} +6 -6
  145. blaxel/core/client/models/policy.py +20 -36
  146. blaxel/core/client/models/policy_location.py +13 -5
  147. blaxel/core/client/models/policy_location_type.py +19 -0
  148. blaxel/core/client/models/policy_max_tokens.py +6 -6
  149. blaxel/core/client/models/policy_resource_type.py +20 -0
  150. blaxel/core/client/models/policy_spec.py +31 -10
  151. blaxel/core/client/models/policy_spec_type.py +19 -0
  152. blaxel/core/client/models/port.py +25 -15
  153. blaxel/core/client/models/port_protocol.py +19 -0
  154. blaxel/core/client/models/preview.py +19 -36
  155. blaxel/core/client/models/preview_metadata.py +12 -10
  156. blaxel/core/client/models/preview_token.py +19 -36
  157. blaxel/core/client/models/preview_token_metadata.py +8 -6
  158. blaxel/core/client/models/repository.py +2 -2
  159. blaxel/core/client/models/revision_configuration.py +3 -3
  160. blaxel/core/client/models/sandbox.py +45 -58
  161. blaxel/core/client/models/sandbox_definition.py +37 -22
  162. blaxel/core/client/models/sandbox_definition_categories_item.py +45 -0
  163. blaxel/core/client/models/sandbox_error.py +148 -0
  164. blaxel/core/client/models/sandbox_error_details.py +45 -0
  165. blaxel/core/client/models/sandbox_lifecycle.py +3 -2
  166. blaxel/core/client/models/sandbox_runtime.py +145 -0
  167. blaxel/core/client/models/sandbox_spec.py +33 -134
  168. blaxel/core/client/models/status.py +25 -0
  169. blaxel/core/client/models/template.py +8 -7
  170. blaxel/core/client/models/template_variable.py +5 -5
  171. blaxel/core/client/models/trigger.py +14 -6
  172. blaxel/core/client/models/trigger_configuration.py +7 -6
  173. blaxel/core/client/models/trigger_type.py +19 -0
  174. blaxel/core/client/models/volume.py +35 -47
  175. blaxel/core/client/models/volume_attachment.py +6 -4
  176. blaxel/core/client/models/volume_spec.py +7 -4
  177. blaxel/core/client/models/volume_state.py +3 -3
  178. blaxel/core/client/models/volume_template.py +19 -33
  179. blaxel/core/client/models/volume_template_state.py +12 -4
  180. blaxel/core/client/models/volume_template_state_status.py +19 -0
  181. blaxel/core/client/models/volume_template_version.py +12 -4
  182. blaxel/core/client/models/volume_template_version_status.py +19 -0
  183. blaxel/core/client/models/workspace.py +35 -25
  184. blaxel/core/client/models/workspace_runtime.py +3 -2
  185. blaxel/core/client/models/workspace_status.py +22 -0
  186. blaxel/core/common/__init__.py +1 -1
  187. blaxel/core/jobs/__init__.py +0 -1
  188. blaxel/core/sandbox/__init__.py +2 -0
  189. blaxel/core/sandbox/client/api/process/post_process.py +8 -4
  190. blaxel/core/sandbox/client/models/__init__.py +0 -2
  191. blaxel/core/sandbox/client/models/process_response.py +16 -0
  192. blaxel/core/sandbox/client/models/process_response_status.py +9 -0
  193. blaxel/core/sandbox/default/__init__.py +2 -0
  194. blaxel/core/sandbox/default/interpreter.py +5 -1
  195. blaxel/core/sandbox/default/preview.py +3 -1
  196. blaxel/core/sandbox/default/sandbox.py +85 -26
  197. blaxel/core/sandbox/sync/process.py +2 -1
  198. blaxel/core/sandbox/sync/sandbox.py +68 -23
  199. blaxel/core/sandbox/types.py +3 -0
  200. blaxel/core/tools/common.py +16 -2
  201. blaxel/core/volume/__init__.py +2 -2
  202. blaxel/core/volume/volume.py +227 -11
  203. blaxel/langgraph/tools.py +34 -2
  204. blaxel/openai/tools.py +33 -1
  205. {blaxel-0.2.33.dist-info → blaxel-0.2.35.dist-info}/METADATA +3 -3
  206. {blaxel-0.2.33.dist-info → blaxel-0.2.35.dist-info}/RECORD +209 -248
  207. blaxel/core/client/models/acl.py +0 -133
  208. blaxel/core/client/models/billable_time_metric.py +0 -89
  209. blaxel/core/client/models/core_spec.py +0 -194
  210. blaxel/core/client/models/core_spec_configurations.py +0 -77
  211. blaxel/core/client/models/histogram_bucket.py +0 -79
  212. blaxel/core/client/models/histogram_stats.py +0 -88
  213. blaxel/core/client/models/integration_model.py +0 -162
  214. blaxel/core/client/models/job_execution_config.py +0 -79
  215. blaxel/core/client/models/job_metrics.py +0 -262
  216. blaxel/core/client/models/jobs_chart_value.py +0 -70
  217. blaxel/core/client/models/jobs_network_chart.py +0 -102
  218. blaxel/core/client/models/jobs_success_failed_chart.py +0 -147
  219. blaxel/core/client/models/jobs_total.py +0 -88
  220. blaxel/core/client/models/last_n_requests_metric.py +0 -97
  221. blaxel/core/client/models/latency_metric.py +0 -148
  222. blaxel/core/client/models/logs_response.py +0 -63
  223. blaxel/core/client/models/logs_response_data.py +0 -99
  224. blaxel/core/client/models/mcp_definition_form.py +0 -45
  225. blaxel/core/client/models/memory_allocation_by_name.py +0 -70
  226. blaxel/core/client/models/memory_allocation_metric.py +0 -61
  227. blaxel/core/client/models/metric.py +0 -79
  228. blaxel/core/client/models/metrics.py +0 -273
  229. blaxel/core/client/models/metrics_models.py +0 -45
  230. blaxel/core/client/models/metrics_rps_per_code.py +0 -45
  231. blaxel/core/client/models/pod_template_spec.py +0 -45
  232. blaxel/core/client/models/request_duration_over_time_metric.py +0 -97
  233. blaxel/core/client/models/request_duration_over_time_metrics.py +0 -84
  234. blaxel/core/client/models/request_total_by_origin_metric.py +0 -129
  235. blaxel/core/client/models/request_total_by_origin_metric_request_total_by_origin.py +0 -45
  236. blaxel/core/client/models/request_total_by_origin_metric_request_total_by_origin_and_code.py +0 -45
  237. blaxel/core/client/models/request_total_metric.py +0 -155
  238. blaxel/core/client/models/request_total_metric_request_total_per_code.py +0 -45
  239. blaxel/core/client/models/request_total_metric_rps_per_code.py +0 -45
  240. blaxel/core/client/models/request_total_response_data.py +0 -97
  241. blaxel/core/client/models/resource.py +0 -99
  242. blaxel/core/client/models/resource_log.py +0 -88
  243. blaxel/core/client/models/resource_log_chart.py +0 -133
  244. blaxel/core/client/models/resource_log_response.py +0 -83
  245. blaxel/core/client/models/resource_metrics.py +0 -618
  246. blaxel/core/client/models/resource_metrics_request_total_per_code.py +0 -45
  247. blaxel/core/client/models/resource_metrics_request_total_per_code_previous.py +0 -45
  248. blaxel/core/client/models/resource_metrics_rps_per_code.py +0 -45
  249. blaxel/core/client/models/resource_metrics_rps_per_code_previous.py +0 -45
  250. blaxel/core/client/models/resource_trace.py +0 -97
  251. blaxel/core/client/models/runtime.py +0 -317
  252. blaxel/core/client/models/runtime_configuration.py +0 -45
  253. blaxel/core/client/models/runtime_startup_probe.py +0 -45
  254. blaxel/core/client/models/sandbox_metrics.py +0 -88
  255. blaxel/core/client/models/serverless_config.py +0 -117
  256. blaxel/core/client/models/serverless_config_configuration.py +0 -45
  257. blaxel/core/client/models/start_sandbox.py +0 -98
  258. blaxel/core/client/models/stop_sandbox.py +0 -98
  259. blaxel/core/client/models/store_agent.py +0 -181
  260. blaxel/core/client/models/store_agent_labels.py +0 -45
  261. blaxel/core/client/models/store_configuration.py +0 -156
  262. blaxel/core/client/models/store_configuration_option.py +0 -79
  263. blaxel/core/client/models/time_to_first_token_over_time_metrics.py +0 -87
  264. blaxel/core/client/models/token_rate_metric.py +0 -106
  265. blaxel/core/client/models/token_rate_metrics.py +0 -124
  266. blaxel/core/client/models/token_total_metric.py +0 -112
  267. blaxel/core/client/models/trace_ids_response.py +0 -45
  268. blaxel/core/client/models/websocket_channel.py +0 -97
  269. blaxel/core/client/models/websocket_message.py +0 -106
  270. blaxel/core/sandbox/client/api/root/delete.py +0 -130
  271. blaxel/core/sandbox/client/api/root/get.py +0 -130
  272. blaxel/core/sandbox/client/api/root/options.py +0 -130
  273. blaxel/core/sandbox/client/api/root/patch.py +0 -130
  274. blaxel/core/sandbox/client/api/root/post.py +0 -130
  275. blaxel/core/sandbox/client/api/root/put.py +0 -130
  276. /blaxel/core/{sandbox/client/api/root → client/api/mcphub}/__init__.py +0 -0
  277. {blaxel-0.2.33.dist-info → blaxel-0.2.35.dist-info}/WHEEL +0 -0
  278. {blaxel-0.2.33.dist-info → blaxel-0.2.35.dist-info}/licenses/LICENSE +0 -0
@@ -3,6 +3,7 @@ from typing import TYPE_CHECKING, Any, TypeVar, Union
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
+ from ..models.status import Status
6
7
  from ..types import UNSET, Unset
7
8
 
8
9
  if TYPE_CHECKING:
@@ -16,22 +17,35 @@ T = TypeVar("T", bound="Function")
16
17
 
17
18
  @_attrs_define
18
19
  class Function:
19
- """Function
20
-
21
- Attributes:
22
- events (Union[Unset, list['CoreEvent']]): Core events
23
- metadata (Union[Unset, Metadata]): Metadata
24
- spec (Union[Unset, FunctionSpec]): Function specification
25
- status (Union[Unset, str]): Function status
20
+ """MCP server deployment that exposes tools for AI agents via the Model Context Protocol (MCP). Deployed as a
21
+ serverless auto-scaling endpoint using streamable HTTP transport.
22
+
23
+ Attributes:
24
+ metadata (Metadata): Common metadata fields shared by all Blaxel resources including name, labels, timestamps,
25
+ and ownership information
26
+ spec (FunctionSpec): Configuration for an MCP server function including runtime settings, transport protocol,
27
+ and connected integrations
28
+ events (Union[Unset, list['CoreEvent']]): Events happening on a resource deployed on Blaxel
29
+ status (Union[Unset, Status]): Deployment status of a resource deployed on Blaxel
26
30
  """
27
31
 
32
+ metadata: "Metadata"
33
+ spec: "FunctionSpec"
28
34
  events: Union[Unset, list["CoreEvent"]] = UNSET
29
- metadata: Union[Unset, "Metadata"] = UNSET
30
- spec: Union[Unset, "FunctionSpec"] = UNSET
31
- status: Union[Unset, str] = UNSET
35
+ status: Union[Unset, Status] = UNSET
32
36
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
37
 
34
38
  def to_dict(self) -> dict[str, Any]:
39
+ if type(self.metadata) is dict:
40
+ metadata = self.metadata
41
+ else:
42
+ metadata = self.metadata.to_dict()
43
+
44
+ if type(self.spec) is dict:
45
+ spec = self.spec
46
+ else:
47
+ spec = self.spec.to_dict()
48
+
35
49
  events: Union[Unset, list[dict[str, Any]]] = UNSET
36
50
  if not isinstance(self.events, Unset):
37
51
  events = []
@@ -44,33 +58,20 @@ class Function:
44
58
  )
45
59
  events.append(componentsschemas_core_events_item)
46
60
 
47
- metadata: Union[Unset, dict[str, Any]] = UNSET
48
- if (
49
- self.metadata
50
- and not isinstance(self.metadata, Unset)
51
- and not isinstance(self.metadata, dict)
52
- ):
53
- metadata = self.metadata.to_dict()
54
- elif self.metadata and isinstance(self.metadata, dict):
55
- metadata = self.metadata
56
-
57
- spec: Union[Unset, dict[str, Any]] = UNSET
58
- if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
59
- spec = self.spec.to_dict()
60
- elif self.spec and isinstance(self.spec, dict):
61
- spec = self.spec
62
-
63
- status = self.status
61
+ status: Union[Unset, str] = UNSET
62
+ if not isinstance(self.status, Unset):
63
+ status = self.status.value
64
64
 
65
65
  field_dict: dict[str, Any] = {}
66
66
  field_dict.update(self.additional_properties)
67
- field_dict.update({})
67
+ field_dict.update(
68
+ {
69
+ "metadata": metadata,
70
+ "spec": spec,
71
+ }
72
+ )
68
73
  if events is not UNSET:
69
74
  field_dict["events"] = events
70
- if metadata is not UNSET:
71
- field_dict["metadata"] = metadata
72
- if spec is not UNSET:
73
- field_dict["spec"] = spec
74
75
  if status is not UNSET:
75
76
  field_dict["status"] = status
76
77
 
@@ -85,6 +86,10 @@ class Function:
85
86
  if not src_dict:
86
87
  return None
87
88
  d = src_dict.copy()
89
+ metadata = Metadata.from_dict(d.pop("metadata"))
90
+
91
+ spec = FunctionSpec.from_dict(d.pop("spec"))
92
+
88
93
  events = []
89
94
  _events = d.pop("events", UNSET)
90
95
  for componentsschemas_core_events_item_data in _events or []:
@@ -94,26 +99,17 @@ class Function:
94
99
 
95
100
  events.append(componentsschemas_core_events_item)
96
101
 
97
- _metadata = d.pop("metadata", UNSET)
98
- metadata: Union[Unset, Metadata]
99
- if isinstance(_metadata, Unset):
100
- metadata = UNSET
102
+ _status = d.pop("status", UNSET)
103
+ status: Union[Unset, Status]
104
+ if isinstance(_status, Unset):
105
+ status = UNSET
101
106
  else:
102
- metadata = Metadata.from_dict(_metadata)
103
-
104
- _spec = d.pop("spec", UNSET)
105
- spec: Union[Unset, FunctionSpec]
106
- if isinstance(_spec, Unset):
107
- spec = UNSET
108
- else:
109
- spec = FunctionSpec.from_dict(_spec)
110
-
111
- status = d.pop("status", UNSET)
107
+ status = Status(_status)
112
108
 
113
109
  function = cls(
114
- events=events,
115
110
  metadata=metadata,
116
111
  spec=spec,
112
+ events=events,
117
113
  status=status,
118
114
  )
119
115
 
@@ -0,0 +1,138 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..models.function_runtime_generation import FunctionRuntimeGeneration
7
+ from ..types import UNSET, Unset
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.env import Env
11
+
12
+
13
+ T = TypeVar("T", bound="FunctionRuntime")
14
+
15
+
16
+ @_attrs_define
17
+ class FunctionRuntime:
18
+ """Runtime configuration defining how the MCP server function is deployed and scaled
19
+
20
+ Attributes:
21
+ envs (Union[Unset, list['Env']]): Environment variables injected into the function. Supports Kubernetes EnvVar
22
+ format with valueFrom references.
23
+ generation (Union[Unset, FunctionRuntimeGeneration]): Infrastructure generation: mk2 (containers, 2-10s cold
24
+ starts, 15+ global regions) or mk3 (microVMs, sub-25ms cold starts) Example: mk3.
25
+ image (Union[Unset, str]): Container image built by Blaxel when deploying with 'bl deploy'. This field is auto-
26
+ populated during deployment.
27
+ max_scale (Union[Unset, int]): Maximum number of concurrent function instances for auto-scaling Example: 10.
28
+ memory (Union[Unset, int]): Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory
29
+ in MB / 2048, e.g., 4096MB = 2 CPUs). Example: 2048.
30
+ min_scale (Union[Unset, int]): Minimum instances to keep warm. Set to 1+ to eliminate cold starts, 0 for scale-
31
+ to-zero.
32
+ """
33
+
34
+ envs: Union[Unset, list["Env"]] = UNSET
35
+ generation: Union[Unset, FunctionRuntimeGeneration] = UNSET
36
+ image: Union[Unset, str] = UNSET
37
+ max_scale: Union[Unset, int] = UNSET
38
+ memory: Union[Unset, int] = UNSET
39
+ min_scale: Union[Unset, int] = UNSET
40
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ envs: Union[Unset, list[dict[str, Any]]] = UNSET
44
+ if not isinstance(self.envs, Unset):
45
+ envs = []
46
+ for envs_item_data in self.envs:
47
+ if type(envs_item_data) is dict:
48
+ envs_item = envs_item_data
49
+ else:
50
+ envs_item = envs_item_data.to_dict()
51
+ envs.append(envs_item)
52
+
53
+ generation: Union[Unset, str] = UNSET
54
+ if not isinstance(self.generation, Unset):
55
+ generation = self.generation.value
56
+
57
+ image = self.image
58
+
59
+ max_scale = self.max_scale
60
+
61
+ memory = self.memory
62
+
63
+ min_scale = self.min_scale
64
+
65
+ field_dict: dict[str, Any] = {}
66
+ field_dict.update(self.additional_properties)
67
+ field_dict.update({})
68
+ if envs is not UNSET:
69
+ field_dict["envs"] = envs
70
+ if generation is not UNSET:
71
+ field_dict["generation"] = generation
72
+ if image is not UNSET:
73
+ field_dict["image"] = image
74
+ if max_scale is not UNSET:
75
+ field_dict["maxScale"] = max_scale
76
+ if memory is not UNSET:
77
+ field_dict["memory"] = memory
78
+ if min_scale is not UNSET:
79
+ field_dict["minScale"] = min_scale
80
+
81
+ return field_dict
82
+
83
+ @classmethod
84
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None:
85
+ from ..models.env import Env
86
+
87
+ if not src_dict:
88
+ return None
89
+ d = src_dict.copy()
90
+ envs = []
91
+ _envs = d.pop("envs", UNSET)
92
+ for envs_item_data in _envs or []:
93
+ envs_item = Env.from_dict(envs_item_data)
94
+
95
+ envs.append(envs_item)
96
+
97
+ _generation = d.pop("generation", UNSET)
98
+ generation: Union[Unset, FunctionRuntimeGeneration]
99
+ if isinstance(_generation, Unset):
100
+ generation = UNSET
101
+ else:
102
+ generation = FunctionRuntimeGeneration(_generation)
103
+
104
+ image = d.pop("image", UNSET)
105
+
106
+ max_scale = d.pop("maxScale", d.pop("max_scale", UNSET))
107
+
108
+ memory = d.pop("memory", UNSET)
109
+
110
+ min_scale = d.pop("minScale", d.pop("min_scale", UNSET))
111
+
112
+ function_runtime = cls(
113
+ envs=envs,
114
+ generation=generation,
115
+ image=image,
116
+ max_scale=max_scale,
117
+ memory=memory,
118
+ min_scale=min_scale,
119
+ )
120
+
121
+ function_runtime.additional_properties = d
122
+ return function_runtime
123
+
124
+ @property
125
+ def additional_keys(self) -> list[str]:
126
+ return list(self.additional_properties.keys())
127
+
128
+ def __getitem__(self, key: str) -> Any:
129
+ return self.additional_properties[key]
130
+
131
+ def __setitem__(self, key: str, value: Any) -> None:
132
+ self.additional_properties[key] = value
133
+
134
+ def __delitem__(self, key: str) -> None:
135
+ del self.additional_properties[key]
136
+
137
+ def __contains__(self, key: str) -> bool:
138
+ return key in self.additional_properties
@@ -0,0 +1,18 @@
1
+ from enum import Enum
2
+
3
+
4
+ class FunctionRuntimeGeneration(str, Enum):
5
+ MK2 = "mk2"
6
+ MK3 = "mk3"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
10
+
11
+ @classmethod
12
+ def _missing_(cls, value: object) -> "FunctionRuntimeGeneration | None":
13
+ if isinstance(value, str):
14
+ upper_value = value.upper()
15
+ for member in cls:
16
+ if member.value.upper() == upper_value:
17
+ return member
18
+ return None
@@ -3,13 +3,12 @@ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
+ from ..models.function_spec_transport import FunctionSpecTransport
6
7
  from ..types import UNSET, Unset
7
8
 
8
9
  if TYPE_CHECKING:
9
- from ..models.core_spec_configurations import CoreSpecConfigurations
10
- from ..models.flavor import Flavor
10
+ from ..models.function_runtime import FunctionRuntime
11
11
  from ..models.revision_configuration import RevisionConfiguration
12
- from ..models.runtime import Runtime
13
12
  from ..models.trigger import Trigger
14
13
 
15
14
 
@@ -18,56 +17,33 @@ T = TypeVar("T", bound="FunctionSpec")
18
17
 
19
18
  @_attrs_define
20
19
  class FunctionSpec:
21
- """Function specification
20
+ """Configuration for an MCP server function including runtime settings, transport protocol, and connected integrations
22
21
 
23
22
  Attributes:
24
- configurations (Union[Unset, CoreSpecConfigurations]): Optional configurations for the object
25
- enabled (Union[Unset, bool]): Enable or disable the resource
26
- flavors (Union[Unset, list['Flavor']]): Types of hardware available for deployments
23
+ enabled (Union[Unset, bool]): When false, the function is disabled and will not serve requests Default: True.
24
+ Example: True.
27
25
  integration_connections (Union[Unset, list[str]]):
28
26
  policies (Union[Unset, list[str]]):
29
27
  revision (Union[Unset, RevisionConfiguration]): Revision configuration
30
- runtime (Union[Unset, Runtime]): Set of configurations for a deployment
31
- sandbox (Union[Unset, bool]): Sandbox mode
32
- description (Union[Unset, str]): Function description, very important for the agent function to work with an LLM
28
+ runtime (Union[Unset, FunctionRuntime]): Runtime configuration defining how the MCP server function is deployed
29
+ and scaled
30
+ transport (Union[Unset, FunctionSpecTransport]): Transport compatibility for the MCP, can be "websocket" or
31
+ "http-stream" Example: http-stream.
33
32
  triggers (Union[Unset, list['Trigger']]): Triggers to use your agent
34
33
  """
35
34
 
36
- configurations: Union[Unset, "CoreSpecConfigurations"] = UNSET
37
- enabled: Union[Unset, bool] = UNSET
38
- flavors: Union[Unset, list["Flavor"]] = UNSET
35
+ enabled: Union[Unset, bool] = True
39
36
  integration_connections: Union[Unset, list[str]] = UNSET
40
37
  policies: Union[Unset, list[str]] = UNSET
41
38
  revision: Union[Unset, "RevisionConfiguration"] = UNSET
42
- runtime: Union[Unset, "Runtime"] = UNSET
43
- sandbox: Union[Unset, bool] = UNSET
44
- description: Union[Unset, str] = UNSET
39
+ runtime: Union[Unset, "FunctionRuntime"] = UNSET
40
+ transport: Union[Unset, FunctionSpecTransport] = UNSET
45
41
  triggers: Union[Unset, list["Trigger"]] = UNSET
46
42
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
47
43
 
48
44
  def to_dict(self) -> dict[str, Any]:
49
- configurations: Union[Unset, dict[str, Any]] = UNSET
50
- if (
51
- self.configurations
52
- and not isinstance(self.configurations, Unset)
53
- and not isinstance(self.configurations, dict)
54
- ):
55
- configurations = self.configurations.to_dict()
56
- elif self.configurations and isinstance(self.configurations, dict):
57
- configurations = self.configurations
58
-
59
45
  enabled = self.enabled
60
46
 
61
- flavors: Union[Unset, list[dict[str, Any]]] = UNSET
62
- if not isinstance(self.flavors, Unset):
63
- flavors = []
64
- for componentsschemas_flavors_item_data in self.flavors:
65
- if type(componentsschemas_flavors_item_data) is dict:
66
- componentsschemas_flavors_item = componentsschemas_flavors_item_data
67
- else:
68
- componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
69
- flavors.append(componentsschemas_flavors_item)
70
-
71
47
  integration_connections: Union[Unset, list[str]] = UNSET
72
48
  if not isinstance(self.integration_connections, Unset):
73
49
  integration_connections = self.integration_connections
@@ -96,9 +72,9 @@ class FunctionSpec:
96
72
  elif self.runtime and isinstance(self.runtime, dict):
97
73
  runtime = self.runtime
98
74
 
99
- sandbox = self.sandbox
100
-
101
- description = self.description
75
+ transport: Union[Unset, str] = UNSET
76
+ if not isinstance(self.transport, Unset):
77
+ transport = self.transport.value
102
78
 
103
79
  triggers: Union[Unset, list[dict[str, Any]]] = UNSET
104
80
  if not isinstance(self.triggers, Unset):
@@ -113,12 +89,8 @@ class FunctionSpec:
113
89
  field_dict: dict[str, Any] = {}
114
90
  field_dict.update(self.additional_properties)
115
91
  field_dict.update({})
116
- if configurations is not UNSET:
117
- field_dict["configurations"] = configurations
118
92
  if enabled is not UNSET:
119
93
  field_dict["enabled"] = enabled
120
- if flavors is not UNSET:
121
- field_dict["flavors"] = flavors
122
94
  if integration_connections is not UNSET:
123
95
  field_dict["integrationConnections"] = integration_connections
124
96
  if policies is not UNSET:
@@ -127,10 +99,8 @@ class FunctionSpec:
127
99
  field_dict["revision"] = revision
128
100
  if runtime is not UNSET:
129
101
  field_dict["runtime"] = runtime
130
- if sandbox is not UNSET:
131
- field_dict["sandbox"] = sandbox
132
- if description is not UNSET:
133
- field_dict["description"] = description
102
+ if transport is not UNSET:
103
+ field_dict["transport"] = transport
134
104
  if triggers is not UNSET:
135
105
  field_dict["triggers"] = triggers
136
106
 
@@ -138,31 +108,15 @@ class FunctionSpec:
138
108
 
139
109
  @classmethod
140
110
  def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T | None:
141
- from ..models.core_spec_configurations import CoreSpecConfigurations
142
- from ..models.flavor import Flavor
111
+ from ..models.function_runtime import FunctionRuntime
143
112
  from ..models.revision_configuration import RevisionConfiguration
144
- from ..models.runtime import Runtime
145
113
  from ..models.trigger import Trigger
146
114
 
147
115
  if not src_dict:
148
116
  return None
149
117
  d = src_dict.copy()
150
- _configurations = d.pop("configurations", UNSET)
151
- configurations: Union[Unset, CoreSpecConfigurations]
152
- if isinstance(_configurations, Unset):
153
- configurations = UNSET
154
- else:
155
- configurations = CoreSpecConfigurations.from_dict(_configurations)
156
-
157
118
  enabled = d.pop("enabled", UNSET)
158
119
 
159
- flavors = []
160
- _flavors = d.pop("flavors", UNSET)
161
- for componentsschemas_flavors_item_data in _flavors or []:
162
- componentsschemas_flavors_item = Flavor.from_dict(componentsschemas_flavors_item_data)
163
-
164
- flavors.append(componentsschemas_flavors_item)
165
-
166
120
  integration_connections = cast(
167
121
  list[str], d.pop("integrationConnections", d.pop("integration_connections", UNSET))
168
122
  )
@@ -177,15 +131,18 @@ class FunctionSpec:
177
131
  revision = RevisionConfiguration.from_dict(_revision)
178
132
 
179
133
  _runtime = d.pop("runtime", UNSET)
180
- runtime: Union[Unset, Runtime]
134
+ runtime: Union[Unset, FunctionRuntime]
181
135
  if isinstance(_runtime, Unset):
182
136
  runtime = UNSET
183
137
  else:
184
- runtime = Runtime.from_dict(_runtime)
185
-
186
- sandbox = d.pop("sandbox", UNSET)
138
+ runtime = FunctionRuntime.from_dict(_runtime)
187
139
 
188
- description = d.pop("description", UNSET)
140
+ _transport = d.pop("transport", UNSET)
141
+ transport: Union[Unset, FunctionSpecTransport]
142
+ if isinstance(_transport, Unset):
143
+ transport = UNSET
144
+ else:
145
+ transport = FunctionSpecTransport(_transport)
189
146
 
190
147
  triggers = []
191
148
  _triggers = d.pop("triggers", UNSET)
@@ -197,15 +154,12 @@ class FunctionSpec:
197
154
  triggers.append(componentsschemas_triggers_item)
198
155
 
199
156
  function_spec = cls(
200
- configurations=configurations,
201
157
  enabled=enabled,
202
- flavors=flavors,
203
158
  integration_connections=integration_connections,
204
159
  policies=policies,
205
160
  revision=revision,
206
161
  runtime=runtime,
207
- sandbox=sandbox,
208
- description=description,
162
+ transport=transport,
209
163
  triggers=triggers,
210
164
  )
211
165
 
@@ -0,0 +1,18 @@
1
+ from enum import Enum
2
+
3
+
4
+ class FunctionSpecTransport(str, Enum):
5
+ HTTP_STREAM = "http-stream"
6
+ WEBSOCKET = "websocket"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
10
+
11
+ @classmethod
12
+ def _missing_(cls, value: object) -> "FunctionSpecTransport | None":
13
+ if isinstance(value, str):
14
+ upper_value = value.upper()
15
+ for member in cls:
16
+ if member.value.upper() == upper_value:
17
+ return member
18
+ return None
@@ -1,10 +1,8 @@
1
- from typing import TYPE_CHECKING, Any, TypeVar, Union
1
+ from typing import TYPE_CHECKING, Any, TypeVar
2
2
 
3
3
  from attrs import define as _attrs_define
4
4
  from attrs import field as _attrs_field
5
5
 
6
- from ..types import UNSET, Unset
7
-
8
6
  if TYPE_CHECKING:
9
7
  from ..models.image_metadata import ImageMetadata
10
8
  from ..models.image_spec import ImageSpec
@@ -17,38 +15,33 @@ T = TypeVar("T", bound="Image")
17
15
  class Image:
18
16
  """
19
17
  Attributes:
20
- metadata (Union[Unset, ImageMetadata]):
21
- spec (Union[Unset, ImageSpec]):
18
+ metadata (ImageMetadata):
19
+ spec (ImageSpec):
22
20
  """
23
21
 
24
- metadata: Union[Unset, "ImageMetadata"] = UNSET
25
- spec: Union[Unset, "ImageSpec"] = UNSET
22
+ metadata: "ImageMetadata"
23
+ spec: "ImageSpec"
26
24
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
25
 
28
26
  def to_dict(self) -> dict[str, Any]:
29
- metadata: Union[Unset, dict[str, Any]] = UNSET
30
- if (
31
- self.metadata
32
- and not isinstance(self.metadata, Unset)
33
- and not isinstance(self.metadata, dict)
34
- ):
35
- metadata = self.metadata.to_dict()
36
- elif self.metadata and isinstance(self.metadata, dict):
27
+ if type(self.metadata) is dict:
37
28
  metadata = self.metadata
29
+ else:
30
+ metadata = self.metadata.to_dict()
38
31
 
39
- spec: Union[Unset, dict[str, Any]] = UNSET
40
- if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
41
- spec = self.spec.to_dict()
42
- elif self.spec and isinstance(self.spec, dict):
32
+ if type(self.spec) is dict:
43
33
  spec = self.spec
34
+ else:
35
+ spec = self.spec.to_dict()
44
36
 
45
37
  field_dict: dict[str, Any] = {}
46
38
  field_dict.update(self.additional_properties)
47
- field_dict.update({})
48
- if metadata is not UNSET:
49
- field_dict["metadata"] = metadata
50
- if spec is not UNSET:
51
- field_dict["spec"] = spec
39
+ field_dict.update(
40
+ {
41
+ "metadata": metadata,
42
+ "spec": spec,
43
+ }
44
+ )
52
45
 
53
46
  return field_dict
54
47
 
@@ -60,19 +53,9 @@ class Image:
60
53
  if not src_dict:
61
54
  return None
62
55
  d = src_dict.copy()
63
- _metadata = d.pop("metadata", UNSET)
64
- metadata: Union[Unset, ImageMetadata]
65
- if isinstance(_metadata, Unset):
66
- metadata = UNSET
67
- else:
68
- metadata = ImageMetadata.from_dict(_metadata)
56
+ metadata = ImageMetadata.from_dict(d.pop("metadata"))
69
57
 
70
- _spec = d.pop("spec", UNSET)
71
- spec: Union[Unset, ImageSpec]
72
- if isinstance(_spec, Unset):
73
- spec = UNSET
74
- else:
75
- spec = ImageSpec.from_dict(_spec)
58
+ spec = ImageSpec.from_dict(d.pop("spec"))
76
59
 
77
60
  image = cls(
78
61
  metadata=metadata,