feat(adapters): add ComputerUseGovernor for Anthropic Computer Use#131
Merged
saurabhjain1592 merged 4 commits intomainfrom Apr 1, 2026
Merged
feat(adapters): add ComputerUseGovernor for Anthropic Computer Use#131saurabhjain1592 merged 4 commits intomainfrom
saurabhjain1592 merged 4 commits intomainfrom
Conversation
Middleware for the sampling loop: check_tool_use() evaluates tool_use
blocks before execution (blocks dangerous bash commands, detects PII),
check_result() scans results before feeding back to Claude (redacts
PII/secrets).
- Local bash pattern matching for fast client-side blocking (rm -rf,
credential exfiltration, curl|bash)
- Server-side policy evaluation via mcp_check_input/output
- Connector type derivation: computer_use.{action} for computer tool,
computer_use.{name} for bash/text_editor
- CheckResult dataclass with allowed, block_reason, redacted_result
29 tests, 95% coverage on computer_use.py. Lint clean.
Ruff import ordering (isort) requires alphabetical module order. Moved computer_use import before langchain/langgraph.
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.
Summary
ComputerUseGovernoris a middleware for Anthropic's Computer Use sampling loop. Drop it in at two points:check_tool_use(block)— evaluates tool_use blocks before executioncheck_result(name, result)— scans results before feeding back to ClaudeFeatures
mcp_check_input, results viamcp_check_outputcomputer_use.{action}for computer tool (e.g.,computer_use.left_click),computer_use.{name}for bash/text_editorallowed,block_reason,redacted_result,policies_evaluatedTest plan