Skip to main content

Bartholomew — Authorization Gate MVP

Authorization and policy layer for autonomous agents — gate risky actions before execution, record proof of the decision, and emit telemetry for downstream policy and billing layers.

CI PyPI npm Marketplace smithery badge Glama Deploy to Cloudflare Cloud Console Pricing License: MIT Tests

Gemini 3.8 Claude 3.7 GPT-Astra Cloudflare AutoGen Copilot / Cursor


What it does

Bartholomew is the execution gate for autonomous agents.

It sits between an agent and a real-world action and decides whether the action should be allowed before it runs. The current MVP is intentionally narrow and focused on the action boundary:

  • evaluate an action before execution
  • inspect the payload for policy violations and risky patterns
  • enforce allow / deny decisions with a clear rule id
  • return a receipt hash for auditability
  • emit telemetry for observability and downstream governance

This is the foundation for a trusted authorization layer for autonomous systems.

Current policy checks include:

  • destructive shell commands (rm -rf, mkfs, dd)
  • dangerous SQL mutations (DROP TABLE, TRUNCATE)
  • credential exfiltration (sk-*, ghp_*, AKIA*)
  • prompt-injection attempts
  • blocked action types and spend caps under policy

Positioning: Bartholomew is not a broad platform story. It is the authorization layer that decides whether an autonomous agent can act.


MVP quickstart

from src.btp_guard.authorization_gate import AuthorizationGate

policy = {
    "allow_destructive": False,
    "max_spend_usd": 5.0,
    "allowed_action_types": ["shell", "read", "search"],
}

gate = AuthorizationGate(policy=policy)

safe = gate.evaluate({
    "agent_id": "worker-1",
    "action_type": "shell",
    "payload": {"command": "ls -la /tmp"},
    "policy": policy,
})

unsafe = gate.evaluate({
    "agent_id": "worker-1",
    "action_type": "shell",
    "payload": {"command": "rm -rf /tmp/data"},
    "policy": policy,
})

print(safe)
print(unsafe)

Example output:

{
  "verdict": "ALLOW",
  "reason": "No policy violations detected",
  "rule_id": null,
  "latency_ms": 0.047,
  "timestamp": "2026-09-15T22:07:07.752116+00:00",
  "receipt_sha256": "71754d8ac4339c2aaa9a71bb4d8337439cafcb81dcef72e6e7a3fc48141fed93"
}
{
  "verdict": "DENY",
  "reason": "Destructive shell pattern detected",
  "rule_id": "BTP-SHELL-001",
  "latency_ms": 0.025,
  "timestamp": "2026-09-15T22:07:07.752206+00:00",
  "receipt_sha256": "7808a40a1b7afafc2575e0f23c26c574eacca562ba7cf2a7a2fa5be8ee2e17d1"
}

This is the execution guard MVP for the bartholomew strategy.


Install

# Python
pip install btp-guard

# Node.js / MCP
npx btp-guard init

Requirements: Python ≥ 3.10 · No mandatory cloud dependency · Works fully offline


Quickstart

Python — decorator guard

from btp_guard import Guard, BTPViolationError

guard = Guard(spend_cap_usd=50.0, max_retries=5)

@guard.protect
def execute_query(sql: str):
    return db.execute(sql)

try:
    execute_query("DROP TABLE accounts;")
except BTPViolationError as e:
    print(e.to_diagnostics())
    # {"status": "BLOCKED", "rule_id": "BTP-SQL-001",
    #  "reason": "Destructive SQL mutation detected", "latency_us": 18.4}

Python — inline check

from btp_guard import Guard

guard = Guard()
result = guard.check("rm -rf /var/data")
# {"allowed": False, "reason": "[BTP-AST-001] Destructive filesystem pattern"}

TypeScript / Node.js

import { BTPGuard } from 'btp-guard';

const guard = new BTPGuard();
const receipt = guard.evaluateAction({
  agentId: 'worker-1',
  actionType: 'DATABASE_MUTATION',
  payload: { query: 'DROP TABLE users;' }
});
// receipt.verdict === "DENY"  (blocked in ~11µs, Merkle receipt attached)

MCP — Claude Desktop, Cursor, Windsurf, Smithery.ai & Glama.ai

# 1-Click install via Smithery.ai CLI:
npx -y @smithery/cli install bartholomew --client claude

# Or run direct stdio MCP server proxy:
python mcp_server.py

Cursor & VS Code Extension

Install the official pre-built extension for real-time AST threat notifications in Cursor / VS Code:

code --install-extension packages/vscode-extension/bartholomew-guard-vscode-5.4.12.vsix

Cloudflare Workers AI — Edge Security Proxy

Deploy a sub-50µs AST security gate across Cloudflare's 300+ city global network with 1 click: Deploy to Cloudflare Workers

cd examples/future_swarms/cloudflare
npx wrangler deploy

GitHub Actions (GitHub Marketplace)

Add automated AST security audits and credential scanning to every pull request:

- name: Bartholomew AI Security Gate & SOC 2 Auditor
  uses: ivegotahunnitonit/bartholomew@v5.4.12
  with:
    fail-on-violation: "true"
    generate-compliance-pack: "true"

Bitcoin Lightning & L402 Swarm Settlements (Alby Hub)

Manage your 24/7 self-custodial Lightning node and issue machine-to-machine micropayments:

# Check node health & spendable satoshi balance
python cli.py lightning status
python cli.py lightning balance

# Mint a live Lightning Network invoice for tool audit fees
python cli.py lightning invoice --sats 30000 --desc "Swarm AST Execution Pool"

Editions & Cloud Console

Bartholomew is fully open-source and offline for local developer workflows. For engineering teams deploying multi-agent swarms in production, the Cloud Console provides centralized fleet monitoring, instant threat alerts, and automated compliance reports:

Edition Pricing Ideal For Core Capabilities
Community (OSS) Free Forever Solo Devs & Local Scripts In-process sub-35µs AST gate, offline Ed25519 receipts, secret scrubber, MIT license
Pro / Team $49 / month Startups & Engineering Teams Cloud Telemetry Dashboard, instant Slack/Discord threat alerts, fleet API keys, policy sync
Enterprise $199 / month Scale-ups, FinTech & Healthcare Continuous 1-click SOC 2 Type II evidence bundles, multi-tenant workspace isolation, dedicated CISO ledger, priority SLA

👉 Get Started & Upgrade:


Architecture

cmd/bartholomew/          # Go CLI entry point
src/
  btp_guard/              # Core Python guard engine
  framework_adapters/     # LangChain, LangGraph, AutoGen, CrewAI wrappers
  bartholomew_eval/       # Bayesian risk engine & AST fuzzer
  mcp_server/             # MCP stdio/SSE gateway
  go_services/            # High-throughput Go verifier service
  rust_verifier/          # Sub-5µs Rust fast-path (experimental)
  daemon/                 # Background approval queue & tray manager
  ebpf/                   # eBPF kernel-level syscall hooks (Linux)
examples/                 # Integration recipes (already_built, being_built, future_swarms, ides)
packages/                 # SDKs: pypi_package, npm_package, sdk_go, sdk_rust, sdk_typescript, vscode-extension
deploy/                   # Docker, K8s, Terraform, CDK, GCP, Helm, Systemd
tests/                    # 2,837-test suite (pytest -o 'pythonpath=src .')
docs/                     # Specs: threat-model.md, btp-protocol-spec.md, quickstart.md

Framework & Frontier Partner Adapters

Frontier Partner / Swarm Integration Guard Recipe Path
Google Gemini 3.8 Ultra @btp_gemini_38_tool() / Thought Scratchpad Gate examples/being_built/google_gemini38_guard.py
Anthropic Claude 3.7 Sonnet Claude37ToolGuard / Hybrid Thinking Interceptor examples/being_built/anthropic_claude37_guard.py
GPT-Astra / OpenAI Agents SDK OpenAIToolGuard / Dynamic Schema Verifier examples/being_built/openai_agents_sdk_guard.py
Cloudflare Workers AI & Agents Sub-50µs Edge AST Gate & KV Replay Defense examples/future_swarms/cloudflare_edge_agent_guard.ts
Microsoft AutoGen Swarm @btp_autogen_guard / Consensus Quorum & AWU Barter examples/future_swarms/autogen_swarm_consensus.py
GitHub Copilot / Cursor / Windsurf MCP Stdio Proxy / .cursorrules / .mdc Sentry examples/ides/ & mcp_server.py
Universal Swarm (A2A) UniversalSwarmDelegator (Ed25519 + L402 Rails) examples/future_swarms/universal_swarm_delegation.py

Full documentation and quickstarts in the Master Cookbook.


Defense layers

Bartholomew is Layer 2 in a standard defense-in-depth stack:

Layer Tool Latency Scope
1 — Prompt rails NeMo, Guardrails AI, LlamaGuard 80–2500ms Prompt & completion text
2 — Execution gate Bartholomew BTP <35µs Raw tool args, AST, secrets, spend
3 — OS sandbox Docker, gVisor, E2B kernel Syscall interception

Audit & compliance

Generate a tamper-evident SOC 2 Type II evidence pack:

python scripts/audit_firm_ledger.py

Output: docs/audit/ — SHA-256 Merkle receipt JSON + auditor markdown summary.
Controls satisfied: AICPA CC6.1, CC6.6, CC7.1, CC7.2 · ISO 27001:2022 A.8.8, A.8.30.


Development

# Clone & install in editable mode
git clone https://github.com/ivegotahunnitonit/bartholomew.git
cd bartholomew
pip install -e ".[test]"

# Run the full test suite
pytest tests/ -o "pythonpath=src ." -q

# Lint
pip install ruff && ruff check src/ tests/

Documentation


© 2026 Bartholomew AI & Contributors. MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

btp_guard-5.4.14.tar.gz (909.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

btp_guard-5.4.14-py3-none-any.whl (922.4 kB view details)

Uploaded Python 3

File details

Details for the file btp_guard-5.4.14.tar.gz.

File metadata

  • Download URL: btp_guard-5.4.14.tar.gz
  • Upload date:
  • Size: 909.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for btp_guard-5.4.14.tar.gz
Algorithm Hash digest
SHA256 d63b37b2999b47e1e5780ec3c5913d725ae1d89f8147783adfed127be9c380b9
MD5 c298e892e0bf0dcf8391c43411f4aa6f
BLAKE2b-256 9a257391a0f29a55e6018b1809e0b2828a6d264320ec305f29f7597c3e819a7a

See more details on using hashes here.

File details

Details for the file btp_guard-5.4.14-py3-none-any.whl.

File metadata

  • Download URL: btp_guard-5.4.14-py3-none-any.whl
  • Upload date:
  • Size: 922.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for btp_guard-5.4.14-py3-none-any.whl
Algorithm Hash digest
SHA256 57ac82241692c5237cec7de211f89ad0c44ce3fd627206344b8da07935650481
MD5 9421295583b55ec7c254d91eb4667a84
BLAKE2b-256 7a994c526f925562fcd843965fbaec7982cd4849ecccd9b0bec79b504eec574f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

5.4.14 This release

2 files

5.4.13

2 files

5.4.12

2 files

5.4.11

2 files

5.4.10

2 files

5.4.8

2 files

5.4.7

2 files

5.4.6

2 files

5.4.5

2 files

5.4.4

2 files

5.4.0

2 files

4.1.0

2 files

3.0.0

2 files

2.4.0

2 files

2.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page