Skip to main content
agent.verify(condition: str, timeout: int = 10, model: str | None = None) -> bool
Polls until the condition is met or the timeout expires.

Parameters

ParameterTypeDefaultDescription
conditionstrNatural language description of expected screen state
timeoutint10Seconds to wait before returning False
modelstr | NoneNoneOverride the default model for this call

Returns

boolTrue if the condition is met within the timeout, False otherwise.

Examples

def run(params: Params) -> Result:
    agent = Agent()
    if agent.verify("Is the user logged in?"):
        print("Already logged in")
def run(params: Params) -> Result:
    agent = Agent()
    if not agent.verify("Is the search results page loaded?"):
        agent.execute("Click the Search button")
def run(params: Params) -> Result:
    # Wait longer for slow operations
    agent = Agent()
    if agent.verify("Has the file finished downloading?", timeout=30):
        print("Download complete")