Get started with Sentience SDK in 5 minutes. This guide walks you through a complete login automation example.
Install the Sentience SDK for your preferred language:
# Install the Python SDK
pip install sentienceapi
# Install Chromium browser (required for automation)
playwright install chromiumAPI key enables smarter filtering and saves LLM token usage
Sign up at www.sentienceapi.com to get your API key. You can also test locally without an API key.
export SENTIENCE_API_KEY="sk_..."
from sentience import SentienceBrowser, snapshot, find, type_text, click, wait_for
# Create browser instance
with SentienceBrowser(api_key="sk_...") as browser:
# Navigate to login page
browser.page.goto("https://example.com/login")
# PERCEPTION: Take snapshot and find elements
snap = snapshot(browser)
email_input = find(snap, "role=textbox text~'email'")
password_input = find(snap, "role=textbox text~'password'")
submit_btn = find(snap, "role=button text~'sign in'")
# ACTION: Interact with the page
type_text(browser, email_input.id, "user@example.com")
type_text(browser, password_input.id, "password123")
click(browser, submit_btn.id)
# VERIFICATION: Wait for success
result = wait_for(browser, "role=heading text~'Dashboard'", timeout=5.0)
if result.found:
print("✓ Login successful!")
else:
print("✗ Login failed")Key Concepts:
snapshot() captures current page statefind() uses semantic queries to locate elementsclick() and type_text() perform actionswait_for() waits for elements using semantic conditionspython login_example.pyThe browser will open, navigate to the login page, fill in the form, and submit it automatically.
No! 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.