fleet-python 0.2.29__tar.gz → 0.2.32__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.29/fleet_python.egg-info → fleet_python-0.2.32}/PKG-INFO +9 -9
- {fleet_python-0.2.29 → fleet_python-0.2.32}/README.md +8 -8
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/diff_example.py +30 -20
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/dsl_example.py +12 -7
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example.py +4 -4
- fleet_python-0.2.32/examples/example_account.py +8 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_action_log.py +2 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_client.py +2 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_mcp_anthropic.py +8 -5
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_mcp_openai.py +2 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_sync.py +4 -4
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_task.py +16 -6
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_tasks.py +3 -6
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/example_verifier.py +16 -3
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/gemini_example.py +6 -6
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/json_tasks_example.py +2 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/nova_act_example.py +2 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/openai_example.py +3 -3
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/openai_simple_example.py +3 -3
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/query_builder_example.py +11 -7
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/__init__.py +60 -5
- fleet_python-0.2.32/fleet/_async/__init__.py +258 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/base.py +2 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/client.py +164 -144
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/env/client.py +2 -0
- fleet_python-0.2.32/fleet/_async/global_client.py +43 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/instance/client.py +1 -1
- fleet_python-0.2.32/fleet/_async/models.py +344 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/resources/base.py +1 -1
- {fleet_python-0.2.29/fleet → fleet_python-0.2.32/fleet/_async}/resources/mcp.py +7 -12
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/resources/sqlite.py +141 -130
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/tasks.py +69 -16
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/verifiers/__init__.py +2 -2
- {fleet_python-0.2.29/fleet → fleet_python-0.2.32/fleet/_async}/verifiers/bundler.py +18 -14
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/verifiers/verifier.py +77 -71
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/base.py +2 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/client.py +145 -158
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/config.py +3 -2
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/env/__init__.py +9 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/env/client.py +3 -0
- fleet_python-0.2.32/fleet/global_client.py +43 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/instance/__init__.py +1 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/instance/client.py +2 -4
- fleet_python-0.2.32/fleet/models.py +344 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/resources/base.py +1 -1
- fleet_python-0.2.32/fleet/resources/mcp.py +54 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/resources/sqlite.py +136 -131
- fleet_python-0.2.32/fleet/tasks.py +263 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/types.py +1 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/__init__.py +2 -2
- {fleet_python-0.2.29/fleet/_async → fleet_python-0.2.32/fleet}/verifiers/bundler.py +18 -14
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/code.py +1 -1
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/decorator.py +25 -34
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/parse.py +98 -68
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/verifier.py +77 -78
- {fleet_python-0.2.29 → fleet_python-0.2.32/fleet_python.egg-info}/PKG-INFO +9 -9
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet_python.egg-info/SOURCES.txt +4 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/pyproject.toml +1 -1
- fleet_python-0.2.32/scripts/fix_sync_imports.py +162 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/scripts/unasync.py +10 -9
- fleet_python-0.2.29/fleet/_async/__init__.py +0 -1
- fleet_python-0.2.29/fleet/_async/models.py +0 -343
- fleet_python-0.2.29/fleet/models.py +0 -343
- fleet_python-0.2.29/fleet/tasks.py +0 -84
- fleet_python-0.2.29/scripts/fix_sync_imports.py +0 -134
- {fleet_python-0.2.29 → fleet_python-0.2.32}/LICENSE +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/examples/quickstart.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/env/__init__.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/exceptions.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/instance/__init__.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/instance/base.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/resources/__init__.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/_async/resources/browser.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/exceptions.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/instance/base.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/instance/models.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/resources/__init__.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/resources/browser.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/db.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet/verifiers/sql_differ.py +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet_python.egg-info/dependency_links.txt +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet_python.egg-info/requires.txt +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/fleet_python.egg-info/top_level.txt +0 -0
- {fleet_python-0.2.29 → fleet_python-0.2.32}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fleet-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.32
|
|
4
4
|
Summary: Python SDK for Fleet environments
|
|
5
5
|
Author-email: Fleet AI <nic@fleet.so>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -65,11 +65,11 @@ export FLEET_API_KEY="sk_your_key_here"
|
|
|
65
65
|
## Basic Usage
|
|
66
66
|
|
|
67
67
|
```python
|
|
68
|
-
import fleet
|
|
68
|
+
import fleet
|
|
69
69
|
import datetime
|
|
70
70
|
|
|
71
71
|
# Create environment by key
|
|
72
|
-
env =
|
|
72
|
+
env = fleet.env.make("fira")
|
|
73
73
|
|
|
74
74
|
# Reset environment with seed and options
|
|
75
75
|
env.reset(
|
|
@@ -91,10 +91,10 @@ env.close()
|
|
|
91
91
|
|
|
92
92
|
```python
|
|
93
93
|
# Create environment instance with explicit version
|
|
94
|
-
env =
|
|
94
|
+
env = fleet.env.make("fira:v1.2.5")
|
|
95
95
|
|
|
96
96
|
# Create environment instance with default (latest) version
|
|
97
|
-
env =
|
|
97
|
+
env = fleet.env.make("fira")
|
|
98
98
|
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -102,18 +102,18 @@ env = flt.env.make("fira")
|
|
|
102
102
|
|
|
103
103
|
```python
|
|
104
104
|
# Connect to a running instance
|
|
105
|
-
env =
|
|
105
|
+
env = fleet.env.get("env_instance_id")
|
|
106
106
|
|
|
107
107
|
# List all running instances
|
|
108
|
-
instances =
|
|
108
|
+
instances = fleet.env.list_instances()
|
|
109
109
|
for instance in instances:
|
|
110
110
|
print(f"Instance: {instance.instance_id}")
|
|
111
111
|
print(f"Type: {instance.environment_type}")
|
|
112
112
|
print(f"Status: {instance.status}")
|
|
113
113
|
|
|
114
114
|
# Filter instances by status (running, pending, stopped, error)
|
|
115
|
-
running_instances =
|
|
115
|
+
running_instances = fleet.env.list_instances(status_filter="running")
|
|
116
116
|
|
|
117
117
|
# List available environment types
|
|
118
|
-
available_envs =
|
|
118
|
+
available_envs = fleet.env.list_envs()
|
|
119
119
|
```
|
|
@@ -23,11 +23,11 @@ export FLEET_API_KEY="sk_your_key_here"
|
|
|
23
23
|
## Basic Usage
|
|
24
24
|
|
|
25
25
|
```python
|
|
26
|
-
import fleet
|
|
26
|
+
import fleet
|
|
27
27
|
import datetime
|
|
28
28
|
|
|
29
29
|
# Create environment by key
|
|
30
|
-
env =
|
|
30
|
+
env = fleet.env.make("fira")
|
|
31
31
|
|
|
32
32
|
# Reset environment with seed and options
|
|
33
33
|
env.reset(
|
|
@@ -49,10 +49,10 @@ env.close()
|
|
|
49
49
|
|
|
50
50
|
```python
|
|
51
51
|
# Create environment instance with explicit version
|
|
52
|
-
env =
|
|
52
|
+
env = fleet.env.make("fira:v1.2.5")
|
|
53
53
|
|
|
54
54
|
# Create environment instance with default (latest) version
|
|
55
|
-
env =
|
|
55
|
+
env = fleet.env.make("fira")
|
|
56
56
|
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -60,18 +60,18 @@ env = flt.env.make("fira")
|
|
|
60
60
|
|
|
61
61
|
```python
|
|
62
62
|
# Connect to a running instance
|
|
63
|
-
env =
|
|
63
|
+
env = fleet.env.get("env_instance_id")
|
|
64
64
|
|
|
65
65
|
# List all running instances
|
|
66
|
-
instances =
|
|
66
|
+
instances = fleet.env.list_instances()
|
|
67
67
|
for instance in instances:
|
|
68
68
|
print(f"Instance: {instance.instance_id}")
|
|
69
69
|
print(f"Type: {instance.environment_type}")
|
|
70
70
|
print(f"Status: {instance.status}")
|
|
71
71
|
|
|
72
72
|
# Filter instances by status (running, pending, stopped, error)
|
|
73
|
-
running_instances =
|
|
73
|
+
running_instances = fleet.env.list_instances(status_filter="running")
|
|
74
74
|
|
|
75
75
|
# List available environment types
|
|
76
|
-
available_envs =
|
|
76
|
+
available_envs = fleet.env.list_envs()
|
|
77
77
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from fleet.verifiers import IgnoreConfig
|
|
4
4
|
from dotenv import load_dotenv
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ load_dotenv()
|
|
|
9
9
|
async def main():
|
|
10
10
|
# Create a new instance
|
|
11
11
|
print("Creating new Hubspot instance...")
|
|
12
|
-
env = await
|
|
12
|
+
env = await fleet.env.make_async("hubspot:v1.2.7")
|
|
13
13
|
print(f"New Instance: {env.instance_id}")
|
|
14
14
|
|
|
15
15
|
try:
|
|
@@ -24,14 +24,14 @@ async def main():
|
|
|
24
24
|
print("\n=== Taking Initial Snapshot ===")
|
|
25
25
|
snapshot1 = await db.snapshot("initial_state")
|
|
26
26
|
print(f"Snapshot created: {snapshot1.name}")
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
# Show current entries
|
|
29
29
|
entries_count = await db.table("entries").count()
|
|
30
30
|
print(f"Initial entry count: {entries_count}")
|
|
31
31
|
|
|
32
32
|
# Make some changes
|
|
33
33
|
print("\n=== Making Database Changes ===")
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
# 1. Insert a new deal
|
|
36
36
|
print("\n1. Inserting new deal...")
|
|
37
37
|
await db.exec("""
|
|
@@ -48,7 +48,7 @@ async def main():
|
|
|
48
48
|
'{}'
|
|
49
49
|
)
|
|
50
50
|
""")
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
# 2. Update an existing entry
|
|
53
53
|
print("2. Updating existing entry...")
|
|
54
54
|
await db.exec("""
|
|
@@ -56,7 +56,7 @@ async def main():
|
|
|
56
56
|
SET name = 'Updated Contact Name'
|
|
57
57
|
WHERE id = 1
|
|
58
58
|
""")
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
# 3. Insert another entry
|
|
61
61
|
print("3. Inserting another deal...")
|
|
62
62
|
await db.exec("""
|
|
@@ -78,21 +78,26 @@ async def main():
|
|
|
78
78
|
print("\n=== Taking Second Snapshot ===")
|
|
79
79
|
snapshot2 = await db.snapshot("after_changes")
|
|
80
80
|
print(f"Snapshot created: {snapshot2.name}")
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
new_entries_count = await db.table("entries").count()
|
|
83
83
|
print(f"New entry count: {new_entries_count}")
|
|
84
84
|
|
|
85
85
|
# Compare snapshots
|
|
86
86
|
print("\n=== Comparing Snapshots ===")
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
# Configure what to ignore in diff
|
|
89
89
|
ignore_config = IgnoreConfig(
|
|
90
90
|
tables={"pageviews"}, # Ignore entire pageviews table
|
|
91
|
-
fields={
|
|
91
|
+
fields={
|
|
92
|
+
"createdDate",
|
|
93
|
+
"lastModifiedDate",
|
|
94
|
+
"createdAt",
|
|
95
|
+
"updatedAt",
|
|
96
|
+
}, # Ignore timestamp fields
|
|
92
97
|
)
|
|
93
|
-
|
|
98
|
+
|
|
94
99
|
diff = await snapshot1.diff(snapshot2, ignore_config)
|
|
95
|
-
|
|
100
|
+
|
|
96
101
|
# Test 1: Validate all expected changes
|
|
97
102
|
print("\nTest 1: Validating expected changes...")
|
|
98
103
|
expected_changes = [
|
|
@@ -100,9 +105,14 @@ async def main():
|
|
|
100
105
|
{"table": "entries", "pk": 99001, "field": None, "after": "__added__"},
|
|
101
106
|
{"table": "entries", "pk": 99002, "field": None, "after": "__added__"},
|
|
102
107
|
# Name updated
|
|
103
|
-
{
|
|
108
|
+
{
|
|
109
|
+
"table": "entries",
|
|
110
|
+
"pk": 1,
|
|
111
|
+
"field": "name",
|
|
112
|
+
"after": "Updated Contact Name",
|
|
113
|
+
},
|
|
104
114
|
]
|
|
105
|
-
|
|
115
|
+
|
|
106
116
|
try:
|
|
107
117
|
await diff.expect_only(expected_changes)
|
|
108
118
|
print("✓ All changes validated successfully!")
|
|
@@ -115,7 +125,7 @@ async def main():
|
|
|
115
125
|
{"table": "entries", "pk": 99001, "field": None, "after": "__added__"},
|
|
116
126
|
# Missing the second insert and the update
|
|
117
127
|
]
|
|
118
|
-
|
|
128
|
+
|
|
119
129
|
try:
|
|
120
130
|
await diff.expect_only(incorrect_changes)
|
|
121
131
|
print("✗ This should have failed!")
|
|
@@ -125,29 +135,29 @@ async def main():
|
|
|
125
135
|
|
|
126
136
|
# Test 3: Query snapshot data directly
|
|
127
137
|
print("\n=== Querying Snapshot Data ===")
|
|
128
|
-
|
|
138
|
+
|
|
129
139
|
# Query from first snapshot
|
|
130
140
|
print("\nQuerying from initial snapshot:")
|
|
131
141
|
initial_entry = await snapshot1.table("entries").eq("id", 1).first()
|
|
132
142
|
if initial_entry:
|
|
133
143
|
print(f"Entry 1 name in snapshot1: {initial_entry['name']}")
|
|
134
|
-
|
|
144
|
+
|
|
135
145
|
# Query from second snapshot
|
|
136
146
|
print("\nQuerying from second snapshot:")
|
|
137
147
|
updated_entry = await snapshot2.table("entries").eq("id", 1).first()
|
|
138
148
|
if updated_entry:
|
|
139
149
|
print(f"Entry 1 name in snapshot2: {updated_entry['name']}")
|
|
140
|
-
|
|
150
|
+
|
|
141
151
|
# Count deals in each snapshot
|
|
142
152
|
deals_before = await snapshot1.table("entries").eq("type", "deal").all()
|
|
143
153
|
deals_after = await snapshot2.table("entries").eq("type", "deal").all()
|
|
144
154
|
print(f"\nDeals in snapshot1: {len(deals_before)}")
|
|
145
155
|
print(f"Deals in snapshot2: {len(deals_after)}")
|
|
146
|
-
|
|
156
|
+
|
|
147
157
|
# Show new deals
|
|
148
158
|
print("\nNew deals added:")
|
|
149
159
|
for deal in deals_after:
|
|
150
|
-
if deal[
|
|
160
|
+
if deal["id"] in [99001, 99002]:
|
|
151
161
|
print(f" - {deal['name']} (id: {deal['id']})")
|
|
152
162
|
|
|
153
163
|
finally:
|
|
@@ -158,4 +168,4 @@ async def main():
|
|
|
158
168
|
|
|
159
169
|
|
|
160
170
|
if __name__ == "__main__":
|
|
161
|
-
asyncio.run(main())
|
|
171
|
+
asyncio.run(main())
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from fleet.verifiers import DatabaseSnapshot, IgnoreConfig, TASK_SUCCESSFUL_SCORE
|
|
4
4
|
from dotenv import load_dotenv
|
|
5
5
|
|
|
@@ -68,7 +68,7 @@ def validate_new_deal_creation(
|
|
|
68
68
|
async def main():
|
|
69
69
|
# Create a new instance
|
|
70
70
|
print("Creating new Hubspot instance...")
|
|
71
|
-
env = await
|
|
71
|
+
env = await fleet.env.make_async("hubspot")
|
|
72
72
|
print(f"New Instance: {env.instance_id}")
|
|
73
73
|
|
|
74
74
|
try:
|
|
@@ -87,7 +87,7 @@ async def main():
|
|
|
87
87
|
# Get the database resource
|
|
88
88
|
await env.instance.load()
|
|
89
89
|
db = env.db()
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
# Take a snapshot before insertion
|
|
92
92
|
print("\nTaking snapshot before insertion...")
|
|
93
93
|
snapshot_before = await db.snapshot("before_insertion")
|
|
@@ -139,12 +139,17 @@ async def main():
|
|
|
139
139
|
ignore_config = IgnoreConfig(
|
|
140
140
|
tables={"pageviews"},
|
|
141
141
|
table_fields={
|
|
142
|
-
"entries": {
|
|
142
|
+
"entries": {
|
|
143
|
+
"createdDate",
|
|
144
|
+
"lastModifiedDate",
|
|
145
|
+
"createdAt",
|
|
146
|
+
"updatedAt",
|
|
147
|
+
},
|
|
143
148
|
},
|
|
144
149
|
)
|
|
145
|
-
|
|
150
|
+
|
|
146
151
|
diff = await snapshot_before.diff(snapshot_after, ignore_config)
|
|
147
|
-
|
|
152
|
+
|
|
148
153
|
# Check diff results
|
|
149
154
|
print("\nDiff validation:")
|
|
150
155
|
expected_changes = [
|
|
@@ -155,7 +160,7 @@ async def main():
|
|
|
155
160
|
"after": "__added__",
|
|
156
161
|
}
|
|
157
162
|
]
|
|
158
|
-
|
|
163
|
+
|
|
159
164
|
try:
|
|
160
165
|
await diff.expect_only(expected_changes)
|
|
161
166
|
print("✓ Diff validation passed - only expected changes detected")
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
"""Example demonstrating browser control with Fleet Manager Client."""
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
|
-
import fleet
|
|
5
|
+
import fleet
|
|
6
6
|
from dotenv import load_dotenv
|
|
7
7
|
|
|
8
8
|
load_dotenv()
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
async def main():
|
|
12
|
-
regions = await
|
|
12
|
+
regions = await fleet.env.list_regions_async()
|
|
13
13
|
print("Regions:", regions)
|
|
14
14
|
|
|
15
|
-
environments = await
|
|
15
|
+
environments = await fleet.env.list_envs_async()
|
|
16
16
|
print("Environments:", len(environments))
|
|
17
17
|
|
|
18
18
|
# Create a new instance
|
|
19
|
-
env = await
|
|
19
|
+
env = await fleet.env.make_async("hubspot")
|
|
20
20
|
print(f"New Instance: {env.instance_id} ({env.region})")
|
|
21
21
|
|
|
22
22
|
response = await env.reset(seed=42)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Example demonstrating browser control with Fleet Manager Client."""
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
|
-
import fleet
|
|
5
|
+
import fleet
|
|
6
6
|
from dotenv import load_dotenv
|
|
7
7
|
|
|
8
8
|
load_dotenv()
|
|
@@ -10,7 +10,7 @@ load_dotenv()
|
|
|
10
10
|
|
|
11
11
|
async def main():
|
|
12
12
|
# Create a new instance
|
|
13
|
-
env = await
|
|
13
|
+
env = await fleet.env.make_async("fira:v1.3.2")
|
|
14
14
|
print(f"New Instance: {env.instance_id} ({env.region})")
|
|
15
15
|
print("URL:", env.urls.app)
|
|
16
16
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"""Example demonstrating browser control with Fleet Manager Client."""
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
|
-
import fleet
|
|
5
|
+
import fleet
|
|
6
6
|
from dotenv import load_dotenv
|
|
7
7
|
|
|
8
8
|
load_dotenv()
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
async def main():
|
|
12
|
-
fleet =
|
|
12
|
+
fleet = fleet.AsyncFleet()
|
|
13
13
|
|
|
14
14
|
environments = await fleet.list_envs()
|
|
15
15
|
print("Environments:", len(environments))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from anthropic import AsyncAnthropic
|
|
4
4
|
from mcp import ClientSession
|
|
5
5
|
from mcp.client.streamable_http import streamablehttp_client
|
|
@@ -11,12 +11,14 @@ client = AsyncAnthropic()
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
async def main():
|
|
14
|
-
env =
|
|
14
|
+
env = fleet.env.make("fira")
|
|
15
15
|
print("Created environment:", env.urls.app)
|
|
16
16
|
print("MCP URL:", env.mcp.url)
|
|
17
17
|
|
|
18
18
|
async with streamablehttp_client(url=env.mcp.url) as streams:
|
|
19
|
-
async with ClientSession(
|
|
19
|
+
async with ClientSession(
|
|
20
|
+
read_stream=streams[0], write_stream=streams[1]
|
|
21
|
+
) as session:
|
|
20
22
|
await session.initialize()
|
|
21
23
|
|
|
22
24
|
list_tools = await session.list_tools()
|
|
@@ -29,7 +31,6 @@ async def main():
|
|
|
29
31
|
for tool in list_tools.tools
|
|
30
32
|
]
|
|
31
33
|
|
|
32
|
-
|
|
33
34
|
messages = [
|
|
34
35
|
{
|
|
35
36
|
"role": "user",
|
|
@@ -54,7 +55,9 @@ async def main():
|
|
|
54
55
|
|
|
55
56
|
result = await session.call_tool(tool_name, tool_args)
|
|
56
57
|
tool_results.append({"call": tool_name, "result": result})
|
|
57
|
-
output_text.append(
|
|
58
|
+
output_text.append(
|
|
59
|
+
f"[Calling tool {tool_name} with args {tool_args}]"
|
|
60
|
+
)
|
|
58
61
|
|
|
59
62
|
if hasattr(content, "text") and content.text:
|
|
60
63
|
messages.append({"role": "assistant", "content": content.text})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fleet
|
|
1
|
+
import fleet
|
|
2
2
|
from openai import OpenAI
|
|
3
3
|
from dotenv import load_dotenv
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ client = OpenAI()
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def main():
|
|
11
|
-
env =
|
|
11
|
+
env = fleet.env.make("fira")
|
|
12
12
|
print("Created environment:", env.urls.app)
|
|
13
13
|
print("MCP URL:", env.mcp.url)
|
|
14
14
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Example demonstrating browser control with Fleet Manager Client."""
|
|
3
3
|
|
|
4
|
-
import fleet
|
|
4
|
+
import fleet
|
|
5
5
|
from dotenv import load_dotenv
|
|
6
6
|
|
|
7
7
|
load_dotenv()
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def main():
|
|
11
|
-
environments =
|
|
11
|
+
environments = fleet.env.list_envs()
|
|
12
12
|
print("Environments:", len(environments))
|
|
13
13
|
|
|
14
|
-
instances =
|
|
14
|
+
instances = fleet.env.list_instances(status="running")
|
|
15
15
|
print("Instances:", len(instances))
|
|
16
16
|
|
|
17
17
|
# Create a new instance
|
|
18
|
-
env =
|
|
18
|
+
env = fleet.env.make("hubspot")
|
|
19
19
|
print("New Instance:", env.instance_id)
|
|
20
20
|
|
|
21
21
|
response = env.reset(seed=42)
|
|
@@ -26,13 +26,13 @@ def create_bug_issue_sync(
|
|
|
26
26
|
env, project_key: str = "SCRUM", issue_title: str = "Sample Bug"
|
|
27
27
|
) -> float:
|
|
28
28
|
"""Synchronous verifier for remote execution.
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
Note: This is designed for remote execution where env.db() returns sync resources.
|
|
31
31
|
"""
|
|
32
32
|
# Define constants locally for remote execution
|
|
33
33
|
TASK_SUCCESSFUL_SCORE = 1.0
|
|
34
34
|
TASK_FAILED_SCORE = 0.0
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
try:
|
|
37
37
|
# Get the database resource
|
|
38
38
|
db = env.db()
|
|
@@ -96,7 +96,9 @@ async def create_bug_issue_async(
|
|
|
96
96
|
async def main():
|
|
97
97
|
"""Run the task example."""
|
|
98
98
|
print("=== Fleet Task Example with Jira ===\n")
|
|
99
|
-
print(
|
|
99
|
+
print(
|
|
100
|
+
"Note: Both sync and async verifiers are now supported for remote execution.\n"
|
|
101
|
+
)
|
|
100
102
|
|
|
101
103
|
# Create task using the async verifier for local execution
|
|
102
104
|
task = Task(
|
|
@@ -111,7 +113,9 @@ async def main():
|
|
|
111
113
|
print(f" Key: {task.key}")
|
|
112
114
|
print(f" Prompt: {task.prompt}")
|
|
113
115
|
print(f" Environment: {task.env_id}")
|
|
114
|
-
print(
|
|
116
|
+
print(
|
|
117
|
+
f" Verifier: {task.verifier.key if hasattr(task.verifier, 'key') else 'create_bug_issue'}"
|
|
118
|
+
)
|
|
115
119
|
print(f" Created at: {task.created_at}")
|
|
116
120
|
print(f" Metadata: {task.metadata}")
|
|
117
121
|
print()
|
|
@@ -153,13 +157,16 @@ async def main():
|
|
|
153
157
|
# Test async verifier remote execution
|
|
154
158
|
print("Testing remote execution with async verifier...")
|
|
155
159
|
try:
|
|
156
|
-
result = await create_bug_issue_async.remote(
|
|
160
|
+
result = await create_bug_issue_async.remote(
|
|
161
|
+
env, project_key="SCRUM", issue_title="Login button not working"
|
|
162
|
+
)
|
|
157
163
|
print(f" ✓ Async remote check result: {result}")
|
|
158
164
|
except NotImplementedError as e:
|
|
159
165
|
print(f" ✓ Expected error: {e}")
|
|
160
166
|
except Exception as e:
|
|
161
167
|
print(f" ✗ Unexpected error: {e}")
|
|
162
168
|
import traceback
|
|
169
|
+
|
|
163
170
|
traceback.print_exc()
|
|
164
171
|
print()
|
|
165
172
|
|
|
@@ -185,7 +192,9 @@ async def main():
|
|
|
185
192
|
env, project_key="SCRUM", issue_title="Login button not working"
|
|
186
193
|
)
|
|
187
194
|
print(f" Final check result: {result}")
|
|
188
|
-
print(
|
|
195
|
+
print(
|
|
196
|
+
f" Task {'completed successfully' if result == TASK_SUCCESSFUL_SCORE else 'failed'}!"
|
|
197
|
+
)
|
|
189
198
|
print()
|
|
190
199
|
|
|
191
200
|
# Clean up
|
|
@@ -196,6 +205,7 @@ async def main():
|
|
|
196
205
|
except Exception as e:
|
|
197
206
|
print(f"✗ Error: {e}")
|
|
198
207
|
import traceback
|
|
208
|
+
|
|
199
209
|
traceback.print_exc()
|
|
200
210
|
|
|
201
211
|
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import fleet
|
|
1
|
+
import fleet
|
|
2
2
|
from dotenv import load_dotenv
|
|
3
3
|
|
|
4
4
|
load_dotenv()
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
client = flt.Fleet()
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
def main():
|
|
11
|
-
env =
|
|
8
|
+
env = fleet.env.make("fira")
|
|
12
9
|
|
|
13
|
-
tasks =
|
|
10
|
+
tasks = fleet.load_tasks(env_key="fira")
|
|
14
11
|
print(f"Loaded {len(tasks)} tasks")
|
|
15
12
|
|
|
16
13
|
for i, task in enumerate(tasks):
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import fleet
|
|
1
|
+
import fleet
|
|
2
2
|
from fleet.verifiers.verifier import verifier
|
|
3
3
|
from fleet.verifiers.db import IgnoreConfig
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
@verifier(key="validate_finish_blue_green_deployment")
|
|
7
7
|
def validate_finish_blue_green_deployment(
|
|
8
|
-
env
|
|
8
|
+
env, final_answer: str | None = None
|
|
9
9
|
) -> int:
|
|
10
10
|
"""Validate that DEBT-722 and DEBT-720 are marked as Done"""
|
|
11
|
+
# Ensure resources are loaded for remote execution
|
|
12
|
+
env.instance.load()
|
|
11
13
|
before = env.db("seed")
|
|
12
14
|
after = env.db("current")
|
|
13
15
|
|
|
16
|
+
print("test")
|
|
17
|
+
|
|
14
18
|
# Check final state
|
|
15
19
|
try:
|
|
16
20
|
after.table("issues").eq("id", "DEBT-722").assert_eq("board_list", "Done")
|
|
@@ -58,8 +62,17 @@ def validate_finish_blue_green_deployment(
|
|
|
58
62
|
|
|
59
63
|
|
|
60
64
|
def main():
|
|
61
|
-
env =
|
|
65
|
+
env = fleet.env.make("fira")
|
|
62
66
|
print(f"New Instance: {env.instance_id}")
|
|
67
|
+
|
|
68
|
+
# Check available resources
|
|
69
|
+
try:
|
|
70
|
+
resources = env.instance.resources()
|
|
71
|
+
print("Available resources:")
|
|
72
|
+
for resource in resources:
|
|
73
|
+
print(f" - {resource.type}: {resource.name}")
|
|
74
|
+
except Exception as e:
|
|
75
|
+
print(f"Could not list resources: {e}")
|
|
63
76
|
|
|
64
77
|
print(validate_finish_blue_green_deployment(env))
|
|
65
78
|
print(validate_finish_blue_green_deployment.remote(env))
|
|
@@ -5,7 +5,7 @@ from typing import List, Dict, Any, Optional, Tuple, TypedDict
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from google import genai
|
|
7
7
|
from google.genai import types
|
|
8
|
-
import fleet
|
|
8
|
+
import fleet
|
|
9
9
|
from dotenv import load_dotenv
|
|
10
10
|
import base64
|
|
11
11
|
import re
|
|
@@ -30,7 +30,7 @@ class Problem(TypedDict):
|
|
|
30
30
|
class GeminiAgent:
|
|
31
31
|
def __init__(
|
|
32
32
|
self,
|
|
33
|
-
browser:
|
|
33
|
+
browser: fleet.FleetPlaywrightWrapper,
|
|
34
34
|
model: str = MODEL,
|
|
35
35
|
print_steps: bool = True,
|
|
36
36
|
debug: bool = False,
|
|
@@ -262,13 +262,13 @@ def evaluate_problem(
|
|
|
262
262
|
|
|
263
263
|
try:
|
|
264
264
|
# Create environment
|
|
265
|
-
env =
|
|
265
|
+
env = fleet.env.make(env_key)
|
|
266
266
|
print(
|
|
267
267
|
f"[Problem {problem_idx + 1}/{total_problems}] Created environment for {problem['id']}: {env.urls.app}"
|
|
268
268
|
)
|
|
269
269
|
|
|
270
270
|
# Create browser wrapper
|
|
271
|
-
browser =
|
|
271
|
+
browser = fleet.FleetPlaywrightWrapper(env)
|
|
272
272
|
browser.start()
|
|
273
273
|
|
|
274
274
|
# Create agent
|
|
@@ -314,10 +314,10 @@ def evaluate_problem(
|
|
|
314
314
|
|
|
315
315
|
def interactive_mode():
|
|
316
316
|
# Create a Fleet environment instance
|
|
317
|
-
instance =
|
|
317
|
+
instance = fleet.env.make("hubspot")
|
|
318
318
|
|
|
319
319
|
# Create the browser wrapper
|
|
320
|
-
browser =
|
|
320
|
+
browser = fleet.FleetPlaywrightWrapper(instance)
|
|
321
321
|
browser.start()
|
|
322
322
|
|
|
323
323
|
try:
|
|
@@ -4,7 +4,7 @@ import argparse
|
|
|
4
4
|
import json
|
|
5
5
|
from typing import TypedDict, List, Optional, Tuple
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
import fleet
|
|
7
|
+
import fleet
|
|
8
8
|
from nova_act import NovaAct, ActResult
|
|
9
9
|
from dotenv import load_dotenv
|
|
10
10
|
|
|
@@ -36,7 +36,7 @@ async def process_problem(
|
|
|
36
36
|
env = None
|
|
37
37
|
try:
|
|
38
38
|
# Create a new environment instance for this problem
|
|
39
|
-
env = await
|
|
39
|
+
env = await fleet.env.make_async(env_key)
|
|
40
40
|
print(
|
|
41
41
|
f"[Problem {problem_idx + 1}/{total_problems}] Created environment for {problem['id']}: {env.urls.app}"
|
|
42
42
|
)
|