blaxel 0.1.9rc35__py3-none-any.whl → 0.1.9rc37__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 (61) hide show
  1. blaxel/agents/__init__.py +53 -16
  2. blaxel/authentication/__init__.py +3 -4
  3. blaxel/client/api/compute/__init__.py +0 -0
  4. blaxel/client/api/compute/create_sandbox.py +166 -0
  5. blaxel/client/api/compute/delete_sandbox.py +154 -0
  6. blaxel/client/api/compute/get_sandbox.py +154 -0
  7. blaxel/client/api/compute/list_sandboxes.py +135 -0
  8. blaxel/client/api/compute/start_sandbox.py +157 -0
  9. blaxel/client/api/compute/stop_sandbox.py +157 -0
  10. blaxel/client/api/compute/update_sandbox.py +179 -0
  11. blaxel/client/api/default/list_sandbox_hub_definitions.py +123 -0
  12. blaxel/client/api/functions/list_function_revisions.py +16 -11
  13. blaxel/client/api/knowledgebases/list_knowledgebase_revisions.py +16 -11
  14. blaxel/client/api/models/list_model_revisions.py +16 -11
  15. blaxel/client/api/templates/list_templates.py +16 -11
  16. blaxel/client/models/__init__.py +32 -2
  17. blaxel/client/models/agent_spec.py +25 -69
  18. blaxel/client/models/core_spec.py +1 -45
  19. blaxel/client/models/function_spec.py +1 -45
  20. blaxel/client/models/last_n_requests_metric.py +18 -0
  21. blaxel/client/models/metrics.py +20 -0
  22. blaxel/client/models/model_spec.py +1 -45
  23. blaxel/client/models/{agent_chain.py → port.py} +23 -32
  24. blaxel/client/models/request_total_metric.py +12 -1
  25. blaxel/client/models/request_total_response_data.py +97 -0
  26. blaxel/client/models/resource_log.py +9 -0
  27. blaxel/client/models/resource_metrics.py +144 -0
  28. blaxel/client/models/resource_metrics_request_total_per_code_previous.py +45 -0
  29. blaxel/client/models/resource_metrics_rps_per_code_previous.py +45 -0
  30. blaxel/client/models/runtime.py +83 -7
  31. blaxel/client/models/runtime_configuration.py +45 -0
  32. blaxel/client/models/sandbox.py +129 -0
  33. blaxel/client/models/sandbox_definition.py +181 -0
  34. blaxel/client/models/sandbox_spec.py +208 -0
  35. blaxel/client/models/sandboxes.py +129 -0
  36. blaxel/client/models/serverless_config.py +29 -1
  37. blaxel/client/models/serverless_config_configuration.py +45 -0
  38. blaxel/client/models/start_sandbox.py +94 -0
  39. blaxel/client/models/stop_sandbox.py +94 -0
  40. blaxel/client/models/trigger.py +98 -0
  41. blaxel/client/models/trigger_configuration.py +45 -0
  42. blaxel/client/models/workspace.py +20 -0
  43. blaxel/client/models/workspace_runtime.py +61 -0
  44. blaxel/common/autoload.py +0 -4
  45. blaxel/common/internal.py +75 -0
  46. blaxel/common/settings.py +6 -1
  47. blaxel/instrumentation/exporters.py +3 -6
  48. blaxel/instrumentation/manager.py +5 -3
  49. blaxel/mcp/client.py +1 -3
  50. blaxel/mcp/server.py +4 -4
  51. blaxel/models/__init__.py +2 -1
  52. blaxel/models/custom/langchain/gemini.py +41 -18
  53. blaxel/models/custom/llamaindex/cohere.py +25 -16
  54. blaxel/models/custom/pydantic/gemini.py +0 -1
  55. blaxel/models/livekit.py +1 -1
  56. blaxel/tools/__init__.py +63 -22
  57. blaxel/tools/langchain.py +1 -2
  58. {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc37.dist-info}/METADATA +1 -4
  59. {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc37.dist-info}/RECORD +61 -37
  60. {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc37.dist-info}/WHEEL +0 -0
  61. {blaxel-0.1.9rc35.dist-info → blaxel-0.1.9rc37.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,129 @@
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 ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.core_event import CoreEvent
10
+ from ..models.metadata import Metadata
11
+ from ..models.sandbox_spec import SandboxSpec
12
+
13
+
14
+ T = TypeVar("T", bound="Sandbox")
15
+
16
+
17
+ @_attrs_define
18
+ class Sandbox:
19
+ """Micro VM for running agentic tasks
20
+
21
+ Attributes:
22
+ events (Union[Unset, list['CoreEvent']]): Core events
23
+ metadata (Union[Unset, Metadata]): Metadata
24
+ spec (Union[Unset, SandboxSpec]): Sandbox specification
25
+ status (Union[Unset, str]): Sandbox status
26
+ """
27
+
28
+ events: Union[Unset, list["CoreEvent"]] = UNSET
29
+ metadata: Union[Unset, "Metadata"] = UNSET
30
+ spec: Union[Unset, "SandboxSpec"] = UNSET
31
+ status: Union[Unset, str] = UNSET
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ events: Union[Unset, list[dict[str, Any]]] = UNSET
36
+ if not isinstance(self.events, Unset):
37
+ events = []
38
+ for componentsschemas_core_events_item_data in self.events:
39
+ if type(componentsschemas_core_events_item_data) == dict:
40
+ componentsschemas_core_events_item = componentsschemas_core_events_item_data
41
+ else:
42
+ componentsschemas_core_events_item = componentsschemas_core_events_item_data.to_dict()
43
+ events.append(componentsschemas_core_events_item)
44
+
45
+ metadata: Union[Unset, dict[str, Any]] = UNSET
46
+ if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
47
+ metadata = self.metadata.to_dict()
48
+ elif self.metadata and isinstance(self.metadata, dict):
49
+ metadata = self.metadata
50
+
51
+ spec: Union[Unset, dict[str, Any]] = UNSET
52
+ if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
53
+ spec = self.spec.to_dict()
54
+ elif self.spec and isinstance(self.spec, dict):
55
+ spec = self.spec
56
+
57
+ status = self.status
58
+
59
+ field_dict: dict[str, Any] = {}
60
+ field_dict.update(self.additional_properties)
61
+ field_dict.update({})
62
+ if events is not UNSET:
63
+ field_dict["events"] = events
64
+ if metadata is not UNSET:
65
+ field_dict["metadata"] = metadata
66
+ if spec is not UNSET:
67
+ field_dict["spec"] = spec
68
+ if status is not UNSET:
69
+ field_dict["status"] = status
70
+
71
+ return field_dict
72
+
73
+ @classmethod
74
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
75
+ from ..models.core_event import CoreEvent
76
+ from ..models.metadata import Metadata
77
+ from ..models.sandbox_spec import SandboxSpec
78
+
79
+ if not src_dict:
80
+ return None
81
+ d = src_dict.copy()
82
+ events = []
83
+ _events = d.pop("events", UNSET)
84
+ for componentsschemas_core_events_item_data in _events or []:
85
+ componentsschemas_core_events_item = CoreEvent.from_dict(componentsschemas_core_events_item_data)
86
+
87
+ events.append(componentsschemas_core_events_item)
88
+
89
+ _metadata = d.pop("metadata", UNSET)
90
+ metadata: Union[Unset, Metadata]
91
+ if isinstance(_metadata, Unset):
92
+ metadata = UNSET
93
+ else:
94
+ metadata = Metadata.from_dict(_metadata)
95
+
96
+ _spec = d.pop("spec", UNSET)
97
+ spec: Union[Unset, SandboxSpec]
98
+ if isinstance(_spec, Unset):
99
+ spec = UNSET
100
+ else:
101
+ spec = SandboxSpec.from_dict(_spec)
102
+
103
+ status = d.pop("status", UNSET)
104
+
105
+ sandbox = cls(
106
+ events=events,
107
+ metadata=metadata,
108
+ spec=spec,
109
+ status=status,
110
+ )
111
+
112
+ sandbox.additional_properties = d
113
+ return sandbox
114
+
115
+ @property
116
+ def additional_keys(self) -> list[str]:
117
+ return list(self.additional_properties.keys())
118
+
119
+ def __getitem__(self, key: str) -> Any:
120
+ return self.additional_properties[key]
121
+
122
+ def __setitem__(self, key: str, value: Any) -> None:
123
+ self.additional_properties[key] = value
124
+
125
+ def __delitem__(self, key: str) -> None:
126
+ del self.additional_properties[key]
127
+
128
+ def __contains__(self, key: str) -> bool:
129
+ return key in self.additional_properties
@@ -0,0 +1,181 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.port import Port
10
+
11
+
12
+ T = TypeVar("T", bound="SandboxDefinition")
13
+
14
+
15
+ @_attrs_define
16
+ class SandboxDefinition:
17
+ """Sandbox definition for admin store operations
18
+
19
+ Attributes:
20
+ categories (Union[Unset, list[Any]]): Categories of the defintion
21
+ coming_soon (Union[Unset, bool]): If the definition is coming soon
22
+ description (Union[Unset, str]): Description of the defintion
23
+ display_name (Union[Unset, str]): Display name of the definition
24
+ enterprise (Union[Unset, bool]): If the definition is enterprise
25
+ icon (Union[Unset, str]): Icon of the definition
26
+ image (Union[Unset, str]): Image of the Sandbox definition
27
+ long_description (Union[Unset, str]): Long description of the defintion
28
+ memory (Union[Unset, int]): Memory of the Sandbox definition in MB
29
+ name (Union[Unset, str]): Name of the artifact
30
+ ports (Union[Unset, list['Port']]): Set of ports for a resource
31
+ url (Union[Unset, str]): URL of the definition
32
+ """
33
+
34
+ categories: Union[Unset, list[Any]] = UNSET
35
+ coming_soon: Union[Unset, bool] = UNSET
36
+ description: Union[Unset, str] = UNSET
37
+ display_name: Union[Unset, str] = UNSET
38
+ enterprise: Union[Unset, bool] = UNSET
39
+ icon: Union[Unset, str] = UNSET
40
+ image: Union[Unset, str] = UNSET
41
+ long_description: Union[Unset, str] = UNSET
42
+ memory: Union[Unset, int] = UNSET
43
+ name: Union[Unset, str] = UNSET
44
+ ports: Union[Unset, list["Port"]] = UNSET
45
+ url: Union[Unset, str] = UNSET
46
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
47
+
48
+ def to_dict(self) -> dict[str, Any]:
49
+ categories: Union[Unset, list[Any]] = UNSET
50
+ if not isinstance(self.categories, Unset):
51
+ categories = self.categories
52
+
53
+ coming_soon = self.coming_soon
54
+
55
+ description = self.description
56
+
57
+ display_name = self.display_name
58
+
59
+ enterprise = self.enterprise
60
+
61
+ icon = self.icon
62
+
63
+ image = self.image
64
+
65
+ long_description = self.long_description
66
+
67
+ memory = self.memory
68
+
69
+ name = self.name
70
+
71
+ ports: Union[Unset, list[dict[str, Any]]] = UNSET
72
+ if not isinstance(self.ports, Unset):
73
+ ports = []
74
+ for componentsschemas_ports_item_data in self.ports:
75
+ if type(componentsschemas_ports_item_data) == dict:
76
+ componentsschemas_ports_item = componentsschemas_ports_item_data
77
+ else:
78
+ componentsschemas_ports_item = componentsschemas_ports_item_data.to_dict()
79
+ ports.append(componentsschemas_ports_item)
80
+
81
+ url = self.url
82
+
83
+ field_dict: dict[str, Any] = {}
84
+ field_dict.update(self.additional_properties)
85
+ field_dict.update({})
86
+ if categories is not UNSET:
87
+ field_dict["categories"] = categories
88
+ if coming_soon is not UNSET:
89
+ field_dict["coming_soon"] = coming_soon
90
+ if description is not UNSET:
91
+ field_dict["description"] = description
92
+ if display_name is not UNSET:
93
+ field_dict["displayName"] = display_name
94
+ if enterprise is not UNSET:
95
+ field_dict["enterprise"] = enterprise
96
+ if icon is not UNSET:
97
+ field_dict["icon"] = icon
98
+ if image is not UNSET:
99
+ field_dict["image"] = image
100
+ if long_description is not UNSET:
101
+ field_dict["longDescription"] = long_description
102
+ if memory is not UNSET:
103
+ field_dict["memory"] = memory
104
+ if name is not UNSET:
105
+ field_dict["name"] = name
106
+ if ports is not UNSET:
107
+ field_dict["ports"] = ports
108
+ if url is not UNSET:
109
+ field_dict["url"] = url
110
+
111
+ return field_dict
112
+
113
+ @classmethod
114
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
115
+ from ..models.port import Port
116
+
117
+ if not src_dict:
118
+ return None
119
+ d = src_dict.copy()
120
+ categories = cast(list[Any], d.pop("categories", UNSET))
121
+
122
+ coming_soon = d.pop("coming_soon", UNSET)
123
+
124
+ description = d.pop("description", UNSET)
125
+
126
+ display_name = d.pop("displayName", UNSET)
127
+
128
+ enterprise = d.pop("enterprise", UNSET)
129
+
130
+ icon = d.pop("icon", UNSET)
131
+
132
+ image = d.pop("image", UNSET)
133
+
134
+ long_description = d.pop("longDescription", UNSET)
135
+
136
+ memory = d.pop("memory", UNSET)
137
+
138
+ name = d.pop("name", UNSET)
139
+
140
+ ports = []
141
+ _ports = d.pop("ports", UNSET)
142
+ for componentsschemas_ports_item_data in _ports or []:
143
+ componentsschemas_ports_item = Port.from_dict(componentsschemas_ports_item_data)
144
+
145
+ ports.append(componentsschemas_ports_item)
146
+
147
+ url = d.pop("url", UNSET)
148
+
149
+ sandbox_definition = cls(
150
+ categories=categories,
151
+ coming_soon=coming_soon,
152
+ description=description,
153
+ display_name=display_name,
154
+ enterprise=enterprise,
155
+ icon=icon,
156
+ image=image,
157
+ long_description=long_description,
158
+ memory=memory,
159
+ name=name,
160
+ ports=ports,
161
+ url=url,
162
+ )
163
+
164
+ sandbox_definition.additional_properties = d
165
+ return sandbox_definition
166
+
167
+ @property
168
+ def additional_keys(self) -> list[str]:
169
+ return list(self.additional_properties.keys())
170
+
171
+ def __getitem__(self, key: str) -> Any:
172
+ return self.additional_properties[key]
173
+
174
+ def __setitem__(self, key: str, value: Any) -> None:
175
+ self.additional_properties[key] = value
176
+
177
+ def __delitem__(self, key: str) -> None:
178
+ del self.additional_properties[key]
179
+
180
+ def __contains__(self, key: str) -> bool:
181
+ return key in self.additional_properties
@@ -0,0 +1,208 @@
1
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
+
3
+ from attrs import define as _attrs_define
4
+ from attrs import field as _attrs_field
5
+
6
+ from ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.core_spec_configurations import CoreSpecConfigurations
10
+ from ..models.flavor import Flavor
11
+ from ..models.model_private_cluster import ModelPrivateCluster
12
+ from ..models.revision_configuration import RevisionConfiguration
13
+ from ..models.runtime import Runtime
14
+
15
+
16
+ T = TypeVar("T", bound="SandboxSpec")
17
+
18
+
19
+ @_attrs_define
20
+ class SandboxSpec:
21
+ """Sandbox specification
22
+
23
+ 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
27
+ integration_connections (Union[Unset, list[str]]):
28
+ policies (Union[Unset, list[str]]):
29
+ private_clusters (Union[Unset, ModelPrivateCluster]): Private cluster where the model deployment is deployed
30
+ revision (Union[Unset, RevisionConfiguration]): Revision configuration
31
+ runtime (Union[Unset, Runtime]): Set of configurations for a deployment
32
+ sandbox (Union[Unset, bool]): Sandbox mode
33
+ """
34
+
35
+ configurations: Union[Unset, "CoreSpecConfigurations"] = UNSET
36
+ enabled: Union[Unset, bool] = UNSET
37
+ flavors: Union[Unset, list["Flavor"]] = UNSET
38
+ integration_connections: Union[Unset, list[str]] = UNSET
39
+ policies: Union[Unset, list[str]] = UNSET
40
+ private_clusters: Union[Unset, "ModelPrivateCluster"] = UNSET
41
+ revision: Union[Unset, "RevisionConfiguration"] = UNSET
42
+ runtime: Union[Unset, "Runtime"] = UNSET
43
+ sandbox: Union[Unset, bool] = UNSET
44
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ configurations: Union[Unset, dict[str, Any]] = UNSET
48
+ if (
49
+ self.configurations
50
+ and not isinstance(self.configurations, Unset)
51
+ and not isinstance(self.configurations, dict)
52
+ ):
53
+ configurations = self.configurations.to_dict()
54
+ elif self.configurations and isinstance(self.configurations, dict):
55
+ configurations = self.configurations
56
+
57
+ enabled = self.enabled
58
+
59
+ flavors: Union[Unset, list[dict[str, Any]]] = UNSET
60
+ if not isinstance(self.flavors, Unset):
61
+ flavors = []
62
+ for componentsschemas_flavors_item_data in self.flavors:
63
+ if type(componentsschemas_flavors_item_data) == dict:
64
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data
65
+ else:
66
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
67
+ flavors.append(componentsschemas_flavors_item)
68
+
69
+ integration_connections: Union[Unset, list[str]] = UNSET
70
+ if not isinstance(self.integration_connections, Unset):
71
+ integration_connections = self.integration_connections
72
+
73
+ policies: Union[Unset, list[str]] = UNSET
74
+ if not isinstance(self.policies, Unset):
75
+ policies = self.policies
76
+
77
+ private_clusters: Union[Unset, dict[str, Any]] = UNSET
78
+ if (
79
+ self.private_clusters
80
+ and not isinstance(self.private_clusters, Unset)
81
+ and not isinstance(self.private_clusters, dict)
82
+ ):
83
+ private_clusters = self.private_clusters.to_dict()
84
+ elif self.private_clusters and isinstance(self.private_clusters, dict):
85
+ private_clusters = self.private_clusters
86
+
87
+ revision: Union[Unset, dict[str, Any]] = UNSET
88
+ if self.revision and not isinstance(self.revision, Unset) and not isinstance(self.revision, dict):
89
+ revision = self.revision.to_dict()
90
+ elif self.revision and isinstance(self.revision, dict):
91
+ revision = self.revision
92
+
93
+ runtime: Union[Unset, dict[str, Any]] = UNSET
94
+ if self.runtime and not isinstance(self.runtime, Unset) and not isinstance(self.runtime, dict):
95
+ runtime = self.runtime.to_dict()
96
+ elif self.runtime and isinstance(self.runtime, dict):
97
+ runtime = self.runtime
98
+
99
+ sandbox = self.sandbox
100
+
101
+ field_dict: dict[str, Any] = {}
102
+ field_dict.update(self.additional_properties)
103
+ field_dict.update({})
104
+ if configurations is not UNSET:
105
+ field_dict["configurations"] = configurations
106
+ if enabled is not UNSET:
107
+ field_dict["enabled"] = enabled
108
+ if flavors is not UNSET:
109
+ field_dict["flavors"] = flavors
110
+ if integration_connections is not UNSET:
111
+ field_dict["integrationConnections"] = integration_connections
112
+ if policies is not UNSET:
113
+ field_dict["policies"] = policies
114
+ if private_clusters is not UNSET:
115
+ field_dict["privateClusters"] = private_clusters
116
+ if revision is not UNSET:
117
+ field_dict["revision"] = revision
118
+ if runtime is not UNSET:
119
+ field_dict["runtime"] = runtime
120
+ if sandbox is not UNSET:
121
+ field_dict["sandbox"] = sandbox
122
+
123
+ return field_dict
124
+
125
+ @classmethod
126
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
127
+ from ..models.core_spec_configurations import CoreSpecConfigurations
128
+ from ..models.flavor import Flavor
129
+ from ..models.model_private_cluster import ModelPrivateCluster
130
+ from ..models.revision_configuration import RevisionConfiguration
131
+ from ..models.runtime import Runtime
132
+
133
+ if not src_dict:
134
+ return None
135
+ d = src_dict.copy()
136
+ _configurations = d.pop("configurations", UNSET)
137
+ configurations: Union[Unset, CoreSpecConfigurations]
138
+ if isinstance(_configurations, Unset):
139
+ configurations = UNSET
140
+ else:
141
+ configurations = CoreSpecConfigurations.from_dict(_configurations)
142
+
143
+ enabled = d.pop("enabled", UNSET)
144
+
145
+ flavors = []
146
+ _flavors = d.pop("flavors", UNSET)
147
+ for componentsschemas_flavors_item_data in _flavors or []:
148
+ componentsschemas_flavors_item = Flavor.from_dict(componentsschemas_flavors_item_data)
149
+
150
+ flavors.append(componentsschemas_flavors_item)
151
+
152
+ integration_connections = cast(list[str], d.pop("integrationConnections", UNSET))
153
+
154
+ policies = cast(list[str], d.pop("policies", UNSET))
155
+
156
+ _private_clusters = d.pop("privateClusters", UNSET)
157
+ private_clusters: Union[Unset, ModelPrivateCluster]
158
+ if isinstance(_private_clusters, Unset):
159
+ private_clusters = UNSET
160
+ else:
161
+ private_clusters = ModelPrivateCluster.from_dict(_private_clusters)
162
+
163
+ _revision = d.pop("revision", UNSET)
164
+ revision: Union[Unset, RevisionConfiguration]
165
+ if isinstance(_revision, Unset):
166
+ revision = UNSET
167
+ else:
168
+ revision = RevisionConfiguration.from_dict(_revision)
169
+
170
+ _runtime = d.pop("runtime", UNSET)
171
+ runtime: Union[Unset, Runtime]
172
+ if isinstance(_runtime, Unset):
173
+ runtime = UNSET
174
+ else:
175
+ runtime = Runtime.from_dict(_runtime)
176
+
177
+ sandbox = d.pop("sandbox", UNSET)
178
+
179
+ sandbox_spec = cls(
180
+ configurations=configurations,
181
+ enabled=enabled,
182
+ flavors=flavors,
183
+ integration_connections=integration_connections,
184
+ policies=policies,
185
+ private_clusters=private_clusters,
186
+ revision=revision,
187
+ runtime=runtime,
188
+ sandbox=sandbox,
189
+ )
190
+
191
+ sandbox_spec.additional_properties = d
192
+ return sandbox_spec
193
+
194
+ @property
195
+ def additional_keys(self) -> list[str]:
196
+ return list(self.additional_properties.keys())
197
+
198
+ def __getitem__(self, key: str) -> Any:
199
+ return self.additional_properties[key]
200
+
201
+ def __setitem__(self, key: str, value: Any) -> None:
202
+ self.additional_properties[key] = value
203
+
204
+ def __delitem__(self, key: str) -> None:
205
+ del self.additional_properties[key]
206
+
207
+ def __contains__(self, key: str) -> bool:
208
+ return key in self.additional_properties
@@ -0,0 +1,129 @@
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 ..types import UNSET, Unset
7
+
8
+ if TYPE_CHECKING:
9
+ from ..models.core_event import CoreEvent
10
+ from ..models.metadata import Metadata
11
+ from ..models.sandbox_spec import SandboxSpec
12
+
13
+
14
+ T = TypeVar("T", bound="Sandboxes")
15
+
16
+
17
+ @_attrs_define
18
+ class Sandboxes:
19
+ """Micro VM for running agentic tasks
20
+
21
+ Attributes:
22
+ events (Union[Unset, list['CoreEvent']]): Core events
23
+ metadata (Union[Unset, Metadata]): Metadata
24
+ spec (Union[Unset, SandboxSpec]): Sandbox specification
25
+ status (Union[Unset, str]): Sandbox status
26
+ """
27
+
28
+ events: Union[Unset, list["CoreEvent"]] = UNSET
29
+ metadata: Union[Unset, "Metadata"] = UNSET
30
+ spec: Union[Unset, "SandboxSpec"] = UNSET
31
+ status: Union[Unset, str] = UNSET
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ events: Union[Unset, list[dict[str, Any]]] = UNSET
36
+ if not isinstance(self.events, Unset):
37
+ events = []
38
+ for componentsschemas_core_events_item_data in self.events:
39
+ if type(componentsschemas_core_events_item_data) == dict:
40
+ componentsschemas_core_events_item = componentsschemas_core_events_item_data
41
+ else:
42
+ componentsschemas_core_events_item = componentsschemas_core_events_item_data.to_dict()
43
+ events.append(componentsschemas_core_events_item)
44
+
45
+ metadata: Union[Unset, dict[str, Any]] = UNSET
46
+ if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
47
+ metadata = self.metadata.to_dict()
48
+ elif self.metadata and isinstance(self.metadata, dict):
49
+ metadata = self.metadata
50
+
51
+ spec: Union[Unset, dict[str, Any]] = UNSET
52
+ if self.spec and not isinstance(self.spec, Unset) and not isinstance(self.spec, dict):
53
+ spec = self.spec.to_dict()
54
+ elif self.spec and isinstance(self.spec, dict):
55
+ spec = self.spec
56
+
57
+ status = self.status
58
+
59
+ field_dict: dict[str, Any] = {}
60
+ field_dict.update(self.additional_properties)
61
+ field_dict.update({})
62
+ if events is not UNSET:
63
+ field_dict["events"] = events
64
+ if metadata is not UNSET:
65
+ field_dict["metadata"] = metadata
66
+ if spec is not UNSET:
67
+ field_dict["spec"] = spec
68
+ if status is not UNSET:
69
+ field_dict["status"] = status
70
+
71
+ return field_dict
72
+
73
+ @classmethod
74
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
75
+ from ..models.core_event import CoreEvent
76
+ from ..models.metadata import Metadata
77
+ from ..models.sandbox_spec import SandboxSpec
78
+
79
+ if not src_dict:
80
+ return None
81
+ d = src_dict.copy()
82
+ events = []
83
+ _events = d.pop("events", UNSET)
84
+ for componentsschemas_core_events_item_data in _events or []:
85
+ componentsschemas_core_events_item = CoreEvent.from_dict(componentsschemas_core_events_item_data)
86
+
87
+ events.append(componentsschemas_core_events_item)
88
+
89
+ _metadata = d.pop("metadata", UNSET)
90
+ metadata: Union[Unset, Metadata]
91
+ if isinstance(_metadata, Unset):
92
+ metadata = UNSET
93
+ else:
94
+ metadata = Metadata.from_dict(_metadata)
95
+
96
+ _spec = d.pop("spec", UNSET)
97
+ spec: Union[Unset, SandboxSpec]
98
+ if isinstance(_spec, Unset):
99
+ spec = UNSET
100
+ else:
101
+ spec = SandboxSpec.from_dict(_spec)
102
+
103
+ status = d.pop("status", UNSET)
104
+
105
+ sandboxes = cls(
106
+ events=events,
107
+ metadata=metadata,
108
+ spec=spec,
109
+ status=status,
110
+ )
111
+
112
+ sandboxes.additional_properties = d
113
+ return sandboxes
114
+
115
+ @property
116
+ def additional_keys(self) -> list[str]:
117
+ return list(self.additional_properties.keys())
118
+
119
+ def __getitem__(self, key: str) -> Any:
120
+ return self.additional_properties[key]
121
+
122
+ def __setitem__(self, key: str, value: Any) -> None:
123
+ self.additional_properties[key] = value
124
+
125
+ def __delitem__(self, key: str) -> None:
126
+ del self.additional_properties[key]
127
+
128
+ def __contains__(self, key: str) -> bool:
129
+ return key in self.additional_properties