fleet-python 0.2.28__py3-none-any.whl → 0.2.32__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.
- examples/diff_example.py +30 -20
- examples/dsl_example.py +12 -7
- examples/example.py +4 -4
- examples/example_account.py +8 -0
- examples/example_action_log.py +2 -2
- examples/example_client.py +2 -2
- examples/example_mcp_anthropic.py +8 -5
- examples/example_mcp_openai.py +2 -2
- examples/example_sync.py +4 -4
- examples/example_task.py +16 -6
- examples/example_tasks.py +3 -6
- examples/example_verifier.py +16 -3
- examples/gemini_example.py +6 -6
- examples/json_tasks_example.py +2 -2
- examples/nova_act_example.py +2 -2
- examples/openai_example.py +3 -3
- examples/openai_simple_example.py +3 -3
- examples/query_builder_example.py +11 -7
- fleet/__init__.py +60 -5
- fleet/_async/__init__.py +258 -1
- fleet/_async/base.py +2 -1
- fleet/_async/client.py +194 -127
- fleet/_async/env/client.py +5 -1
- fleet/_async/global_client.py +43 -0
- fleet/_async/instance/client.py +1 -1
- fleet/_async/models.py +172 -171
- fleet/_async/resources/base.py +1 -1
- fleet/_async/resources/mcp.py +55 -0
- fleet/_async/resources/sqlite.py +141 -130
- fleet/_async/tasks.py +71 -16
- fleet/_async/verifiers/__init__.py +2 -2
- fleet/_async/verifiers/bundler.py +18 -14
- fleet/_async/verifiers/verifier.py +77 -71
- fleet/base.py +2 -1
- fleet/client.py +176 -136
- fleet/config.py +3 -2
- fleet/env/__init__.py +10 -1
- fleet/env/client.py +5 -1
- fleet/global_client.py +43 -0
- fleet/instance/__init__.py +1 -1
- fleet/instance/client.py +2 -4
- fleet/models.py +172 -171
- fleet/resources/base.py +1 -1
- fleet/resources/mcp.py +27 -33
- fleet/resources/sqlite.py +136 -131
- fleet/tasks.py +197 -16
- fleet/types.py +1 -1
- fleet/verifiers/__init__.py +2 -2
- fleet/verifiers/bundler.py +18 -14
- fleet/verifiers/code.py +1 -1
- fleet/verifiers/decorator.py +25 -34
- fleet/verifiers/parse.py +98 -68
- fleet/verifiers/verifier.py +77 -78
- {fleet_python-0.2.28.dist-info → fleet_python-0.2.32.dist-info}/METADATA +9 -9
- fleet_python-0.2.32.dist-info/RECORD +74 -0
- scripts/fix_sync_imports.py +87 -59
- scripts/unasync.py +10 -9
- fleet_python-0.2.28.dist-info/RECORD +0 -70
- {fleet_python-0.2.28.dist-info → fleet_python-0.2.32.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.28.dist-info → fleet_python-0.2.32.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.28.dist-info → fleet_python-0.2.32.dist-info}/top_level.txt +0 -0
examples/diff_example.py
CHANGED
|
@@ -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())
|
examples/dsl_example.py
CHANGED
|
@@ -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")
|
examples/example.py
CHANGED
|
@@ -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)
|
examples/example_action_log.py
CHANGED
|
@@ -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
|
|
examples/example_client.py
CHANGED
|
@@ -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})
|
examples/example_mcp_openai.py
CHANGED
|
@@ -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
|
|
examples/example_sync.py
CHANGED
|
@@ -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)
|
examples/example_task.py
CHANGED
|
@@ -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
|
|
examples/example_tasks.py
CHANGED
|
@@ -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):
|
examples/example_verifier.py
CHANGED
|
@@ -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))
|
examples/gemini_example.py
CHANGED
|
@@ -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:
|
examples/json_tasks_example.py
CHANGED
|
@@ -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
|
)
|
examples/nova_act_example.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from nova_act import NovaAct, ActResult
|
|
4
4
|
from dotenv import load_dotenv
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ load_dotenv()
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
async def main():
|
|
10
|
-
instance = await
|
|
10
|
+
instance = await fleet.env.make_async("hubspot:v1.2.7")
|
|
11
11
|
cdp_url = await instance.browser().cdp_url()
|
|
12
12
|
|
|
13
13
|
loop = asyncio.get_event_loop()
|
examples/openai_example.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from openai import OpenAI
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
import json
|
|
4
4
|
from typing import Callable
|
|
5
5
|
from dotenv import load_dotenv
|
|
@@ -191,10 +191,10 @@ tools = []
|
|
|
191
191
|
|
|
192
192
|
def main():
|
|
193
193
|
# Create a Fleet environment instance
|
|
194
|
-
instance =
|
|
194
|
+
instance = fleet.env.make("hubspot")
|
|
195
195
|
|
|
196
196
|
# Create the Playwright wrapper
|
|
197
|
-
browser =
|
|
197
|
+
browser = fleet.FleetPlaywrightWrapper(instance)
|
|
198
198
|
browser.start()
|
|
199
199
|
|
|
200
200
|
try:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from openai import OpenAI
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from dotenv import load_dotenv
|
|
4
4
|
|
|
5
5
|
load_dotenv()
|
|
@@ -8,9 +8,9 @@ client = OpenAI()
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def main():
|
|
11
|
-
instance =
|
|
11
|
+
instance = fleet.env.make("hubspot")
|
|
12
12
|
|
|
13
|
-
browser =
|
|
13
|
+
browser = fleet.FleetPlaywrightWrapper(instance)
|
|
14
14
|
browser.start()
|
|
15
15
|
|
|
16
16
|
try:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import fleet
|
|
2
|
+
import fleet
|
|
3
3
|
from dotenv import load_dotenv
|
|
4
4
|
|
|
5
5
|
load_dotenv()
|
|
@@ -8,7 +8,7 @@ load_dotenv()
|
|
|
8
8
|
async def main():
|
|
9
9
|
# Create a new instance
|
|
10
10
|
print("Creating new Hubspot instance...")
|
|
11
|
-
env = await
|
|
11
|
+
env = await fleet.env.make_async("hubspot:v1.2.7")
|
|
12
12
|
print(f"New Instance: {env.instance_id}")
|
|
13
13
|
|
|
14
14
|
try:
|
|
@@ -21,7 +21,7 @@ async def main():
|
|
|
21
21
|
|
|
22
22
|
# Example 1: Query with the builder pattern
|
|
23
23
|
print("\n=== Query Builder Examples ===")
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
# Find all entries of type 'deal'
|
|
26
26
|
print("\n1. Finding all deals:")
|
|
27
27
|
deals = await db.table("entries").eq("type", "deal").all()
|
|
@@ -86,14 +86,18 @@ async def main():
|
|
|
86
86
|
)
|
|
87
87
|
"""
|
|
88
88
|
await db.exec(insert_query)
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
# Verify insertion with query builder
|
|
91
91
|
new_deal = await db.table("entries").eq("id", 99999).first()
|
|
92
92
|
if new_deal:
|
|
93
93
|
print(f"✓ Successfully inserted: {new_deal['name']}")
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
# Assert specific field value
|
|
96
|
-
await
|
|
96
|
+
await (
|
|
97
|
+
db.table("entries")
|
|
98
|
+
.eq("id", 99999)
|
|
99
|
+
.assert_eq("name", "Test Deal via Query Builder")
|
|
100
|
+
)
|
|
97
101
|
print("✓ Name assertion passed")
|
|
98
102
|
|
|
99
103
|
# Using IN clause
|
|
@@ -114,4 +118,4 @@ async def main():
|
|
|
114
118
|
|
|
115
119
|
|
|
116
120
|
if __name__ == "__main__":
|
|
117
|
-
asyncio.run(main())
|
|
121
|
+
asyncio.run(main())
|