How it works

A guarded browser for agents

Instead of giving an agent a normal browser, you point it at Statelock. The agent uses Playwright, Stagehand or another CDP tool as usual, but every important action passes through Statelock first.

Your agent

Playwright, browser-use, Stagehand, LangChain

Connects to a session URL instead of a local browser. It can keep its existing browser tooling.

Statelock

A CDP proxy with policies

Captures the page, checks the pre-conditions, forwards or blocks the action, checks the post-conditions, and records it all.

Chromium

One browser per session

Sandboxed, with a page guard on every page and frame.

Each action

What happens on every click

  1. 1 · CaptureStatelock reads the tab the action targets: the URL, the visible text, the element under the pointer, the fields your policy names, and a screenshot.
  2. 2 · CheckIt evaluates the pre-conditions of every policy that covers the page.
  3. 3 · Allow or blockAn allowed action goes to the browser. A blocked one never reaches it. If an action is blocked, the agent gets an error and the session ends.
  4. 4 · Check againFor actions (a click, a tap, Enter) Statelock holds the browser's answer and checks the post-conditions on the page that the action led to.
  5. 5 · RecordOne record per action, in order, with the verdict, the values checked and screenshots, plus a log of the network requests each action caused.
The page guard

Forcing checkable inputs

An agent could try to skip Statelock's checks by submitting a form from a script or calling the site's API itself. On governed pages, Statelock blocks those agent-initiated shortcuts and replays ordinary script clicks as checked input. Site code is treated separately so multi-step tasks can continue.

A violation

What your agent sees

If a blocked command fails, the session closes and the client raises an error with the rule and the reason.

StatelockPolicyViolationError
  rule:   assert_field_equal
  reason: bank_deposit_amount does not match erp_invoice_amount
Building blocks

Use built-in rules or write your own

Write custom rules in Python when the built-in checks are not enough. A custom rule is a class loaded as a plug-in.

  • require_page_textThe page must show these words.
  • prohibit_page_textThe page must not show them.
  • prohibit_click_textButtons and links the agent may never activate.
  • assert_field_equalTwo values on the page, or remembered from an earlier page, must match.
  • assert_compareA value must be under, over or equal to a limit or another value.
  • visual_assertA check on the screenshot by a vision model you run, cross-checked against the page's text.
  • restrict_uploadsFile types, names, sizes and counts the agent may upload.
  • restrict_downloadsThe same for downloads, checked when they start and when they finish.
  • cookie_accessThe cookies, by name or domain, the agent may read. By default, none.
  • request_accessThe URLs the agent may call over HTTP, made in the page with the browser's session.

What Statelock can and cannot analyze is listed in COVERAGE.md.