Skip to content

feat(adapters): add ComputerUseGovernor for Anthropic Computer Use#131

Merged
saurabhjain1592 merged 4 commits intomainfrom
feat/computer-use-governor
Apr 1, 2026
Merged

feat(adapters): add ComputerUseGovernor for Anthropic Computer Use#131
saurabhjain1592 merged 4 commits intomainfrom
feat/computer-use-governor

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

ComputerUseGovernor is a middleware for Anthropic's Computer Use sampling loop. Drop it in at two points:

  1. check_tool_use(block) — evaluates tool_use blocks before execution
  2. check_result(name, result) — scans results before feeding back to Claude

Features

  • Local bash blocking: Fast client-side pattern matching for dangerous commands (rm -rf, credential exfiltration, curl|bash) before hitting the server
  • Server-side policy evaluation: All tool_use blocks checked via mcp_check_input, results via mcp_check_output
  • Connector type derivation: computer_use.{action} for computer tool (e.g., computer_use.left_click), computer_use.{name} for bash/text_editor
  • CheckResult dataclass: allowed, block_reason, redacted_result, policies_evaluated

Test plan

  • 29 unit tests pass
  • 95% coverage on computer_use.py
  • Lint clean (ruff check + format)
  • E2E examples (separate enterprise PR)

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.
@saurabhjain1592 saurabhjain1592 merged commit 448ff5a into main Apr 1, 2026
12 checks passed
@saurabhjain1592 saurabhjain1592 deleted the feat/computer-use-governor branch April 1, 2026 15:44
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.

1 participant