feat(tools): add a pre-action governance hook - #5387
Open
Soundcreates wants to merge 3 commits into
Open
Conversation
Soundcreates
force-pushed
the
soundcreates/feature/pre-action-governance-hook
branch
from
August 4, 2026 12:39
5a2b0c7 to
de817e5
Compare
Contributor
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Soundcreates
force-pushed
the
soundcreates/feature/pre-action-governance-hook
branch
from
August 4, 2026 13:12
de817e5 to
8872ccb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_actiongovernance hook toTools.actthat runs before executing an action. It receives validated parameters with defaults and can block by returning anActionResult; supports sync/async and fails closed peraction_timeout.Tools.before_actionreceives(action_name, effective_params); returning anActionResultrejects the action. Otherwise, the action runs with those effective params. Unset = no behavior change.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.