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

Files changed (63) hide show
  1. examples/diff_example.py +30 -20
  2. examples/dsl_example.py +12 -7
  3. examples/example.py +4 -4
  4. examples/exampleResume.py +191 -0
  5. examples/example_account.py +8 -0
  6. examples/example_action_log.py +2 -2
  7. examples/example_client.py +2 -2
  8. examples/example_mcp_anthropic.py +8 -5
  9. examples/example_mcp_openai.py +2 -2
  10. examples/example_sync.py +4 -4
  11. examples/example_task.py +16 -6
  12. examples/example_tasks.py +3 -6
  13. examples/example_verifier.py +16 -3
  14. examples/gemini_example.py +6 -6
  15. examples/json_tasks_example.py +2 -2
  16. examples/nova_act_example.py +2 -2
  17. examples/openai_example.py +3 -3
  18. examples/openai_simple_example.py +3 -3
  19. examples/query_builder_example.py +11 -7
  20. examples/test_cdp_logging.py +80 -0
  21. fleet/__init__.py +60 -5
  22. fleet/_async/__init__.py +258 -1
  23. fleet/_async/base.py +2 -1
  24. fleet/_async/client.py +164 -144
  25. fleet/_async/env/client.py +2 -0
  26. fleet/_async/global_client.py +43 -0
  27. fleet/_async/instance/client.py +1 -1
  28. fleet/_async/models.py +172 -171
  29. fleet/_async/resources/base.py +1 -1
  30. fleet/_async/resources/mcp.py +55 -0
  31. fleet/_async/resources/sqlite.py +141 -130
  32. fleet/_async/tasks.py +69 -16
  33. fleet/_async/verifiers/__init__.py +2 -2
  34. fleet/_async/verifiers/bundler.py +18 -14
  35. fleet/_async/verifiers/verifier.py +77 -71
  36. fleet/base.py +2 -1
  37. fleet/client.py +162 -148
  38. fleet/config.py +3 -2
  39. fleet/env/__init__.py +9 -1
  40. fleet/env/client.py +4 -1
  41. fleet/global_client.py +43 -0
  42. fleet/instance/__init__.py +1 -1
  43. fleet/instance/client.py +1 -1
  44. fleet/models.py +172 -171
  45. fleet/resources/base.py +1 -1
  46. fleet/resources/mcp.py +11 -16
  47. fleet/resources/sqlite.py +141 -130
  48. fleet/tasks.py +86 -15
  49. fleet/types.py +1 -1
  50. fleet/verifiers/__init__.py +2 -2
  51. fleet/verifiers/bundler.py +18 -14
  52. fleet/verifiers/code.py +1 -1
  53. fleet/verifiers/decorator.py +25 -34
  54. fleet/verifiers/parse.py +98 -68
  55. fleet/verifiers/verifier.py +77 -71
  56. {fleet_python-0.2.29.dist-info → fleet_python-0.2.34.dist-info}/METADATA +9 -9
  57. fleet_python-0.2.34.dist-info/RECORD +76 -0
  58. scripts/fix_sync_imports.py +87 -59
  59. scripts/unasync.py +10 -9
  60. fleet_python-0.2.29.dist-info/RECORD +0 -70
  61. {fleet_python-0.2.29.dist-info → fleet_python-0.2.34.dist-info}/WHEEL +0 -0
  62. {fleet_python-0.2.29.dist-info → fleet_python-0.2.34.dist-info}/licenses/LICENSE +0 -0
  63. {fleet_python-0.2.29.dist-info → fleet_python-0.2.34.dist-info}/top_level.txt +0 -0
fleet/models.py CHANGED
@@ -11,333 +11,334 @@ from pydantic import BaseModel, Field, conint
11
11
 
12
12
 
13
13
  class CDPDescribeResponse(BaseModel):
14
- success: bool = Field(..., title='Success')
15
- url: str = Field(..., title='Url')
16
- devtools_url: str = Field(..., title='Devtools Url')
14
+ success: bool = Field(..., title="Success")
15
+ url: str = Field(..., title="Url")
16
+ devtools_url: str = Field(..., title="Devtools Url")
17
17
 
18
18
 
19
19
  class ChromeStartRequest(BaseModel):
20
- start_page: Optional[str] = Field('about:blank', title='Start Page')
21
- resolution: Optional[str] = Field('1920x1080', title='Resolution')
20
+ start_page: Optional[str] = Field("about:blank", title="Start Page")
21
+ resolution: Optional[str] = Field("1920x1080", title="Resolution")
22
22
 
23
23
 
24
24
  class ChromeStartResponse(BaseModel):
25
- success: bool = Field(..., title='Success')
26
- message: str = Field(..., title='Message')
25
+ success: bool = Field(..., title="Success")
26
+ message: str = Field(..., title="Message")
27
27
 
28
28
 
29
29
  class ChromeStatusResponse(BaseModel):
30
- running: bool = Field(..., title='Running')
31
- message: str = Field(..., title='Message')
30
+ running: bool = Field(..., title="Running")
31
+ message: str = Field(..., title="Message")
32
32
 
33
33
 
34
34
  class Environment(BaseModel):
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')
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")
40
40
 
41
41
 
42
42
  class Instance(BaseModel):
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')
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")
54
54
 
55
55
 
56
56
  class InstanceRequest(BaseModel):
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')
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")
69
69
 
70
70
 
71
71
  class InstanceStatus(Enum):
72
- pending = 'pending'
73
- running = 'running'
74
- stopped = 'stopped'
75
- error = 'error'
72
+ pending = "pending"
73
+ running = "running"
74
+ stopped = "stopped"
75
+ error = "error"
76
76
 
77
77
 
78
78
  class ManagerURLs(BaseModel):
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')
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")
85
85
  execute_verifier_function_with_upload: str = Field(
86
- ..., title='Execute Verifier Function With Upload'
86
+ ..., title="Execute Verifier Function With Upload"
87
87
  )
88
88
 
89
89
 
90
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')
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
94
 
95
95
 
96
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')
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
104
 
105
105
 
106
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')
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
112
 
113
113
 
114
114
  class ResourceMode(Enum):
115
- ro = 'ro'
116
- rw = 'rw'
115
+ ro = "ro"
116
+ rw = "rw"
117
117
 
118
118
 
119
119
  class ResourceType(Enum):
120
- sqlite = 'sqlite'
121
- cdp = 'cdp'
120
+ sqlite = "sqlite"
121
+ cdp = "cdp"
122
122
 
123
123
 
124
124
  class RestoreRequest(BaseModel):
125
- backup_id: Optional[str] = Field(None, title='Backup Id')
125
+ backup_id: Optional[str] = Field(None, title="Backup Id")
126
126
 
127
127
 
128
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')
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
134
 
135
135
 
136
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')
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
142
 
143
143
 
144
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')
145
+ name: str = Field(..., title="Name")
146
+ sql: str = Field(..., title="Sql")
147
+ columns: List[Dict[str, Any]] = Field(..., title="Columns")
148
148
 
149
149
 
150
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
- version: Optional[str] = Field(None, title='Version')
156
- env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
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
+ version: Optional[str] = Field(None, title="Version")
156
+ env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
157
157
 
158
158
 
159
159
  class VerifierData(BaseModel):
160
- verifier_id: str = Field(..., title='Verifier Id')
161
- key: str = Field(..., title='Key')
162
- version: int = Field(..., title='Version')
163
- sha256: str = Field(..., title='Sha256')
164
- code: str = Field(..., title='Code')
165
- comment: Optional[str] = Field(None, title='Comment')
166
- created_at: str = Field(..., title='Created At')
160
+ verifier_id: str = Field(..., title="Verifier Id")
161
+ key: str = Field(..., title="Key")
162
+ version: int = Field(..., title="Version")
163
+ sha256: str = Field(..., title="Sha256")
164
+ code: str = Field(..., title="Code")
165
+ comment: Optional[str] = Field(None, title="Comment")
166
+ created_at: str = Field(..., title="Created At")
167
167
 
168
168
 
169
169
  class TaskResponse(BaseModel):
170
- key: str = Field(..., title='Key')
171
- prompt: str = Field(..., title='Prompt')
172
- team_id: str = Field(..., title='Team Id')
173
- environment_id: str = Field(..., title='Environment Id')
174
- created_at: str = Field(..., title='Created At')
175
- verifier_id: Optional[str] = Field(None, title='Verifier Id')
176
- verifier_func: Optional[str] = Field(None, title='Verifier Func')
177
- version: Optional[str] = Field(None, title='Version')
178
- env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
179
- verifier: Optional[VerifierData] = Field(None, title='Verifier')
170
+ key: str = Field(..., title="Key")
171
+ prompt: str = Field(..., title="Prompt")
172
+ team_id: str = Field(..., title="Team Id")
173
+ environment_id: str = Field(..., title="Environment Id")
174
+ created_at: str = Field(..., title="Created At")
175
+ verifier_id: Optional[str] = Field(None, title="Verifier Id")
176
+ verifier_func: Optional[str] = Field(None, title="Verifier Func")
177
+ version: Optional[str] = Field(None, title="Version")
178
+ env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
179
+ verifier: Optional[VerifierData] = Field(None, title="Verifier")
180
180
 
181
181
 
182
182
  class ValidationError(BaseModel):
183
- loc: List[Union[str, int]] = Field(..., title='Location')
184
- msg: str = Field(..., title='Message')
185
- type: str = Field(..., title='Error Type')
183
+ loc: List[Union[str, int]] = Field(..., title="Location")
184
+ msg: str = Field(..., title="Message")
185
+ type: str = Field(..., title="Error Type")
186
186
 
187
187
 
188
188
  class VerifiersCheckResponse(BaseModel):
189
189
  key: Optional[str] = Field(
190
- None, description='Key of the verifier artifact', title='Key'
190
+ None, description="Key of the verifier artifact", title="Key"
191
191
  )
192
192
  version: Optional[int] = Field(
193
- None, description='Version of the verifier artifact', title='Version'
193
+ None, description="Version of the verifier artifact", title="Version"
194
194
  )
195
195
  display_src: Optional[str] = Field(
196
- None, description='Display source code of the verifier', title='Display Src'
196
+ None, description="Display source code of the verifier", title="Display Src"
197
197
  )
198
198
  created_at: Optional[str] = Field(
199
- None, description='Creation timestamp', title='Created At'
199
+ None, description="Creation timestamp", title="Created At"
200
200
  )
201
201
  comment: Optional[str] = Field(
202
- None, description='Comment about the verifier', title='Comment'
202
+ None, description="Comment about the verifier", title="Comment"
203
203
  )
204
204
  success: bool = Field(
205
- ..., description='Whether the verification was successful', title='Success'
205
+ ..., description="Whether the verification was successful", title="Success"
206
206
  )
207
207
 
208
208
 
209
209
  class VerifiersExecuteRequest(BaseModel):
210
210
  key: Optional[str] = Field(
211
- None, description='Key of the verifier artifact', title='Key'
211
+ None, description="Key of the verifier artifact", title="Key"
212
212
  )
213
213
  sha256: Optional[str] = Field(
214
214
  None,
215
- description='SHA256 hash of the function (auto-generated if bundle is provided)',
216
- title='Sha256',
215
+ description="SHA256 hash of the function (auto-generated if bundle is provided)",
216
+ title="Sha256",
217
217
  )
218
218
  bundle: Optional[str] = Field(
219
- None, description='Base64 encoded bundle data', title='Bundle'
219
+ None, description="Base64 encoded bundle data", title="Bundle"
220
220
  )
221
221
  args: Optional[str] = Field(
222
- None, description='Base64 encoded cloudpickled args', title='Args'
222
+ None, description="Base64 encoded cloudpickled args", title="Args"
223
223
  )
224
224
  args_array: Optional[List] = Field(
225
225
  None,
226
- description='Array of argument values to pass to the function',
227
- title='Args Array',
226
+ description="Array of argument values to pass to the function",
227
+ title="Args Array",
228
228
  )
229
229
  function_name: Optional[str] = Field(
230
- 'verify', description='Name of the function to execute', title='Function Name'
230
+ "verify", description="Name of the function to execute", title="Function Name"
231
231
  )
232
232
  timeout: Optional[conint(ge=1, le=300)] = Field(
233
- 60, description='Execution timeout in seconds', title='Timeout'
233
+ 60, description="Execution timeout in seconds", title="Timeout"
234
234
  )
235
235
  region: Optional[str] = Field(
236
- None, description='AWS region for execution', title='Region'
236
+ None, description="AWS region for execution", title="Region"
237
237
  )
238
238
  metadata: Optional[Dict[str, Any]] = Field(
239
- None, description='Additional metadata', title='Metadata'
239
+ None, description="Additional metadata", title="Metadata"
240
240
  )
241
241
  comment: Optional[str] = Field(
242
- None, description='Comment about the function', title='Comment'
242
+ None, description="Comment about the function", title="Comment"
243
243
  )
244
244
  display_src: Optional[str] = Field(
245
- None, description='Display source code', title='Display Src'
245
+ None, description="Display source code", title="Display Src"
246
246
  )
247
247
 
248
248
 
249
249
  class VerifiersExecuteResponse(BaseModel):
250
250
  key: Optional[str] = Field(
251
- None, description='Key of the verifier artifact', title='Key'
251
+ None, description="Key of the verifier artifact", title="Key"
252
252
  )
253
253
  version: Optional[int] = Field(
254
- None, description='Version of the verifier artifact', title='Version'
254
+ None, description="Version of the verifier artifact", title="Version"
255
255
  )
256
256
  display_src: Optional[str] = Field(
257
- None, description='Display source code of the verifier', title='Display Src'
257
+ None, description="Display source code of the verifier", title="Display Src"
258
258
  )
259
259
  created_at: Optional[str] = Field(
260
- None, description='Creation timestamp', title='Created At'
260
+ None, description="Creation timestamp", title="Created At"
261
261
  )
262
262
  comment: Optional[str] = Field(
263
- None, description='Comment about the verifier', title='Comment'
263
+ None, description="Comment about the verifier", title="Comment"
264
264
  )
265
265
  success: bool = Field(
266
- ..., description='Whether the verification was successful', title='Success'
266
+ ..., description="Whether the verification was successful", title="Success"
267
267
  )
268
268
  result: Optional[Any] = Field(
269
- None, description='The return value of the function', title='Result'
269
+ None, description="The return value of the function", title="Result"
270
270
  )
271
271
  error: Optional[Dict[str, Any]] = Field(
272
- None, description='Error details if verification failed', title='Error'
272
+ None, description="Error details if verification failed", title="Error"
273
273
  )
274
274
  execution_time_ms: int = Field(
275
- ..., description='Execution time in milliseconds', title='Execution Time Ms'
275
+ ..., description="Execution time in milliseconds", title="Execution Time Ms"
276
276
  )
277
277
  bundle_cache_hit: Optional[bool] = Field(
278
278
  False,
279
- description='Whether the bundle was already cached',
280
- title='Bundle Cache Hit',
279
+ description="Whether the bundle was already cached",
280
+ title="Bundle Cache Hit",
281
281
  )
282
282
  stdout: Optional[str] = Field(
283
- None, description='Captured stdout from execution', title='Stdout'
283
+ None, description="Captured stdout from execution", title="Stdout"
284
284
  )
285
285
 
286
286
 
287
287
  class DescribeResponse(BaseModel):
288
- success: bool = Field(..., title='Success')
289
- resource_name: str = Field(..., title='Resource Name')
290
- tables: Optional[List[TableSchema]] = Field(None, title='Tables')
291
- error: Optional[str] = Field(None, title='Error')
292
- message: str = Field(..., title='Message')
288
+ success: bool = Field(..., title="Success")
289
+ resource_name: str = Field(..., title="Resource Name")
290
+ tables: Optional[List[TableSchema]] = Field(None, title="Tables")
291
+ error: Optional[str] = Field(None, title="Error")
292
+ message: str = Field(..., title="Message")
293
293
 
294
294
 
295
295
  class HTTPValidationError(BaseModel):
296
- detail: Optional[List[ValidationError]] = Field(None, title='Detail')
296
+ detail: Optional[List[ValidationError]] = Field(None, title="Detail")
297
297
 
298
298
 
299
299
  class InstanceURLs(BaseModel):
300
- root: str = Field(..., title='Root')
301
- app: List[str] = Field(..., title='App')
302
- api: Optional[str] = Field(None, title='Api')
303
- health: Optional[str] = Field(None, title='Health')
304
- api_docs: Optional[str] = Field(None, title='Api Docs')
300
+ root: str = Field(..., title="Root")
301
+ app: List[str] = Field(..., title="App")
302
+ api: Optional[str] = Field(None, title="Api")
303
+ health: Optional[str] = Field(None, title="Health")
304
+ api_docs: Optional[str] = Field(None, title="Api Docs")
305
305
  manager: ManagerURLs
306
306
 
307
307
 
308
308
  class Resource(BaseModel):
309
- name: str = Field(..., title='Name')
309
+ name: str = Field(..., title="Name")
310
310
  type: ResourceType
311
311
  mode: ResourceMode
312
- label: Optional[str] = Field(None, title='Label')
312
+ label: Optional[str] = Field(None, title="Label")
313
313
 
314
314
 
315
315
  class ResourcesResponse(BaseModel):
316
- resources: List[Resource] = Field(..., title='Resources')
316
+ resources: List[Resource] = Field(..., title="Resources")
317
317
 
318
318
 
319
319
  class TaskListResponse(BaseModel):
320
- tasks: List[TaskResponse] = Field(..., title='Tasks')
321
- total: int = Field(..., title='Total')
320
+ tasks: List[TaskResponse] = Field(..., title="Tasks")
321
+ total: int = Field(..., title="Total")
322
322
 
323
323
 
324
324
  class InstanceResponse(BaseModel):
325
- instance_id: str = Field(..., title='Instance Id')
326
- env_key: str = Field(..., title='Env Key')
327
- version: str = Field(..., title='Version')
328
- status: str = Field(..., title='Status')
329
- subdomain: str = Field(..., title='Subdomain')
330
- created_at: str = Field(..., title='Created At')
331
- updated_at: str = Field(..., title='Updated At')
332
- terminated_at: Optional[str] = Field(None, title='Terminated At')
333
- team_id: str = Field(..., title='Team Id')
334
- region: str = Field(..., title='Region')
335
- env_variables: Optional[Dict[str, Any]] = Field(None, title='Env Variables')
336
- urls: Optional[InstanceURLs] = Field(None, title='Urls')
337
- health: Optional[bool] = Field(None, title='Health')
325
+ instance_id: str = Field(..., title="Instance Id")
326
+ env_key: str = Field(..., title="Env Key")
327
+ version: str = Field(..., title="Version")
328
+ status: str = Field(..., title="Status")
329
+ subdomain: str = Field(..., title="Subdomain")
330
+ created_at: str = Field(..., title="Created At")
331
+ updated_at: str = Field(..., title="Updated At")
332
+ terminated_at: Optional[str] = Field(None, title="Terminated At")
333
+ team_id: str = Field(..., title="Team Id")
334
+ region: str = Field(..., title="Region")
335
+ env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
336
+ urls: Optional[InstanceURLs] = Field(None, title="Urls")
337
+ health: Optional[bool] = Field(None, title="Health")
338
+
338
339
 
339
340
  class AccountResponse(BaseModel):
340
- team_id: str = Field(..., title='Team Id')
341
- team_name: str = Field(..., title='Team Name')
342
- instance_limit: int = Field(..., title='Instance Limit')
343
- instance_count: int = Field(..., title='Instance Count')
341
+ team_id: str = Field(..., title="Team Id")
342
+ team_name: str = Field(..., title="Team Name")
343
+ instance_limit: int = Field(..., title="Instance Limit")
344
+ instance_count: int = Field(..., title="Instance Count")
fleet/resources/base.py CHANGED
@@ -21,6 +21,6 @@ class Resource(ABC):
21
21
  @property
22
22
  def mode(self) -> ResourceMode:
23
23
  return self.resource.mode
24
-
24
+
25
25
  def __repr__(self) -> str:
26
26
  return f"Resource(uri={self.uri}, mode={self.mode.value})"
fleet/resources/mcp.py CHANGED
@@ -1,8 +1,7 @@
1
1
  from typing import Dict
2
- import json
3
2
 
4
3
 
5
- class MCPResource:
4
+ class SyncMCPResource:
6
5
  def __init__(self, url: str, env_key: str):
7
6
  self.url = url
8
7
  self._env_key = env_key
@@ -22,29 +21,25 @@ class MCPResource:
22
21
  "name": self._env_key,
23
22
  }
24
23
 
25
- async def list_tools(self):
24
+ def list_tools(self):
26
25
  import aiohttp
26
+
27
27
  """
28
28
  Make an async request to list available tools from the MCP endpoint.
29
29
 
30
30
  Returns:
31
31
  List of available tools with name, description, and input_schema
32
32
  """
33
- async with aiohttp.ClientSession() as session:
34
- payload = {
35
- "jsonrpc": "2.0",
36
- "method": "tools/list",
37
- "params": {},
38
- "id": 2
39
- }
40
-
41
- async with session.post(self.url, json=payload) as response:
42
- data = await response.json()
43
-
33
+ with aiohttp.ClientSession() as session:
34
+ payload = {"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 2}
35
+
36
+ with session.post(self.url, json=payload) as response:
37
+ data = response.json()
38
+
44
39
  # Extract tools from the response
45
40
  if "result" in data and "tools" in data["result"]:
46
41
  tools = data["result"]["tools"]
47
-
42
+
48
43
  available_tools = [
49
44
  {
50
45
  "name": tool.get("name"),
@@ -53,7 +48,7 @@ class MCPResource:
53
48
  }
54
49
  for tool in tools
55
50
  ]
56
-
51
+
57
52
  return available_tools
58
53
  else:
59
54
  # Handle error or empty response