@@ -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
87103if __name__ == "__main__" :
88104 asyncio .run (main ())
89-
0 commit comments