Get started with Predicate SDK in 5 minutes. This guide walks you through a complete login automation example.
Install the Predicate SDK for your preferred language:
# Install the Python SDK
pip install predicate-runtime
# Install Chromium browser (required for automation)
playwright install chromiumAPI key enables smarter filtering and saves LLM token usage
Sign up at predicatesystems.ai to get your API key. You can also test locally without an API key.
export PREDICATE_API_KEY="sk_..."If you already have an AI web agent (LangChain, browser-use, your own loop), you can keep it — and attach Predicate Debugger as a verification + tracing sidecar.
Notes:
page is the Playwright Page owned by your agent/framework.Tracer writes a JSONL trace you can inspect in Predicate Studio later.use_api: false in snapshot() options.import asyncio
from predicate import PredicateDebugger
from predicate.tracing import Tracer, JsonlTraceSink
from predicate.verification import exists, url_contains
class MyAgent:
"""
Your existing agent/framework.
It owns the browser and returns a Playwright Page.python your_script.pyRun the script that contains your agent loop. If you used the examples above, this will open a browser, execute your agent step(s), and then run Predicate verification.
If you don't already have an agent framework, you can also use the Predicate SDK directly to drive the browser with snapshots + actions.
from predicate import PredicateBrowser, snapshot, find, type_text, click, wait_for
# Create browser instance
with PredicateBrowser(api_key="sk_...") as browser:
# Navigate to login page
browser.page.trace.jsonl)use_api: false (no API key required).once() and .eventually() to make outcomes deterministicNo! You can use use_api=False to process everything locally. This won't charge credits but also won't include importance ranking.
Queries use operators like role=button, text~"Submit" (contains), importance>500. See the full reference for all operators.
Use wait_for() to wait for elements to appear. Check element visibility with element.in_viewport and element.is_occluded.