Status: ✅ Week 1 Complete
Python SDK for Sentience AI Agent Browser Automation.
cd sdk-python
pip install -e .
# Install Playwright browsers (required)
playwright install chromiumfrom sentience import SentienceBrowser, snapshot, find, click
# Start browser with extension
with SentienceBrowser(headless=False) as browser:
browser.page.goto("https://example.com")
browser.page.wait_for_load_state("networkidle")
# Take snapshot
snap = snapshot(browser)
print(f"Found {len(snap.elements)} elements")
# Find and click a link
link = find(snap, "role=link")
if link:
result = click(browser, link.id)
print(f"Click success: {result.success}")SentienceBrowser- Launch Playwright with extension loaded- Automatic extension loading and verification
snapshot(browser, options)- Capture page state- Pydantic models for type safety
snapshot.save(filepath)- Save to JSON
query(snapshot, selector)- Find elements matching selectorfind(snapshot, selector)- Find single best match- String DSL:
"role=button text~'Sign in'" - 📖 Complete DSL Query Guide - Comprehensive documentation with all operators, fields, and examples
click(browser, element_id)- Click elementtype_text(browser, element_id, text)- Type into elementpress(browser, key)- Press keyboard key
wait_for(browser, selector, timeout)- Wait for elementexpect(browser, selector)- Assertion helper.to_exist().to_be_visible().to_have_text(text).to_have_count(n)
See examples/ directory:
hello.py- Extension bridge verificationbasic_agent.py- Basic snapshotquery_demo.py- Query enginewait_and_click.py- Wait and actions
pytest tests/- 📖 Query DSL Guide - Complete guide to the semantic query language
- API Contract:
../spec/SNAPSHOT_V1.md - Type Definitions:
../spec/sdk-types.md