Skip to content

Commit 8ac759b

Browse files
author
SentienceDEV
committed
vision executor + enrich form actions
1 parent 3582cd6 commit 8ac759b

File tree

13 files changed

+1618
-431
lines changed

13 files changed

+1618
-431
lines changed

examples/runtime_agent_minimal.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ async def main() -> None:
4747
await page.goto("https://example.com")
4848
await page.wait_for_load_state("networkidle")
4949

50-
runtime = await AgentRuntime.from_sentience_browser(browser=browser, page=page, tracer=tracer)
50+
runtime = await AgentRuntime.from_sentience_browser(
51+
browser=browser, page=page, tracer=tracer
52+
)
5153

5254
# Structured executor (for demo, we just return FINISH()).
5355
executor = FixedActionProvider("FINISH()")
@@ -63,15 +65,29 @@ async def main() -> None:
6365
def has_example_heading(ctx: AssertContext) -> AssertOutcome:
6466
# Demonstrates custom predicates (you can also use exists/url_contains helpers).
6567
snap = ctx.snapshot
66-
ok = bool(snap and any((el.role == "heading" and (el.text or "").startswith("Example")) for el in snap.elements))
68+
ok = bool(
69+
snap
70+
and any(
71+
(el.role == "heading" and (el.text or "").startswith("Example"))
72+
for el in snap.elements
73+
)
74+
)
6775
return AssertOutcome(passed=ok, reason="" if ok else "missing heading", details={})
6876

6977
step = RuntimeStep(
7078
goal="Confirm Example Domain page is loaded",
7179
verifications=[
72-
StepVerification(predicate=url_contains("example.com"), label="url_contains_example", required=True),
73-
StepVerification(predicate=exists("role=heading"), label="has_heading", required=True),
74-
StepVerification(predicate=has_example_heading, label="heading_text_matches", required=False),
80+
StepVerification(
81+
predicate=url_contains("example.com"),
82+
label="url_contains_example",
83+
required=True,
84+
),
85+
StepVerification(
86+
predicate=exists("role=heading"), label="has_heading", required=True
87+
),
88+
StepVerification(
89+
predicate=has_example_heading, label="heading_text_matches", required=False
90+
),
7591
],
7692
max_snapshot_attempts=2,
7793
snapshot_limit_base=60,
@@ -86,4 +102,3 @@ def has_example_heading(ctx: AssertContext) -> AssertOutcome:
86102

87103
if __name__ == "__main__":
88104
asyncio.run(main())
89-

sentience/__init__.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,20 @@
1111
verify_extension_version,
1212
verify_extension_version_async,
1313
)
14-
from .actions import click, click_rect, press, scroll_to, type_text
14+
from .actions import (
15+
back,
16+
check,
17+
clear,
18+
click,
19+
click_rect,
20+
press,
21+
scroll_to,
22+
select_option,
23+
submit,
24+
type_text,
25+
uncheck,
26+
upload_file,
27+
)
1528
from .agent import SentienceAgent, SentienceAgentAsync
1629
from .agent_config import AgentConfig
1730
from .agent_runtime import AgentRuntime, AssertionHandle
@@ -118,6 +131,7 @@
118131
all_of,
119132
any_of,
120133
custom,
134+
download_completed,
121135
element_count,
122136
exists,
123137
is_checked,
@@ -132,6 +146,13 @@
132146
value_contains,
133147
value_equals,
134148
)
149+
150+
# Vision executor primitives (shared parsing/execution helpers)
151+
from .vision_executor import (
152+
VisionExecutorAction,
153+
execute_vision_executor_action,
154+
parse_vision_executor_action,
155+
)
135156
from .visual_agent import SentienceVisualAgent, SentienceVisualAgentAsync
136157
from .wait import wait_for
137158

0 commit comments

Comments
 (0)