fleet-python 0.2.64__tar.gz → 0.2.66__tar.gz
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_python-0.2.64/fleet_python.egg-info → fleet_python-0.2.66}/PKG-INFO +1 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/export_tasks.py +11 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/import_tasks.py +15 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/client.py +3 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/models.py +5 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/tasks.py +23 -15
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/client.py +3 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/models.py +5 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/tasks.py +18 -14
- {fleet_python-0.2.64 → fleet_python-0.2.66/fleet_python.egg-info}/PKG-INFO +1 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/pyproject.toml +1 -1
- {fleet_python-0.2.64 → fleet_python-0.2.66}/LICENSE +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/README.md +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/diff_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/dsl_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/exampleResume.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_account.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_action_log.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_mcp_anthropic.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_mcp_openai.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_sync.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_task.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_tasks.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/example_verifier.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/gemini_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/json_tasks_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/nova_act_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/openai_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/openai_simple_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/query_builder_example.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/quickstart.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/examples/test_cdp_logging.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/env/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/env/client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/exceptions.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/global_client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/instance/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/instance/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/instance/client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/resources/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/resources/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/resources/browser.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/resources/mcp.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/resources/sqlite.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/verifiers/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/verifiers/bundler.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/_async/verifiers/verifier.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/config.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/env/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/env/client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/exceptions.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/global_client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/instance/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/instance/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/instance/client.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/instance/models.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/resources/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/resources/base.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/resources/browser.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/resources/mcp.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/resources/sqlite.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/types.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/bundler.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/code.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/db.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/decorator.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/parse.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/sql_differ.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet/verifiers/verifier.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet_python.egg-info/SOURCES.txt +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet_python.egg-info/dependency_links.txt +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet_python.egg-info/requires.txt +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/fleet_python.egg-info/top_level.txt +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/scripts/fix_sync_imports.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/scripts/unasync.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/setup.cfg +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/tests/__init__.py +0 -0
- {fleet_python-0.2.64 → fleet_python-0.2.66}/tests/test_verifier_from_string.py +0 -0
|
@@ -27,6 +27,12 @@ def main():
|
|
|
27
27
|
help="Optional task project key to filter tasks",
|
|
28
28
|
default=None,
|
|
29
29
|
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--env-key",
|
|
32
|
+
"-e",
|
|
33
|
+
help="Optional environment key to filter tasks",
|
|
34
|
+
default=None,
|
|
35
|
+
)
|
|
30
36
|
parser.add_argument(
|
|
31
37
|
"--output",
|
|
32
38
|
"-o",
|
|
@@ -42,12 +48,13 @@ def main():
|
|
|
42
48
|
args.project_key is not None,
|
|
43
49
|
args.task_keys is not None,
|
|
44
50
|
args.task_project_key is not None,
|
|
51
|
+
args.env_key is not None,
|
|
45
52
|
]
|
|
46
53
|
)
|
|
47
54
|
|
|
48
55
|
if filters_specified > 1:
|
|
49
56
|
parser.error(
|
|
50
|
-
"Cannot specify multiple filters. Use only one of --project-key, --task-keys,
|
|
57
|
+
"Cannot specify multiple filters. Use only one of --project-key, --task-keys, --task-project-key, or --env-key."
|
|
51
58
|
)
|
|
52
59
|
|
|
53
60
|
# Get account info
|
|
@@ -66,6 +73,9 @@ def main():
|
|
|
66
73
|
elif args.task_project_key:
|
|
67
74
|
print(f"Loading tasks from task project: {args.task_project_key}")
|
|
68
75
|
tasks = fleet.load_tasks(task_project_key=args.task_project_key)
|
|
76
|
+
elif args.env_key:
|
|
77
|
+
print(f"Loading tasks from environment: {args.env_key}")
|
|
78
|
+
tasks = fleet.load_tasks(env_key=args.env_key)
|
|
69
79
|
else:
|
|
70
80
|
print("Loading all tasks")
|
|
71
81
|
tasks = fleet.load_tasks()
|
|
@@ -210,9 +210,18 @@ async def main():
|
|
|
210
210
|
action="store_true",
|
|
211
211
|
help="Skip the verifier sanity check (not recommended)",
|
|
212
212
|
)
|
|
213
|
+
parser.add_argument(
|
|
214
|
+
"--sanity-check-only",
|
|
215
|
+
action="store_true",
|
|
216
|
+
help="Only run the sanity check without importing tasks",
|
|
217
|
+
)
|
|
213
218
|
|
|
214
219
|
args = parser.parse_args()
|
|
215
220
|
|
|
221
|
+
# Validate conflicting flags
|
|
222
|
+
if args.skip_sanity_check and args.sanity_check_only:
|
|
223
|
+
parser.error("Cannot use --skip-sanity-check and --sanity-check-only together")
|
|
224
|
+
|
|
216
225
|
# Load and parse the JSON file
|
|
217
226
|
try:
|
|
218
227
|
with open(args.json_file, "r", encoding="utf-8") as f:
|
|
@@ -286,6 +295,12 @@ async def main():
|
|
|
286
295
|
success, errors = await run_verifier_sanity_check(tasks, client)
|
|
287
296
|
if not success:
|
|
288
297
|
sys.exit(1)
|
|
298
|
+
|
|
299
|
+
# If only doing sanity check, exit successfully here
|
|
300
|
+
if args.sanity_check_only:
|
|
301
|
+
print("\n✓ Sanity check complete! (--sanity-check-only)")
|
|
302
|
+
print("Tasks are ready to import.")
|
|
303
|
+
sys.exit(0)
|
|
289
304
|
else:
|
|
290
305
|
print("\n⚠️ Skipping sanity check (--skip-sanity-check)")
|
|
291
306
|
|
|
@@ -708,6 +708,7 @@ class AsyncFleet:
|
|
|
708
708
|
task_key: str,
|
|
709
709
|
prompt: Optional[str] = None,
|
|
710
710
|
verifier_code: Optional[str] = None,
|
|
711
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
711
712
|
) -> TaskResponse:
|
|
712
713
|
"""Update an existing task.
|
|
713
714
|
|
|
@@ -715,11 +716,12 @@ class AsyncFleet:
|
|
|
715
716
|
task_key: The key of the task to update
|
|
716
717
|
prompt: New prompt text for the task (optional)
|
|
717
718
|
verifier_code: Python code for task verification (optional)
|
|
719
|
+
metadata: Additional metadata for the task (optional)
|
|
718
720
|
|
|
719
721
|
Returns:
|
|
720
722
|
TaskResponse containing the updated task details
|
|
721
723
|
"""
|
|
722
|
-
payload = TaskUpdateRequest(prompt=prompt, verifier_code=verifier_code)
|
|
724
|
+
payload = TaskUpdateRequest(prompt=prompt, verifier_code=verifier_code, metadata=metadata)
|
|
723
725
|
response = await self.client.request(
|
|
724
726
|
"PUT", f"/v1/tasks/{task_key}", json=payload.model_dump(exclude_none=True)
|
|
725
727
|
)
|
|
@@ -155,12 +155,14 @@ class TaskRequest(BaseModel):
|
|
|
155
155
|
verifier_id: Optional[str] = Field(None, title="Verifier Id")
|
|
156
156
|
version: Optional[str] = Field(None, title="Version")
|
|
157
157
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
158
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
158
159
|
output_json_schema: Optional[Dict[str, Any]] = Field(None, title="Output Json Schema")
|
|
159
160
|
|
|
160
161
|
|
|
161
162
|
class TaskUpdateRequest(BaseModel):
|
|
162
163
|
prompt: Optional[str] = Field(None, title="Prompt")
|
|
163
164
|
verifier_code: Optional[str] = Field(None, title="Verifier Code")
|
|
165
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
164
166
|
|
|
165
167
|
|
|
166
168
|
class VerifierData(BaseModel):
|
|
@@ -186,6 +188,7 @@ class TaskResponse(BaseModel):
|
|
|
186
188
|
data_version: Optional[str] = Field(None, title="Data Version")
|
|
187
189
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
188
190
|
verifier: Optional[VerifierData] = Field(None, title="Verifier")
|
|
191
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
189
192
|
output_json_schema: Optional[Dict[str, Any]] = Field(None, title="Output Json Schema")
|
|
190
193
|
|
|
191
194
|
|
|
@@ -349,6 +352,8 @@ class InstanceResponse(BaseModel):
|
|
|
349
352
|
team_id: str = Field(..., title="Team Id")
|
|
350
353
|
region: str = Field(..., title="Region")
|
|
351
354
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
355
|
+
data_key: Optional[str] = Field(None, title="Data Key")
|
|
356
|
+
data_version: Optional[str] = Field(None, title="Data Version")
|
|
352
357
|
urls: Optional[InstanceURLs] = Field(None, title="Urls")
|
|
353
358
|
health: Optional[bool] = Field(None, title="Health")
|
|
354
359
|
|
|
@@ -209,17 +209,19 @@ class Task(BaseModel):
|
|
|
209
209
|
)
|
|
210
210
|
self.verifier = verifier
|
|
211
211
|
|
|
212
|
-
async def make_env(
|
|
212
|
+
async def make_env(
|
|
213
|
+
self,
|
|
214
|
+
region: Optional[str] = None,
|
|
215
|
+
image_type: Optional[str] = None,
|
|
216
|
+
ttl_seconds: Optional[int] = None,
|
|
217
|
+
):
|
|
213
218
|
"""Create an environment instance for this task's environment.
|
|
214
219
|
|
|
215
|
-
Uses the task's env_id (and version if present) to create the env.
|
|
220
|
+
Alias for make() method. Uses the task's env_id (and version if present) to create the env.
|
|
216
221
|
"""
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
from .client import AsyncFleet
|
|
221
|
-
|
|
222
|
-
return await AsyncFleet().make(env_key=self.env_key, region=region)
|
|
222
|
+
return await self.make(
|
|
223
|
+
region=region, image_type=image_type, ttl_seconds=ttl_seconds
|
|
224
|
+
)
|
|
223
225
|
|
|
224
226
|
async def make(
|
|
225
227
|
self,
|
|
@@ -286,10 +288,10 @@ def verifier_from_string(
|
|
|
286
288
|
|
|
287
289
|
# Strip @verifier decorator if present to avoid double-wrapping
|
|
288
290
|
# Remove lines like: @verifier(key="...")
|
|
289
|
-
cleaned_code = re.sub(r
|
|
291
|
+
cleaned_code = re.sub(r"@verifier\([^)]*\)\s*\n", "", verifier_func)
|
|
290
292
|
# Also remove the verifier import if present
|
|
291
|
-
cleaned_code = re.sub(r
|
|
292
|
-
cleaned_code = re.sub(r
|
|
293
|
+
cleaned_code = re.sub(r"from fleet import.*verifier.*\n", "", cleaned_code)
|
|
294
|
+
cleaned_code = re.sub(r"import.*verifier.*\n", "", cleaned_code)
|
|
293
295
|
|
|
294
296
|
# Create a local namespace for executing the code
|
|
295
297
|
local_namespace = {
|
|
@@ -386,7 +388,7 @@ async def load_tasks(
|
|
|
386
388
|
|
|
387
389
|
|
|
388
390
|
async def update_task(
|
|
389
|
-
task_key: str, prompt: Optional[str] = None, verifier_code: Optional[str] = None
|
|
391
|
+
task_key: str, prompt: Optional[str] = None, verifier_code: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None
|
|
390
392
|
):
|
|
391
393
|
"""Convenience function to update an existing task.
|
|
392
394
|
|
|
@@ -394,6 +396,7 @@ async def update_task(
|
|
|
394
396
|
task_key: The key of the task to update
|
|
395
397
|
prompt: New prompt text for the task (optional)
|
|
396
398
|
verifier_code: Python code for task verification (optional)
|
|
399
|
+
metadata: Additional metadata for the task (optional)
|
|
397
400
|
|
|
398
401
|
Returns:
|
|
399
402
|
TaskResponse containing the updated task details
|
|
@@ -401,16 +404,19 @@ async def update_task(
|
|
|
401
404
|
Examples:
|
|
402
405
|
response = await fleet.update_task("my-task", prompt="New prompt text")
|
|
403
406
|
response = await fleet.update_task("my-task", verifier_code="def verify(env): return True")
|
|
407
|
+
response = await fleet.update_task("my-task", metadata={"seed": 42, "story": "Updated story"})
|
|
404
408
|
"""
|
|
405
409
|
from .global_client import get_client
|
|
406
410
|
|
|
407
411
|
client = get_client()
|
|
408
412
|
return await client.update_task(
|
|
409
|
-
task_key=task_key, prompt=prompt, verifier_code=verifier_code
|
|
413
|
+
task_key=task_key, prompt=prompt, verifier_code=verifier_code, metadata=metadata
|
|
410
414
|
)
|
|
411
415
|
|
|
412
416
|
|
|
413
|
-
async def get_task(
|
|
417
|
+
async def get_task(
|
|
418
|
+
task_key: str, version_id: Optional[str] = None, team_id: Optional[str] = None
|
|
419
|
+
):
|
|
414
420
|
"""Convenience function to get a task by key and optional version.
|
|
415
421
|
|
|
416
422
|
Args:
|
|
@@ -429,7 +435,9 @@ async def get_task(task_key: str, version_id: Optional[str] = None, team_id: Opt
|
|
|
429
435
|
from .global_client import get_client
|
|
430
436
|
|
|
431
437
|
client = get_client()
|
|
432
|
-
return await client.get_task(
|
|
438
|
+
return await client.get_task(
|
|
439
|
+
task_key=task_key, version_id=version_id, team_id=team_id
|
|
440
|
+
)
|
|
433
441
|
|
|
434
442
|
|
|
435
443
|
async def import_task(task: Task, project_key: Optional[str] = None):
|
|
@@ -706,6 +706,7 @@ class Fleet:
|
|
|
706
706
|
task_key: str,
|
|
707
707
|
prompt: Optional[str] = None,
|
|
708
708
|
verifier_code: Optional[str] = None,
|
|
709
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
709
710
|
) -> TaskResponse:
|
|
710
711
|
"""Update an existing task.
|
|
711
712
|
|
|
@@ -713,11 +714,12 @@ class Fleet:
|
|
|
713
714
|
task_key: The key of the task to update
|
|
714
715
|
prompt: New prompt text for the task (optional)
|
|
715
716
|
verifier_code: Python code for task verification (optional)
|
|
717
|
+
metadata: Additional metadata for the task (optional)
|
|
716
718
|
|
|
717
719
|
Returns:
|
|
718
720
|
TaskResponse containing the updated task details
|
|
719
721
|
"""
|
|
720
|
-
payload = TaskUpdateRequest(prompt=prompt, verifier_code=verifier_code)
|
|
722
|
+
payload = TaskUpdateRequest(prompt=prompt, verifier_code=verifier_code, metadata=metadata)
|
|
721
723
|
response = self.client.request(
|
|
722
724
|
"PUT", f"/v1/tasks/{task_key}", json=payload.model_dump(exclude_none=True)
|
|
723
725
|
)
|
|
@@ -158,6 +158,7 @@ class TaskRequest(BaseModel):
|
|
|
158
158
|
verifier_id: Optional[str] = Field(None, title="Verifier Id")
|
|
159
159
|
version: Optional[str] = Field(None, title="Version")
|
|
160
160
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
161
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
161
162
|
output_json_schema: Optional[Dict[str, Any]] = Field(
|
|
162
163
|
None, title="Output Json Schema"
|
|
163
164
|
)
|
|
@@ -166,6 +167,7 @@ class TaskRequest(BaseModel):
|
|
|
166
167
|
class TaskUpdateRequest(BaseModel):
|
|
167
168
|
prompt: Optional[str] = Field(None, title="Prompt")
|
|
168
169
|
verifier_code: Optional[str] = Field(None, title="Verifier Code")
|
|
170
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
169
171
|
|
|
170
172
|
|
|
171
173
|
class VerifierData(BaseModel):
|
|
@@ -191,6 +193,7 @@ class TaskResponse(BaseModel):
|
|
|
191
193
|
data_version: Optional[str] = Field(None, title="Data Version")
|
|
192
194
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
193
195
|
verifier: Optional[VerifierData] = Field(None, title="Verifier")
|
|
196
|
+
metadata: Optional[Dict[str, Any]] = Field(None, title="Metadata")
|
|
194
197
|
output_json_schema: Optional[Dict[str, Any]] = Field(
|
|
195
198
|
None, title="Output Json Schema"
|
|
196
199
|
)
|
|
@@ -356,6 +359,8 @@ class InstanceResponse(BaseModel):
|
|
|
356
359
|
team_id: str = Field(..., title="Team Id")
|
|
357
360
|
region: str = Field(..., title="Region")
|
|
358
361
|
env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables")
|
|
362
|
+
data_key: Optional[str] = Field(None, title="Data Key")
|
|
363
|
+
data_version: Optional[str] = Field(None, title="Data Version")
|
|
359
364
|
urls: Optional[InstanceURLs] = Field(None, title="Urls")
|
|
360
365
|
health: Optional[bool] = Field(None, title="Health")
|
|
361
366
|
|
|
@@ -202,17 +202,17 @@ class Task(BaseModel):
|
|
|
202
202
|
)
|
|
203
203
|
self.verifier = verifier
|
|
204
204
|
|
|
205
|
-
def make_env(
|
|
205
|
+
def make_env(
|
|
206
|
+
self,
|
|
207
|
+
region: Optional[str] = None,
|
|
208
|
+
image_type: Optional[str] = None,
|
|
209
|
+
ttl_seconds: Optional[int] = None,
|
|
210
|
+
):
|
|
206
211
|
"""Create an environment instance for this task's environment.
|
|
207
212
|
|
|
208
|
-
Uses the task's env_id (and version if present) to create the env.
|
|
213
|
+
Alias for make() method. Uses the task's env_id (and version if present) to create the env.
|
|
209
214
|
"""
|
|
210
|
-
|
|
211
|
-
raise ValueError("Task has no env_id defined")
|
|
212
|
-
# Deferred import to avoid circular dependencies
|
|
213
|
-
from .client import Fleet
|
|
214
|
-
|
|
215
|
-
return Fleet().make(env_key=self.env_key, region=region)
|
|
215
|
+
return self.make(region=region, image_type=image_type, ttl_seconds=ttl_seconds)
|
|
216
216
|
|
|
217
217
|
def make(
|
|
218
218
|
self,
|
|
@@ -279,10 +279,10 @@ def verifier_from_string(
|
|
|
279
279
|
|
|
280
280
|
# Strip @verifier decorator if present to avoid double-wrapping
|
|
281
281
|
# Remove lines like: @verifier(key="...")
|
|
282
|
-
cleaned_code = re.sub(r
|
|
282
|
+
cleaned_code = re.sub(r"@verifier\([^)]*\)\s*\n", "", verifier_func)
|
|
283
283
|
# Also remove the verifier import if present
|
|
284
|
-
cleaned_code = re.sub(r
|
|
285
|
-
cleaned_code = re.sub(r
|
|
284
|
+
cleaned_code = re.sub(r"from fleet import.*verifier.*\n", "", cleaned_code)
|
|
285
|
+
cleaned_code = re.sub(r"import.*verifier.*\n", "", cleaned_code)
|
|
286
286
|
|
|
287
287
|
# Create a globals namespace with all required imports
|
|
288
288
|
exec_globals = globals().copy()
|
|
@@ -389,7 +389,7 @@ def load_tasks(
|
|
|
389
389
|
|
|
390
390
|
|
|
391
391
|
def update_task(
|
|
392
|
-
task_key: str, prompt: Optional[str] = None, verifier_code: Optional[str] = None
|
|
392
|
+
task_key: str, prompt: Optional[str] = None, verifier_code: Optional[str] = None, metadata: Optional[Dict[str, Any]] = None
|
|
393
393
|
):
|
|
394
394
|
"""Convenience function to update an existing task.
|
|
395
395
|
|
|
@@ -397,6 +397,7 @@ def update_task(
|
|
|
397
397
|
task_key: The key of the task to update
|
|
398
398
|
prompt: New prompt text for the task (optional)
|
|
399
399
|
verifier_code: Python code for task verification (optional)
|
|
400
|
+
metadata: Additional metadata for the task (optional)
|
|
400
401
|
|
|
401
402
|
Returns:
|
|
402
403
|
TaskResponse containing the updated task details
|
|
@@ -404,16 +405,19 @@ def update_task(
|
|
|
404
405
|
Examples:
|
|
405
406
|
response = fleet.update_task("my-task", prompt="New prompt text")
|
|
406
407
|
response = fleet.update_task("my-task", verifier_code="def verify(env): return True")
|
|
408
|
+
response = fleet.update_task("my-task", metadata={"seed": 42, "story": "Updated story"})
|
|
407
409
|
"""
|
|
408
410
|
from .global_client import get_client
|
|
409
411
|
|
|
410
412
|
client = get_client()
|
|
411
413
|
return client.update_task(
|
|
412
|
-
task_key=task_key, prompt=prompt, verifier_code=verifier_code
|
|
414
|
+
task_key=task_key, prompt=prompt, verifier_code=verifier_code, metadata=metadata
|
|
413
415
|
)
|
|
414
416
|
|
|
415
417
|
|
|
416
|
-
def get_task(
|
|
418
|
+
def get_task(
|
|
419
|
+
task_key: str, version_id: Optional[str] = None, team_id: Optional[str] = None
|
|
420
|
+
):
|
|
417
421
|
"""Convenience function to get a task by key and optional version.
|
|
418
422
|
|
|
419
423
|
Args:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|