from askui import VisionAgentwith VisionAgent() as agent: agent.tools.webbrowser.open_new("http://www.example.com") agent.wait(3) # Wait for page to load is_loaded = agent.get("Is the page fully loaded?", response_schema=bool) assert is_loaded, "Page should be loaded" print(f"is loaded: {is_loaded}")
Be Specific: Ask precise questions about what you’re checking
Copy
Ask AI
# Good - specificis_error = agent.get("Is there a red error message below the email field?", response_schema=bool)# Less specificis_error = agent.get("Is there an error?", response_schema=bool)
Use for Control Flow: Boolean questions are perfect for conditional logic
Copy
Ask AI
if agent.get("Is the cookie banner visible?", response_schema=bool): agent.click("Accept cookies")# Continue with main flow
Combine Multiple Checks: Use multiple boolean questions for complex validations
Copy
Ask AI
can_proceed = all([ agent.get("Is the form completely filled?", response_schema=bool), agent.get("Is the terms checkbox checked?", response_schema=bool), not agent.get("Are there any validation errors?", response_schema=bool)])