Veto/docs

Browser-Use Integration

Validate browser automation actions with Veto before they execute.

Veto wraps the browser-use controller to validate browser actions before they execute. Dangerous actions (navigating to URLs, clicking elements, entering text) are checked against your policies.

Installation

npm install veto-sdk browser-use-node
pip install veto browser-use

Quick start

import { Veto } from 'veto-sdk';
import { wrapBrowserUse } from 'veto-sdk/integrations/browser-use';

const veto = await Veto.init();
const controller = await wrapBrowserUse(veto);

// Use `controller` as a drop-in replacement for browser-use's Controller
from veto import Veto
from veto.integrations.browser_use import wrap_browser_use

veto = await Veto.init()
tools = await wrap_browser_use(veto)

# Use `tools` as a drop-in replacement for browser-use's Tools

Runnable SDK example

See:

  • packages/sdk/examples/browser-use/browser_agent.ts

The example includes:

  • veto.guard(...) preflight checks for representative browser actions
  • wrapBrowserUse(...) execution-time enforcement through a wrapped controller

Default validated actions

Actions not in this set bypass validation entirely and execute normally.

ActionDescription
go_to_urlNavigate to a URL
click_elementClick a page element
input_textEnter text into a field
extract_page_contentExtract page content
scrollScroll the page
doneMark task as complete
tabSwitch browser tabs
ActionDescription
navigateNavigate to a URL
searchPerform a search
clickClick a page element
inputEnter text into a field
extractExtract page content
scrollScroll the page
doneMark task as complete

Action names differ between TypeScript (browser-use-node) and Python (browser-use) because the underlying libraries use different naming conventions.

Options

OptionTypeDefaultDescription
validatedActionsSet<string>DEFAULT_VALIDATED_ACTIONSActions to validate
onAllow(actionName, params) => voidCalled when an action passes
onDeny(actionName, params, reason) => voidCalled when an action is denied
OptionTypeDefaultDescription
validated_actionsset[str]DEFAULT_VALIDATED_ACTIONSActions to validate
on_allowCallableNoneCalled when an action passes
on_denyCallableNoneCalled when an action is denied

How it works

wrapBrowserUse / wrap_browser_use creates a subclass of the browser-use Controller (TS) or Tools (Python) class that overrides the act() method:

  1. Parse the action name and parameters from the incoming action object
  2. If the action is in validatedActions, validate via veto.validateToolCall()
  3. Allowed: execute the original action
  4. Denied: return an ActionResult with an error message — the agent sees the denial and can adapt
  5. Actions not in validatedActions pass through to the original act() without validation

Denied actions never throw. They return:

ActionResult({ error: "Action blocked by Veto: <reason>" })

When using Veto Cloud, the wrapper auto-registers browser action schemas with the server so you can configure policies from the dashboard.

YAML rules for browser actions

rules:
  - id: block-dangerous-urls
    name: Block navigation to dangerous URLs
    action: block
    tools:
      - go_to_url       # TypeScript
      # - navigate       # Python
    conditions:
      - field: arguments.url
        operator: matches
        value: "^https?://(.*\\.)?(malware|phishing|darkweb)\\."

  - id: block-password-input
    name: Block typing passwords
    action: block
    tools:
      - input_text       # TypeScript
      # - input           # Python
    conditions:
      - field: arguments.text
        operator: matches
        value: "(?i)(password|secret|token|api.?key)"

Exports

import { wrapBrowserUse, DEFAULT_VALIDATED_ACTIONS } from 'veto-sdk/integrations/browser-use';

import type { WrapBrowserUseOptions } from 'veto-sdk/integrations/browser-use';
from veto.integrations.browser_use import wrap_browser_use, DEFAULT_VALIDATED_ACTIONS