Skip to content

feat(tools): add a pre-action governance hook - #5387

Open
Soundcreates wants to merge 3 commits into
browser-use:mainfrom
Soundcreates:soundcreates/feature/pre-action-governance-hook
Open

feat(tools): add a pre-action governance hook#5387
Soundcreates wants to merge 3 commits into
browser-use:mainfrom
Soundcreates:soundcreates/feature/pre-action-governance-hook

Conversation

@Soundcreates

@Soundcreates Soundcreates commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #5293


Add an optional pre-action governance callback to Tools.act(). Callers can inspect the action name and validated parameters before execution, return an ActionResult to deny an action, or perform synchronous/asynchronous policy work. Exceptions fail closed with an ActionResult error.

Tests: compiled browser_use/tools/service.py with Python 3.12's compileall; ran git diff --check.


Summary by cubic

Fixes #5293 by adding an optional before_action governance hook to Tools.act that runs before executing an action. It receives validated parameters with defaults and can block by returning an ActionResult; supports sync/async and fails closed per action_timeout.

  • New Features
    • Tools.before_action receives (action_name, effective_params); returning an ActionResult rejects the action. Otherwise, the action runs with those effective params. Unset = no behavior change.
    • Async callbacks are awaited and bounded by action_timeout; stalls or exceptions are logged and the action is rejected with a timeout/error message.

Written for commit 0cfb598. Summary will update on new commits.

Review in cubic

@Soundcreates
Soundcreates force-pushed the soundcreates/feature/pre-action-governance-hook branch from 5a2b0c7 to de817e5 Compare August 4, 2026 12:39

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread browser_use/tools/service.py Outdated
Comment thread browser_use/tools/service.py Outdated
@Soundcreates
Soundcreates force-pushed the soundcreates/feature/pre-action-governance-hook branch from de817e5 to 8872ccb Compare August 4, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Governance layer for browser actions — URL allowlisting, action budgets, PII exfiltration defense

1 participant