fleet-python 0.2.21__py3-none-any.whl → 0.2.23__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.

Potentially problematic release.


This version of fleet-python might be problematic. Click here for more details.

fleet/env/client.py CHANGED
@@ -1,9 +1,9 @@
1
- from ..client import Fleet, Environment
1
+ from ..client import Fleet, SyncEnv
2
2
  from ..models import Environment as EnvironmentModel
3
3
  from typing import List, Optional
4
4
 
5
5
 
6
- def make(env_key: str, region: Optional[str] = None) -> Environment:
6
+ def make(env_key: str, region: Optional[str] = None) -> SyncEnv:
7
7
  return Fleet().make(env_key, region=region)
8
8
 
9
9
 
@@ -17,9 +17,9 @@ def list_regions() -> List[str]:
17
17
 
18
18
  def list_instances(
19
19
  status: Optional[str] = None, region: Optional[str] = None
20
- ) -> List[Environment]:
20
+ ) -> List[SyncEnv]:
21
21
  return Fleet().instances(status=status, region=region)
22
22
 
23
23
 
24
- def get(instance_id: str) -> Environment:
24
+ def get(instance_id: str) -> SyncEnv:
25
25
  return Fleet().instance(instance_id)
fleet/instance/client.py CHANGED
@@ -7,14 +7,12 @@ import time
7
7
  import logging
8
8
  from urllib.parse import urlparse
9
9
 
10
- from fleet.verifiers.parse import convert_verifier_string, extract_function_name
11
-
12
10
  from ..resources.sqlite import SQLiteResource
13
11
  from ..resources.browser import BrowserResource
14
12
  from ..resources.base import Resource
15
- from ..resources.mcp import MCPResource
16
13
 
17
14
  from ..verifiers import DatabaseSnapshot
15
+ from fleet.verifiers.parse import convert_verifier_string, extract_function_name
18
16
 
19
17
  from ..exceptions import FleetEnvironmentError
20
18
  from ..config import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
@@ -49,11 +47,9 @@ class InstanceClient:
49
47
  def __init__(
50
48
  self,
51
49
  url: str,
52
- env_key: str,
53
50
  httpx_client: Optional[httpx.Client] = None,
54
51
  ):
55
52
  self.base_url = url
56
- self._env_key = env_key
57
53
  self.client = SyncWrapper(
58
54
  url=self.base_url,
59
55
  httpx_client=httpx_client
@@ -67,7 +63,9 @@ class InstanceClient:
67
63
  def load(self) -> None:
68
64
  self._load_resources()
69
65
 
70
- def reset(self, reset_request: Optional[ResetRequest] = None) -> ResetResponse:
66
+ def reset(
67
+ self, reset_request: Optional[ResetRequest] = None
68
+ ) -> ResetResponse:
71
69
  response = self.client.request(
72
70
  "POST", "/reset", json=reset_request.model_dump() if reset_request else None
73
71
  )
@@ -91,14 +89,6 @@ class InstanceClient:
91
89
  self._resources_state[ResourceType.db.value][name], self.client
92
90
  )
93
91
 
94
- def mcp(self) -> MCPResource:
95
- import time
96
- time.sleep(5)
97
- mcp_url = f"{self.base_url}/mcp"
98
- if mcp_url.endswith("/api/v1/env/mcp"):
99
- mcp_url = mcp_url.replace("/api/v1/env/mcp", "/mcp")
100
- return MCPResource(mcp_url, self._env_key)
101
-
102
92
  def browser(self, name: str) -> BrowserResource:
103
93
  return BrowserResource(
104
94
  self._resources_state[ResourceType.cdp.value][name], self.client
@@ -125,7 +115,6 @@ class InstanceClient:
125
115
  except:
126
116
  pass
127
117
 
128
- # Extract function name if not provided
129
118
  if function_name is None:
130
119
  function_name = extract_function_name(function_code)
131
120
 
fleet/models.py CHANGED
@@ -1,276 +1,321 @@
1
1
  # generated by datamodel-codegen:
2
- # filename: http://0.0.0.0:8000/openapi.json
3
- # timestamp: 2025-07-20T02:00:30+00:00
2
+ # filename: https://orchestrator.fleetai.com/openapi.json
3
+ # timestamp: 2025-08-03T22:47:20+00:00
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
7
  from enum import Enum
8
- from typing import Any, Dict, List, Optional, Union, Tuple
8
+ from typing import Any, Dict, List, Optional, Union
9
9
 
10
10
  from pydantic import BaseModel, Field, conint
11
11
 
12
- class ToolLogEntry(BaseModel):
13
- id: int
14
- timestamp: str
15
- tool_name: str
16
- action: str
17
- parameters: Dict[str, Any]
18
- result: Optional[Dict[str, Any]] = None
19
- success: bool = True
20
- error: Optional[str] = None
21
- duration_ms: Optional[int] = None
22
- session_id: Optional[str] = None
23
- user_agent: Optional[str] = None
24
-
25
-
26
- class ActionLogEntry(BaseModel):
27
- id: int
28
- timestamp: str
29
- action_type: str
30
- payload: str
31
- sql: Optional[str] = None
32
- args: Optional[str] = None
33
- path: Optional[str] = None
34
-
35
-
36
- class EnvironmentSnapshot(BaseModel):
37
- env_key: str
38
- instance_id: str
39
- timestamp: str
40
- session_id: str
41
- tool_logs: List[ToolLogEntry]
42
- action_logs: List[ActionLogEntry]
43
- page_url: str
44
- viewport_size: Tuple[int, int]
45
- metadata: Dict[str, Any] = {}
46
-
47
-
48
- class SnapshotValidation(BaseModel):
49
- success: bool
50
- page_match: bool
51
- action_log_match: bool
52
- discrepancies: List[str] = []
53
- message: str
54
-
55
-
56
- class ToolLogResponse(BaseModel):
57
- success: bool
58
- log_id: Optional[int] = None
59
- message: str
60
-
61
-
62
- class ToolSessionStartRequest(BaseModel):
63
- session_id: str
64
- metadata: Optional[Dict[str, Any]] = None
65
-
66
-
67
- class ToolSessionStartResponse(BaseModel):
68
- success: bool
69
- session_id: str
70
- message: str
71
-
72
-
73
- class ToolLogQueryRequest(BaseModel):
74
- tool_name: Optional[str] = None
75
- action: Optional[str] = None
76
- session_id: Optional[str] = None
77
- start_time: Optional[str] = None
78
- end_time: Optional[str] = None
79
- limit: Optional[int] = 10000
80
- offset: int = 0
12
+
13
+ class CDPDescribeResponse(BaseModel):
14
+ success: bool = Field(..., title='Success')
15
+ url: str = Field(..., title='Url')
16
+ devtools_url: str = Field(..., title='Devtools Url')
17
+
18
+
19
+ class ChromeStartRequest(BaseModel):
20
+ start_page: Optional[str] = Field('about:blank', title='Start Page')
21
+ resolution: Optional[str] = Field('1920x1080', title='Resolution')
22
+
23
+
24
+ class ChromeStartResponse(BaseModel):
25
+ success: bool = Field(..., title='Success')
26
+ message: str = Field(..., title='Message')
27
+
28
+
29
+ class ChromeStatusResponse(BaseModel):
30
+ running: bool = Field(..., title='Running')
31
+ message: str = Field(..., title='Message')
32
+
81
33
 
82
34
  class Environment(BaseModel):
83
- env_key: str = Field(..., title="Env Key")
84
- name: str = Field(..., title="Name")
85
- description: Optional[str] = Field(..., title="Description")
86
- default_version: Optional[str] = Field(..., title="Default Version")
87
- versions: Dict[str, str] = Field(..., title="Versions")
35
+ env_key: str = Field(..., title='Env Key')
36
+ name: str = Field(..., title='Name')
37
+ description: Optional[str] = Field(..., title='Description')
38
+ default_version: Optional[str] = Field(..., title='Default Version')
39
+ versions: Dict[str, str] = Field(..., title='Versions')
88
40
 
89
41
 
90
42
  class Instance(BaseModel):
91
- instance_id: str = Field(..., title="Instance Id")
92
- env_key: str = Field(..., title="Env Key")
93
- version: str = Field(..., title="Version")
94
- status: str = Field(..., title="Status")
95
- subdomain: str = Field(..., title="Subdomain")
96
- created_at: str = Field(..., title="Created At")
97
- updated_at: str = Field(..., title="Updated At")
98
- terminated_at: Optional[str] = Field(None, title="Terminated At")
99
- team_id: str = Field(..., title="Team Id")
100
- region: str = Field(..., title="Region")
43
+ instance_id: str = Field(..., title='Instance Id')
44
+ env_key: str = Field(..., title='Env Key')
45
+ version: str = Field(..., title='Version')
46
+ status: str = Field(..., title='Status')
47
+ subdomain: str = Field(..., title='Subdomain')
48
+ created_at: str = Field(..., title='Created At')
49
+ updated_at: str = Field(..., title='Updated At')
50
+ terminated_at: Optional[str] = Field(None, title='Terminated At')
51
+ team_id: str = Field(..., title='Team Id')
52
+ region: str = Field(..., title='Region')
53
+ env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
101
54
 
102
55
 
103
56
  class InstanceRequest(BaseModel):
104
- env_key: str = Field(..., title="Env Key")
105
- version: Optional[str] = Field(None, title="Version")
106
- region: Optional[str] = Field("us-east-2", title="Region")
107
- seed: Optional[int] = Field(None, title="Seed")
108
- timestamp: Optional[int] = Field(None, title="Timestamp")
109
- p_error: Optional[float] = Field(None, title="P Error")
110
- avg_latency: Optional[float] = Field(None, title="Avg Latency")
111
- run_id: Optional[str] = Field(None, title="Run Id")
112
- task_id: Optional[str] = Field(None, title="Task Id")
57
+ env_key: str = Field(..., title='Env Key')
58
+ version: Optional[str] = Field(None, title='Version')
59
+ region: Optional[str] = Field('us-west-1', title='Region')
60
+ seed: Optional[int] = Field(None, title='Seed')
61
+ timestamp: Optional[int] = Field(None, title='Timestamp')
62
+ p_error: Optional[float] = Field(None, title='P Error')
63
+ avg_latency: Optional[float] = Field(None, title='Avg Latency')
64
+ run_id: Optional[str] = Field(None, title='Run Id')
65
+ task_id: Optional[str] = Field(None, title='Task Id')
66
+ force_pull: Optional[bool] = Field(None, title='Force Pull')
67
+ env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
68
+ created_from: Optional[str] = Field(None, title='Created From')
113
69
 
114
70
 
115
71
  class InstanceStatus(Enum):
116
- pending = "pending"
117
- running = "running"
118
- stopped = "stopped"
119
- error = "error"
72
+ pending = 'pending'
73
+ running = 'running'
74
+ stopped = 'stopped'
75
+ error = 'error'
120
76
 
121
77
 
122
78
  class ManagerURLs(BaseModel):
123
- api: str = Field(..., title="Api")
124
- docs: str = Field(..., title="Docs")
125
- reset: str = Field(..., title="Reset")
126
- diff: str = Field(..., title="Diff")
127
- snapshot: str = Field(..., title="Snapshot")
128
- execute_verifier_function: str = Field(..., title="Execute Verifier Function")
79
+ api: str = Field(..., title='Api')
80
+ docs: str = Field(..., title='Docs')
81
+ reset: str = Field(..., title='Reset')
82
+ diff: str = Field(..., title='Diff')
83
+ snapshot: str = Field(..., title='Snapshot')
84
+ execute_verifier_function: str = Field(..., title='Execute Verifier Function')
129
85
  execute_verifier_function_with_upload: str = Field(
130
- ..., title="Execute Verifier Function With Upload"
86
+ ..., title='Execute Verifier Function With Upload'
131
87
  )
132
88
 
133
89
 
90
+ class QueryRequest(BaseModel):
91
+ query: str = Field(..., title='Query')
92
+ args: Optional[List] = Field(None, title='Args')
93
+ read_only: Optional[bool] = Field(True, title='Read Only')
94
+
95
+
96
+ class QueryResponse(BaseModel):
97
+ success: bool = Field(..., title='Success')
98
+ columns: Optional[List[str]] = Field(None, title='Columns')
99
+ rows: Optional[List[List]] = Field(None, title='Rows')
100
+ rows_affected: Optional[int] = Field(None, title='Rows Affected')
101
+ last_insert_id: Optional[int] = Field(None, title='Last Insert Id')
102
+ error: Optional[str] = Field(None, title='Error')
103
+ message: str = Field(..., title='Message')
104
+
105
+
106
+ class RecreateResponse(BaseModel):
107
+ success: bool = Field(..., title='Success')
108
+ instance_id: str = Field(..., title='Instance Id')
109
+ env_key: str = Field(..., title='Env Key')
110
+ version: str = Field(..., title='Version')
111
+ recreated_at: str = Field(..., title='Recreated At')
112
+
113
+
114
+ class ResourceMode(Enum):
115
+ ro = 'ro'
116
+ rw = 'rw'
117
+
118
+
119
+ class ResourceType(Enum):
120
+ sqlite = 'sqlite'
121
+ cdp = 'cdp'
122
+
123
+
124
+ class RestoreRequest(BaseModel):
125
+ backup_id: Optional[str] = Field(None, title='Backup Id')
126
+
127
+
128
+ class RestoreResponse(BaseModel):
129
+ success: bool = Field(..., title='Success')
130
+ backup_id: str = Field(..., title='Backup Id')
131
+ source_instance_id: str = Field(..., title='Source Instance Id')
132
+ target_instance_id: str = Field(..., title='Target Instance Id')
133
+ restored_at: str = Field(..., title='Restored At')
134
+
135
+
136
+ class SnapshotResponse(BaseModel):
137
+ success: bool = Field(..., title='Success')
138
+ backup_id: str = Field(..., title='Backup Id')
139
+ instance_id: str = Field(..., title='Instance Id')
140
+ s3_key: str = Field(..., title='S3 Key')
141
+ created_at: str = Field(..., title='Created At')
142
+
143
+
144
+ class TableSchema(BaseModel):
145
+ name: str = Field(..., title='Name')
146
+ sql: str = Field(..., title='Sql')
147
+ columns: List[Dict[str, Any]] = Field(..., title='Columns')
148
+
149
+
150
+ class TaskRequest(BaseModel):
151
+ key: str = Field(..., title='Key')
152
+ prompt: str = Field(..., title='Prompt')
153
+ environment_id: str = Field(..., title='Environment Id')
154
+ verifier_id: Optional[str] = Field(None, title='Verifier Id')
155
+
156
+
157
+ class TaskResponse(BaseModel):
158
+ key: str = Field(..., title='Key')
159
+ prompt: str = Field(..., title='Prompt')
160
+ team_id: str = Field(..., title='Team Id')
161
+ environment_id: str = Field(..., title='Environment Id')
162
+ created_at: str = Field(..., title='Created At')
163
+ verifier_id: Optional[str] = Field(None, title='Verifier Id')
164
+
165
+
134
166
  class ValidationError(BaseModel):
135
- loc: List[Union[str, int]] = Field(..., title="Location")
136
- msg: str = Field(..., title="Message")
137
- type: str = Field(..., title="Error Type")
167
+ loc: List[Union[str, int]] = Field(..., title='Location')
168
+ msg: str = Field(..., title='Message')
169
+ type: str = Field(..., title='Error Type')
138
170
 
139
171
 
140
172
  class VerifiersCheckResponse(BaseModel):
141
173
  key: Optional[str] = Field(
142
- None, description="Verifier artifact key", title="Key"
174
+ None, description='Key of the verifier artifact', title='Key'
143
175
  )
144
176
  version: Optional[int] = Field(
145
- None, description="Version of the verifier artifact", title="Version"
177
+ None, description='Version of the verifier artifact', title='Version'
146
178
  )
147
179
  display_src: Optional[str] = Field(
148
- None, description="Display source code of the verifier", title="Display Src"
180
+ None, description='Display source code of the verifier', title='Display Src'
149
181
  )
150
182
  created_at: Optional[str] = Field(
151
- None, description="Creation timestamp", title="Created At"
152
- )
153
- created_by: Optional[str] = Field(
154
- None, description="Creator of the verifier", title="Created By"
183
+ None, description='Creation timestamp', title='Created At'
155
184
  )
156
185
  comment: Optional[str] = Field(
157
- None, description="Comment about the verifier", title="Comment"
186
+ None, description='Comment about the verifier', title='Comment'
158
187
  )
159
188
  success: bool = Field(
160
- ..., description="Whether the verification was successful", title="Success"
189
+ ..., description='Whether the verification was successful', title='Success'
161
190
  )
162
191
 
163
192
 
164
193
  class VerifiersExecuteRequest(BaseModel):
165
- sha256: str = Field(..., description="SHA256 hash of the function", title="SHA256")
166
- key: Optional[str] = Field(None, description="Verifier key", title="Key")
167
- bundle: Optional[str] = Field(None, description="Base64 encoded bundle data", title="Bundle")
168
- args: Optional[str] = Field(None, description="Base64 encoded arguments", title="Args")
194
+ key: Optional[str] = Field(
195
+ None, description='Key of the verifier artifact', title='Key'
196
+ )
197
+ sha256: Optional[str] = Field(
198
+ None,
199
+ description='SHA256 hash of the function (auto-generated if bundle is provided)',
200
+ title='Sha256',
201
+ )
202
+ bundle: Optional[str] = Field(
203
+ None, description='Base64 encoded bundle data', title='Bundle'
204
+ )
205
+ args: Optional[str] = Field(
206
+ None, description='Base64 encoded cloudpickled args', title='Args'
207
+ )
208
+ args_array: Optional[List] = Field(
209
+ None,
210
+ description='Array of argument values to pass to the function',
211
+ title='Args Array',
212
+ )
169
213
  function_name: Optional[str] = Field(
170
- "verify", description="Name of the function to execute", title="Function Name"
214
+ 'verify', description='Name of the function to execute', title='Function Name'
171
215
  )
172
216
  timeout: Optional[conint(ge=1, le=300)] = Field(
173
- 60, description="Execution timeout in seconds", title="Timeout"
217
+ 60, description='Execution timeout in seconds', title='Timeout'
174
218
  )
175
219
  region: Optional[str] = Field(
176
- None, description="AWS region for execution", title="Region"
220
+ None, description='AWS region for execution', title='Region'
221
+ )
222
+ metadata: Optional[Dict[str, Any]] = Field(
223
+ None, description='Additional metadata', title='Metadata'
224
+ )
225
+ comment: Optional[str] = Field(
226
+ None, description='Comment about the function', title='Comment'
227
+ )
228
+ display_src: Optional[str] = Field(
229
+ None, description='Display source code', title='Display Src'
177
230
  )
178
231
 
179
232
 
180
233
  class VerifiersExecuteResponse(BaseModel):
181
234
  key: Optional[str] = Field(
182
- None, description="Key of the verifier artifact", title="Key"
235
+ None, description='Key of the verifier artifact', title='Key'
183
236
  )
184
237
  version: Optional[int] = Field(
185
- None, description="Version of the verifier artifact", title="Version"
238
+ None, description='Version of the verifier artifact', title='Version'
186
239
  )
187
240
  display_src: Optional[str] = Field(
188
- None, description="Display source code of the verifier", title="Display Src"
241
+ None, description='Display source code of the verifier', title='Display Src'
189
242
  )
190
243
  created_at: Optional[str] = Field(
191
- None, description="Creation timestamp", title="Created At"
244
+ None, description='Creation timestamp', title='Created At'
192
245
  )
193
246
  comment: Optional[str] = Field(
194
- None, description="Comment about the verifier", title="Comment"
195
- )
196
- success: bool = Field(
197
- ..., description="Whether the verification was successful", title="Success"
198
- )
199
- result: Any = Field(
200
- ..., description="The return value of the function", title="Result"
201
- )
202
- error: Optional[Dict[str, Any]] = Field(
203
- None, description="Error details if verification failed", title="Error"
204
- )
205
- execution_time_ms: int = Field(
206
- ..., description="Execution time in milliseconds", title="Execution Time Ms"
207
- )
208
- bundle_cache_hit: bool = Field(
209
- False,
210
- description="Whether the bundle was already cached",
211
- title="Bundle Cache Hit",
247
+ None, description='Comment about the verifier', title='Comment'
212
248
  )
213
-
214
-
215
- class VerificationResponse(BaseModel):
216
249
  success: bool = Field(
217
- ..., description="Whether the verification was successful", title="Success"
250
+ ..., description='Whether the verification was successful', title='Success'
218
251
  )
219
252
  result: Optional[Any] = Field(
220
- None, description="The return value of the function", title="Result"
253
+ None, description='The return value of the function', title='Result'
221
254
  )
222
255
  error: Optional[Dict[str, Any]] = Field(
223
- None, description="Error details if verification failed", title="Error"
256
+ None, description='Error details if verification failed', title='Error'
224
257
  )
225
258
  execution_time_ms: int = Field(
226
- ..., description="Execution time in milliseconds", title="Execution Time Ms"
259
+ ..., description='Execution time in milliseconds', title='Execution Time Ms'
227
260
  )
228
261
  bundle_cache_hit: Optional[bool] = Field(
229
262
  False,
230
- description="Whether the bundle was already cached",
231
- title="Bundle Cache Hit",
263
+ description='Whether the bundle was already cached',
264
+ title='Bundle Cache Hit',
232
265
  )
233
- meta: Optional[Dict[str, Any]] = Field(
234
- None, description="Metadata about the execution", title="Meta"
266
+ stdout: Optional[str] = Field(
267
+ None, description='Captured stdout from execution', title='Stdout'
235
268
  )
236
269
 
237
270
 
271
+ class DescribeResponse(BaseModel):
272
+ success: bool = Field(..., title='Success')
273
+ resource_name: str = Field(..., title='Resource Name')
274
+ tables: Optional[List[TableSchema]] = Field(None, title='Tables')
275
+ error: Optional[str] = Field(None, title='Error')
276
+ message: str = Field(..., title='Message')
277
+
278
+
238
279
  class HTTPValidationError(BaseModel):
239
- detail: Optional[List[ValidationError]] = Field(None, title="Detail")
280
+ detail: Optional[List[ValidationError]] = Field(None, title='Detail')
240
281
 
241
282
 
242
283
  class InstanceURLs(BaseModel):
243
- root: str = Field(..., title="Root")
244
- app: str = Field(..., title="App")
245
- api: Optional[str] = Field(None, title="Api")
246
- health: Optional[str] = Field(None, title="Health")
247
- api_docs: Optional[str] = Field(None, title="Api Docs")
284
+ root: str = Field(..., title='Root')
285
+ app: List[str] = Field(..., title='App')
286
+ api: Optional[str] = Field(None, title='Api')
287
+ health: Optional[str] = Field(None, title='Health')
288
+ api_docs: Optional[str] = Field(None, title='Api Docs')
248
289
  manager: ManagerURLs
249
290
 
250
291
 
292
+ class Resource(BaseModel):
293
+ name: str = Field(..., title='Name')
294
+ type: ResourceType
295
+ mode: ResourceMode
296
+ label: Optional[str] = Field(None, title='Label')
297
+
298
+
299
+ class ResourcesResponse(BaseModel):
300
+ resources: List[Resource] = Field(..., title='Resources')
301
+
302
+
303
+ class TaskListResponse(BaseModel):
304
+ tasks: List[TaskResponse] = Field(..., title='Tasks')
305
+ total: int = Field(..., title='Total')
306
+
307
+
251
308
  class InstanceResponse(BaseModel):
252
- instance_id: str = Field(..., title="Instance Id")
253
- env_key: str = Field(..., title="Env Key")
254
- version: str = Field(..., title="Version")
255
- status: str = Field(..., title="Status")
256
- subdomain: str = Field(..., title="Subdomain")
257
- created_at: str = Field(..., title="Created At")
258
- updated_at: str = Field(..., title="Updated At")
259
- terminated_at: Optional[str] = Field(None, title="Terminated At")
260
- team_id: str = Field(..., title="Team Id")
261
- region: str = Field(..., title="Region")
262
- urls: InstanceURLs
263
- health: Optional[bool] = Field(None, title="Health")
264
-
265
-
266
- class InstanceRecord(BaseModel):
267
- instance_id: str
268
- env_key: str
269
- version: str
270
- status: str
271
- subdomain: str
272
- created_at: str
273
- updated_at: str
274
- terminated_at: Optional[str] = None
275
- team_id: str
276
- region: str
309
+ instance_id: str = Field(..., title='Instance Id')
310
+ env_key: str = Field(..., title='Env Key')
311
+ version: str = Field(..., title='Version')
312
+ status: str = Field(..., title='Status')
313
+ subdomain: str = Field(..., title='Subdomain')
314
+ created_at: str = Field(..., title='Created At')
315
+ updated_at: str = Field(..., title='Updated At')
316
+ terminated_at: Optional[str] = Field(None, title='Terminated At')
317
+ team_id: str = Field(..., title='Team Id')
318
+ region: str = Field(..., title='Region')
319
+ env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
320
+ urls: Optional[InstanceURLs] = Field(None, title='Urls')
321
+ health: Optional[bool] = Field(None, title='Health')
@@ -17,15 +17,16 @@ class BrowserResource(Resource):
17
17
  def __init__(self, resource: ResourceModel, client: "SyncWrapper"):
18
18
  super().__init__(resource)
19
19
  self.client = client
20
-
20
+
21
21
  def start(self, width: int = 1920, height: int = 1080) -> CDPDescribeResponse:
22
- """Start browser and return CDP information."""
23
- request = ChromeStartRequest(resolution=f"{width}x{height}")
24
- response = self.client.request("POST", "/resources/cdp/start", json=request.model_dump())
25
-
26
- # After starting, get the CDP information via describe
22
+ response = self.client.request(
23
+ "POST",
24
+ "/resources/cdp/start",
25
+ json=ChromeStartRequest(resolution=f"{width},{height}").model_dump(),
26
+ )
27
+ ChromeStartResponse(**response.json())
27
28
  return self.describe()
28
-
29
+
29
30
  def describe(self) -> CDPDescribeResponse:
30
31
  response = self.client.request("GET", "/resources/cdp/describe")
31
32
  if response.status_code != 200: