Bartholomew (BTP v1.0.0) — In-Process Runtime Execution Gateway for Autonomous AI Agents
Deterministic AST Policy Invariant Gating, In-Flight Secret Masking, and Cryptographic Attestation for Autonomous AI Agent Swarms.
What It Does
Bartholomew is the execution gate for autonomous AI agents.
It sits between an agent and real-world execution (shell, SQL, file I/O, cloud APIs) and decides whether proposed actions should be allowed before they execute.
[ Autonomous Agent / LLM ]
│
▼ (Proposes Tool Call / Bash / SQL)
┌────────────────────────────────────────────────────────────────────────┐
│ Bartholomew In-Process Runtime Gateway │
│ │
│ [ Polyglot AST Invariant Gate ] ──► Sub-millisecond syntax check │
│ [ In-Flight Secret Vault ] ──► Real-time credential scrubbing │
│ [ Declarative Policy Engine ] ──► Spend caps & command allowlists │
│ [ Cryptographic Attestation ] ──► RFC 8785 Ed25519 Signed Receipts │
└───────────────────────────────────┬────────────────────────────────────┘
│
┌────────────┴────────────┐
▼ ▼
[ ALLOW ] [ DENY ]
│ │
▼ ▼
[ Target System / DB / OS ] [ Execution Veto + Audit Evidence ]
Core Capabilities:
- Pre-Execution Gating: Evaluates tool arguments, commands, and code strings before OS dispatch.
- Polyglot AST Parsing: Parses Abstract Syntax Trees across Python, SQL, Bash, JavaScript, and Go to block dangerous mutations (
rm -rf,DROP TABLE, subshell escapes). - In-Flight Secret Scrubbing: Detects and redacts credentials (
sk-*,ghp_*,AKIA*, private keys) before they touch logs, providers, or vector stores. - Cryptographic Auditability: Generates canonical RFC 8785 JSON digests signed with Ed25519 keys for tamper-proof verification.
- Zero Network Overhead: Evaluates locally inside the host process runtime without external API latency or second-model token billing.
Quickstart
Python
pip install btp-guard
from btp_guard import Guard
guard = Guard(spend_cap=100.0, strict=True)
# 1. Protect any tool function via decorator
@guard.protect
def execute_shell(command: str):
return f"Executed: {command}"
# 2. Or check actions directly inline
result = guard.check("rm -rf /var/data")
if not result["allowed"]:
print(f"Blocked: {result['reason']}")
# Output: Blocked: BTP-AST-001: Catastrophic shell pattern detected
Node.js / TypeScript
npm install btp-guard
import { Guard } from "btp-guard";
const guard = new Guard({ maxSpendUsd: 100.0 });
const verdict = guard.check("DROP TABLE users;");
if (!verdict.allowed) {
throw new Error(`Action blocked: ${verdict.reason}`);
}
MCP Server (Model Context Protocol)
Bartholomew provides a native Model Context Protocol (MCP) server for Claude Desktop, Cursor, Windsurf, and any MCP-compatible client:
{
"mcpServers": {
"bartholomew": {
"command": "python",
"args": ["-m", "src.mcp_server"]
}
}
}
Framework Integrations
Bartholomew provides drop-in runtime interceptors for all major agent orchestrators:
| Framework / Ecosystem | Integration Guard | Reference Guide |
|---|---|---|
| OpenAI Agents SDK | Dynamic Tool Gating & Schema Invariant Checks | docs/FRAMEWORK_GUIDE.md |
| Anthropic Claude | ClaudeToolGuard / Tool-Call Interceptor |
docs/FRAMEWORK_GUIDE.md |
| Microsoft AutoGen | @btp_autogen_guard / Swarm Consensus Interceptor |
examples/future_swarms/autogen_swarm_consensus.py |
| CrewAI | @btp_crewai_tool / Task & Agent Boundary Gate |
docs/FRAMEWORK_GUIDE.md |
| LangChain / LangGraph | BTPGuardTool / Node Execution Interceptor |
docs/FRAMEWORK_GUIDE.md |
| Cursor / VS Code | Pre-execution IDE Sentry & Extension | Open VSX Extension |
Defense in Depth Architecture
Bartholomew functions as Layer 2 in the autonomous agent defense stack:
| Layer | Technology | Typical Latency | Defense Boundary |
|---|---|---|---|
| Layer 1 — Prompt Rails | NeMo, Guardrails AI, LlamaGuard | 800ms – 2,500ms | Natural language prompt & completion text |
| Layer 2 — Execution Gate | Bartholomew BTP | < 0.1 ms (Sub-millisecond) | Raw tool arguments, AST syntax, credentials, spend |
| Layer 3 — OS Isolation | Docker, gVisor, E2B | 200ms – 500ms | Kernel syscall & container isolation |
Audit & Compliance Readiness
Bartholomew generates tamper-evident audit evidence packs mapping to AICPA Trust Services Criteria (CC6.1, CC6.6, CC7.1) and ISO/IEC 27001:2022 (A.8.8, A.8.30):
python scripts/generate_soc2_compliance_evidence.py
Output: docs/audit/soc2-compliance-evidence.json containing SHA-256 Merkle proofs, RFC 8785 canonical digests, and Ed25519 digital signatures for zero-network independent auditor verification.
Development & Test Suite
# Clone repository
git clone https://github.com/bartholomew-ai/bartholomew.git
cd bartholomew
# Install dependencies
pip install -e ".[test]"
# Run full test suite (2,920 automated tests)
python -m pytest -q
Documentation
docs/quickstart.md— Full setup and configuration guidedocs/threat-model.md— Threat model and security boundariesdocs/btp-protocol-spec.md— BTP wire protocol specificationdocs/FRAMEWORK_GUIDE.md— Framework adapter documentationSECURITY.md— Vulnerability disclosure policyCONTRIBUTING.md— Contributing guidelines
License
Bartholomew is distributed under the MIT License.
Release files for btp-guard 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| btp_guard-1.0.0.tar.gz | 907.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| btp_guard-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.8 MB
Release files / btp_guard-1.0.0.tar.gz
| Download URL | btp_guard-1.0.0.tar.gz |
|---|---|
| Size | 907.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8a8cfeb5d00fed55ab84433b8adee60ec81912ff1c2b836a1b0d21202fedaed
|
|
BLAKE2b-256 checksum How to use checksums |
ed2427c87a2706b6771b4ce8ea20ae08871665d113fee91ddbff4410ee45c276
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / btp_guard-1.0.0-py3-none-any.whl
| Download URL | btp_guard-1.0.0-py3-none-any.whl |
|---|---|
| Size | 937.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd7e45452c955a7d527db53b42957673e2611aff8827d6ef4ed7c770c842b5b2
|
|
BLAKE2b-256 checksum How to use checksums |
8710d2354b9f4e5715d2de7b6478d900417610d317e66fab7a5b4f7e9509be57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|