Browser Automation Control with Statelock

Hi everyone,

I am new to this forum, but not to AI and agents. Our company does AI R&D, and a recent problem we’ve been investigating is controlling agent behavior for browser automation tasks to make it safe. To do that, we created a governed version of chromium, so the agent uses that as a drop in replacement, and then as developers we create rules to explicitly check agent behavior (via assertions before and after an action, for instance to ensure it actually logged into a site), and prevent certain actions outright, like maybe it can never press a “delete” button. The goal is that developers just write agent code like normal, drop in a few lines to use statelock, write their policy, and it will add the guardrails itseklf.

It’s Apache 2.0, and you can find it here: GitHub - inferlink/statelock · GitHub

To use it in Langchain you would just add:

from statelock.client import create_session_url
from statelock.integrations.langchain import governed_playwright_tools

session = create_session_url()
browser = await playwright.chromium.connect_over_cdp(session.cdp_url)
tools = governed_playwright_tools(browser, session)*

Anyway, we’d love feedback if anyone is facing this sort of problem with their agents. We’ve used it internally, but a better test for something like this is other people testing if it’s easy to use and effective, which is why I am reaching out here.

Thanks

Matt