Your agent can click. Statelock decides if it should.
Statelock adds policy checks and evidence to AI browser automation. It sits between your Playwright or browser-use agent and Chromium, checking actions against your policy, blocking violations, and recording what happened.
$ python agent.py allow open the invoice allow read the deposit total allow type the payment reference block move toward "Mark as Paid" assert_field_equal: invoice and deposit differStatelockPolicyViolationError
Point your agent at Statelock instead of Chromium
Your agent keeps its framework and its code. Statelock gives it a governed browser and checks every action on the way through.
$ pip install statelock-ai
The package is statelock-ai and it imports as statelock. A JavaScript client is available for Stagehand and Playwright for Node.
async with async_playwright() as p: statelock.client.install() governed = await statelock.client.connect_async_playwright(p) page = governed.page
Rules about the page, not about the prompt
Policies are YAML. They read values from the page itself, so a check holds whatever the model was told or tricked into doing.
Before every action
Pre-conditions: the right page, the right text, two fields that must match, a value under a limit, buttons the agent may never press.
After an action
Post-conditions check the page an action led to, such as the confirmation that a payment was recorded.
Files, cookies and requests
Governed uploads and downloads, cookies only by name, and HTTP requests only to the URLs a policy allows.
Credentials the agent never sees
The agent types {{secret:name}}; Statelock puts the password into the right field on the right page, and hides it everywhere else.
A human in the loop
Mark a rule in the policy to require human review on error, and the action waits until a reviewer approves or denies it.
Evidence for every decision
Each action is recorded with the page URL, the values checked, the rule's verdict and screenshots.
Only mark an invoice paid when the money is there
This policy lets a finance agent work on a reconciliation portal, but the policy blocks "Mark as Paid" unless the bank deposit matches the invoice, and never lets the agent press Delete or Void.
policies: - agent_id: finance_reconciliation_agent target_url_contains: /demo/finance pre_conditions: - require_page_text: {values: [Bank Deposit, ERP Invoice]} - assert_field_equal: {left: bank_deposit_amount, right: erp_invoice_amount} - prohibit_click_text: {values: [Delete, Void]} - trigger: {click_text: [Mark as Paid]} assert_compare: {left: erp_invoice_amount, op: "<=", value: 10000, on_fail: review} post_conditions: - trigger: {click_text: [Mark as Paid]} require_page_text: {values: [Reconciliation complete]}
Review what an agent did, then verify the record
Statelock Enclave lets reviewers follow a session action by action, including the page, policy decision and outcome. Signed checkpoints and an external witness let auditors check for later changes. The evidence stays in your cloud.