Bartholomew Developer Documentation
Deterministic sub-35µs AST invariant verification, credential scrubbing, and eBPF kernel process sandboxing for autonomous agent swarms.
1-Line Installation & Setup
Install Bartholomew across your development stack with one command:
curl -fsSL https://bartholomew.info/install.sh | bash
irm https://bartholomew.info/install.ps1 | iex
pip install --upgrade btp-guard
npm install btp-guard
brew tap ivegotahunnitonit/bartholomew && brew install btp-guard
btp-guard try for an immediate AST safety verification in < 3 seconds.Architecture & Performance Benchmarks
Compiled zero-overhead Agentic Runtime Protection (ARP). Operates strictly in-process with sub-35 µs execution latency, eliminating 200ms–1,500ms network round-trip bottlenecks.
| GUARDRAIL PLATFORM | EVALUATION LATENCY | INSPECTION METHOD | EXECUTION GUARANTEE |
|---|---|---|---|
| Bartholomew (BTP v6.2) | < 35 µs (compiled) | Deterministic AST & eBPF Invariants | ✓ 100% Deterministic (Zero Drift) |
| Meta Llama Guard 3 | 250ms – 650ms | Secondary LLM Prompt Classifier | ✗ Probabilistic (Jailbreak Susceptible) |
| NVIDIA NeMo Guardrails | 180ms – 420ms | Colang Flows & Vector Embeddings | ✗ Semantic Drift Risk |
| Guardrails AI | 95ms – 300ms | Regex & Remote API Validators | ✗ Vulnerable to Obfuscation |
REST API & Cloud Endpoints
In addition to native SDK bindings, Bartholomew exposes low-latency stateless HTTP endpoints for microservices, CI/CD runners, and edge agents. Full specification available at /openapi.json →
curl -X POST https://bartholomew.info/api/v1/sanitize \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_BTP_KEY" \
-d '{
"payload": "Please review AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY and rm -rf /",
"agent_id": "claude-code-subagent-01",
"strict_mode": true
}'
# Response (< 35 µs):
{
"status": "SANITIZED",
"safe": true,
"redacted_tokens": 1,
"blocked_invariants": ["CATASTROPHIC_SHELL_DELETION"],
"clean_payload": "Please review AWS_SECRET_ACCESS_KEY=[REDACTED] and [BLOCKED_OPERATION]",
"signature": "ed25519:7c92b49e0a81..."
}
curl -X POST https://bartholomew.info/api/v1/validate \
-H "Content-Type: application/json" \
-d '{
"agent_passport": "nhi:btp:ed25519:3a890f841...",
"action": "execute_tool",
"tool_name": "postgres_db_query"
}'
# Response:
{
"authorized": true,
"identity": "nhi:btp:ed25519:3a890f841...",
"rate_limit_remaining": 99998,
"attestation_timestamp": 1790800000
}
import httpx
resp = httpx.post(
"https://bartholomew.info/api/v1/sanitize",
json={"payload": agent_prompt, "agent_id": "agent-alpha"},
headers={"Authorization": "Bearer YOUR_BTP_KEY"}
)
clean_data = resp.json()["clean_payload"]
const res = await fetch("https://bartholomew.info/api/v1/sanitize", {
method: "POST",
headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_BTP_KEY" },
body: JSON.stringify({ payload: agentPrompt, agent_id: "agent-node" })
});
const { clean_payload, safe } = await res.json();
Python: protect_agent(agent)
Wrap any autonomous agent (CrewAI, LangChain, AutoGen, or custom) in a single line of code. All agent tools and lifecycle methods are automatically shielded:
from crewai import Agent
from btp_guard import protect_agent
# 1. Instantiate any CrewAI agent
raw_agent = Agent(
role="Fintech Ops Analyst",
goal="Query database and execute verified transaction settlements",
tools=[db_query_tool, bash_runner_tool]
)
# 2. Wrap in 1 line:
agent = protect_agent(raw_agent, spend_cap=50.0, strict=True)
# Gated execution: secrets auto-scrubbed, catastrophic commands blocked in <35µs
result = agent.execute_task("Analyze monthly invoices and query balance")
from langchain.agents import create_react_agent
from btp_guard import protect_agent
raw_agent = create_react_agent(llm, tools)
# 1-Line Universal Protection:
agent = protect_agent(raw_agent, spend_cap=25.0)
# Destructive shell actions (rm -rf, DROP TABLE) return self-correction feedback
response = agent.invoke({"input": "Perform system maintenance on /var/log"})
from btp_guard import protect_agent
class AutonomousDevBot:
def __init__(self):
self.tools = [execute_sql, run_shell]
def run(self, prompt: str) -> str:
return f"Executing {prompt}"
bot = protect_agent(AutonomousDevBot(), spend_cap=100.0)
bot.run("SELECT id FROM users") # Allowed
bot.run("rm -rf /") # Blocked with [BLOCKED BY BARTHOLOMEW] feedback
| Parameter | Type | Default | Description |
|---|---|---|---|
agent | Object | Required | Any agent instance containing lifecycle methods or a tools list. |
spend_cap | float | 50.0 | Cumulative dollar limit for billable tool executions. |
strict | bool | True | If true, destructive invariant violations raise exceptions; if false, emits LLM feedback strings. |
TypeScript: protectAgent(agent)
Full parity for Node.js, Vercel AI SDK, Mastra, and LangChain.js agents:
import { protectAgent } from 'btp-guard';
const agent = protectAgent(myLangChainAgent, {
spendCap: 50.0,
strict: true
});
// All tool calls and prompt dispatches evaluated in <35µs
const output = await agent.invoke({ input: "Analyze accounts" });
import { protectAgent } from 'btp-guard';
const customWorker = {
name: 'DataPipelineWorker',
tools: [sqlQueryTool, fileWriteTool],
async run(prompt) { return `Done: ${prompt}`; }
};
const safeWorker = protectAgent(customWorker);
await safeWorker.run("Sync customer balances"); // Allowed
CrewAI & LangChain Integration
Intercept autonomous agent tool-calling pre-flight with zero overhead. Blocks destructive commands, secret leaks, and spend overruns before tool execution:
from langchain.agents import initialize_agent, load_tools
from langchain_openai import ChatOpenAI
from btp_guard import BTPCallbackHandler
# 1-Line Drop-in Callback Handler
guard = BTPCallbackHandler(max_spend_usd=250.0, auto_raise=True)
llm = ChatOpenAI(temperature=0)
tools = load_tools(["serpapi", "python_repl"], llm=llm)
agent = initialize_agent(tools, llm, agent="zero-shot-react-description")
# Every tool execution is audited, masked, and verified (<35µs AST checks)
result = agent.run("Calculate quarterly tax estimate", callbacks=[guard])
print("Audit Receipt:", guard.last_receipt.signature)
from crewai import Agent, Task, Crew
from btp_guard import bartholomew_guard
@bartholomew_guard(scope="data_engineering", max_spend_usd=100.0)
class SecureAnalysisAgent(Agent):
pass
researcher = SecureAnalysisAgent(
role="Senior Quantitative Researcher",
goal="Analyze market volatility invariants without leaking confidential keys",
backstory="Protected by Bartholomew AST Gateway and Ed25519 Merkle receipts",
verbose=True
)
crew = Crew(agents=[researcher], tasks=[...])
crew.kickoff()
AutoGen & Claude Code (MCP)
Wrap AutoGen conversational agents or Claude Code terminals with deterministic execution gating:
# Protect Claude Code or any bash-enabled agent in-flight: npx -y btp-guard run -- claude # Intercept and wrap an untrusted MCP server for Claude Desktop / Code: npx -y mcp-proxy-guard -- npx -y @modelcontextprotocol/server-postgres "postgresql://db:5432"
import autogen
from btp_guard import protect_autogen_assistant
config_list = autogen.config_list_from_json(env_or_file="OAI_CONFIG_LIST")
assistant = autogen.AssistantAgent("coder", llm_config={"config_list": config_list})
user_proxy = autogen.UserProxyAgent("user_proxy", code_execution_config={"work_dir": "workspace"})
# Enforce sub-35µs execution boundaries on assistant's suggested code
protect_autogen_assistant(assistant, allowed_modules=["math", "pandas", "numpy"])
user_proxy.initiate_chat(assistant, message="Plot normalized retention cohort curves")
One-Click CI/CD Agent Safety Gate (GitHub Action)
Audit agent directives (.cursorrules, CLAUDE.md, GEMINI.md) on every pull request. Intercepts prompt injection payloads, unconfined bash scripts, and leaked credentials with RFC 8785 Merkle receipts.
# .github/workflows/agent-guard.yml
name: Agent Guard Safety Audit
on: [push, pull_request]
jobs:
ai-safety-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ivegotahunnitonit/bartholomew@v6.4.4
with:
scan-paths: '.cursorrules, CLAUDE.md, GEMINI.md, copilot-instructions.md'
fail-on-exploit: true
# Run the exact same AST invariant audit locally:
python scripts/run_ci_agent_audit.py
# Output:
[+] .cursorrules: PASSED (Clean AST Invariants)
[+] CLAUDE.md: PASSED (Clean AST Invariants)
[+] GEMINI.md: PASSED (Clean AST Invariants)
Overall Agent Resilience Score: 100 / 100 [IMMUNIZED]
Merkle Attestation Root: ed25519:c0ebbf2ba24255b6821d7d9de4069...
Docker Hermetic Sandbox
For production deployments requiring hardware-level process isolation, run untrusted agent code within the hermetic Bartholomew Docker runtime:
# Run isolated container with compiled Bartholomew invariant enforcement:
docker run -d \
--name btp-sandbox \
--security-opt seccomp=unconfined \
--cap-drop=ALL \
--read-only \
-p 8080:8080 \
bartholomew/guard:v6.2.1
# Execute an untrusted agent payload inside the hermetic container:
docker exec btp-sandbox btp-guard run -- "python agent_script.py"
Cursor, Windsurf & Azure DevOps
Install the official Bartholomew Guard and Keystone Passkey extensions directly across your development environments:
# Install from Open VSX (Cursor, Windsurf, VS Code): code --install-extension Bartholomew.bartholomew-guard-vscode code --install-extension Bartholomew.bartholomew-keystone
# azure-pipelines.yml
steps:
- task: BartholomewGateV1@1
displayName: 'Verify Autonomous Code Safety'
inputs:
scanPath: '$(Build.SourcesDirectory)'
failOnViolation: true
mintSeal: true
# .github/workflows/verify.yml
steps:
- uses: ivegotahunnitonit/bartholomew@v5.4.23
with:
path: '.'
strict: 'true'
btp-guard run (Process Sandbox)
Execute any arbitrary command or subagent process under Bartholomew's dual-layer AST invariant check and eBPF syscall monitor:
# Safe command execution with cryptographic Merkle receipt: btp-guard run -- python agent.py # Destructive attacks are intercepted before kernel execve: btp-guard run -- rm -rf / # Output: [!] EXECUTION BLOCKED BY BARTHOLOMEW GATE (Exit code 126)
# Run any untrusted agent inside hardened non-root container sandbox: docker run --rm -v $(pwd):/workspace bartholomew-sandbox python agent.py
Model Context Protocol (MCP) Security
Audit and sign your MCP servers for Claude Desktop, Cursor, and Windsurf:
# Audit local or remote MCP server and generate cryptographic seal: btp-guard verify-mcp --url http://localhost:8000/sse # Install Bartholomew MCP Proxy for Claude Desktop & Cursor: btp-guard mcp install
{
"mcpServers": {
"bartholomew-guard": {
"command": "btp-guard",
"args": ["mcp", "start", "--port", "8000"]
}
}
}
Cryptographic Verification
Every execution produces an RFC 8785 Ed25519 digital signature verifiable completely offline with zero network connection:
# Verify any BTP execution receipt offline: btp-guard verify-offline --receipt receipt.json
# Export auditor-ready SOC 2 Type II & EU AI Act compliance dossier: btp-guard export-compliance --out soc2_dossier.json
Enterprise Zero-Code Sidecar Proxy (Docker & K8s)
Intercept outbound agent tool calls and REST endpoints transparently with zero code changes in the agent application. Runs as a high-throughput sidecar container in Kubernetes pods or Docker Compose.
# docker-compose.sidecar.yml
services:
bartholomew-sidecar:
image: ghcr.io/ivegotahunnitonit/bartholomew-sidecar:v6.4.4
ports:
- "9090:9090"
environment:
- PROXY_PORT=9090
- UPSTREAM_URL=http://agent-app:8000
- BTP_ALERT_CHANNEL=slack
- BTP_WEBHOOK_URL=${BTP_WEBHOOK_URL}
restart: unless-stopped
agent-app:
image: your-agent-image:latest
environment:
- HTTP_PROXY=http://bartholomew-sidecar:9090
# deploy/kubernetes/sidecar-daemonset.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: bartholomew-arp-daemonset
namespace: security-gate
spec:
template:
spec:
containers:
- name: bartholomew-proxy
image: ghcr.io/ivegotahunnitonit/bartholomew-sidecar:v6.4.4
ports:
- containerPort: 9090
resources:
limits: { cpu: "500m", memory: "128Mi" }
requests: { cpu: "50m", memory: "32Mi" }
# Verify sidecar health (<1ms CPU AST engine, 0 MB GPU VRAM)
curl -s http://127.0.0.1:9090/health | jq .
# Response
{
"status": "HEALTHY",
"version": "5.4.23",
"engine": "Bartholomew-Compiler-AST",
"latency_median_us": 15.70,
"gpu_vram_mb": 0
}
Sovereign Air-Gapped Self-Hosting (Docker & Helm 1-Liners)
Deploy Bartholomew inside secure VPCs, on-prem bare-metal clusters, or strict zero-egress air-gapped enclaves (SCIF). Operates 100% locally with zero phone-home telemetry and sub-35µs AST evaluation latency.
# 1. Run sovereign local AST gateway daemon (Port 8080)
docker run -d \
--name bartholomew-guard \
-p 8080:8080 \
-e BTP_SOVEREIGN_MODE=true \
-e BTP_MAX_LATENCY_US=35 \
-v $(pwd)/btp-config:/etc/btp \
ghcr.io/ivegotahunnitonit/bartholomew:v6.4.4
# 2. Test local in-process health endpoint
curl -s http://127.0.0.1:8080/health | jq .
# Response: {"status":"ACTIVE","mode":"AIRGAPPED_SOVEREIGN","ast_latency_us":18.2}
# 1. Add official Bartholomew Helm repository
helm repo add bartholomew https://bartholomew.info/charts
helm repo update
# 2. Deploy high-availability sovereign cluster (3 replicas, local AST compilation)
helm install bartholomew-guard bartholomew/agent-guard \
--namespace security-gate \
--create-namespace \
--set replicas=3 \
--set ast.subMicrosecond=true \
--set telemetry.phoneHome=false \
--set ingress.enabled=true
# Step 1: Export signed container image to air-gapped removable media
docker pull ghcr.io/ivegotahunnitonit/bartholomew:v6.4.4
docker save ghcr.io/ivegotahunnitonit/bartholomew:v6.4.4 -o bartholomew-v6.4.4.tar
# Step 2: Load and run in zero-egress offline SCIF environment
docker load -i bartholomew-v6.4.4.tar
docker run -d --net=none -p 8080:8080 -v /etc/btp:/etc/btp bartholomew:v6.4.4 --airgapped
Real-Time Incident Webhooks (Slack, Discord, PagerDuty & SIEM)
Stream instant, structured security alerts to your SecOps workflow whenever an autonomous agent attempts a destructive breakout, SSRF exfiltration, or wallet drain.
# .env configuration (dispatches asynchronously on background pool)
BTP_ALERT_CHANNEL=slack # slack | discord | pagerduty | siem
BTP_WEBHOOK_URL=https://hooks.slack.com/services/T00/B00/XXXXX
BTP_PAGERDUTY_KEY=pd-routing-key # for PagerDuty Events API v2
from btp_guard import Guard
from btp_guard.webhook_dispatcher import dispatch_incident
# Invariant checks automatically trigger async alerts when DENY occurs
guard = Guard()
res = guard.check("rm -rf / --no-preserve-root")
if not res["allowed"]:
print(f"Threat intercepted in {res['latency_us']}µs! Alert dispatched.")
# Sample Rich Slack Alert Block Payload
[Bartholomew ARP] Agent Security Intercept: DENY (BLOCKED)
• Agent ID: `agent-swarm-worker-42`
• Severity: `CRITICAL`
• AST Latency: `15.7 µs`
• Threat: `BTP-AST-001: Catastrophic shell pattern detected`
• Offending: `rm -rf / --no-preserve-root`
• Receipt: `ed25519:5ed00027...` | Frame: `BTP/2.2`
Bonded Agent Warranty Fund ($100,000 Pool)
Bartholomew operates an algorithmic $100,000 USD reserve pool that underwrites autonomous agent execution. Enterprise teams can issue bonded policies guaranteeing sub-35µs gating SLAs and zero uncontained data exfiltration.
# 1. Check live reserve pool status:
$ btp-guard bond pool
# 2. Underwrite a $50,000 execution bond for an agent:
$ btp-guard bond issue --agent "autonomous-trading-bot-01" --coverage 50000
# 3. In Python runtime:
from btp_guard import WarrantyFundManager
fund = WarrantyFundManager()
policy = fund.issue_policy(agent_id="agent-01", coverage_usd=50000.0)
print(f"Policy Active: {policy['policy_id']} | Merkle Bond: {policy['bond_hash']}")
Every policy issues an Ed25519-signed Merkle voucher tied to the agent's Keystone passkey. Claims undergo automated consensus arbitration before payout.
Model Context Protocol (MCP) Clearinghouse
Autonomous agents pay each other for MCP tool executions in real-time. The Bartholomew Clearinghouse acts as an in-line micro-escrow and safety validator, ensuring tool payloads pass AST inspection before micropayments settle.
# Settle a paid MCP tool invocation ($0.10 price with 2.5% take-rate):
$ btp-guard mcp-settle \
--agent "claude-code-worker" \
--tool "postgres_query" \
--payload '{"query": "SELECT COUNT(*) FROM telemetry"}' \
--price 0.10
# Output:
# [+] [MCP CLEARINGHOUSE] Tool Execution Approved (14.2µs)
# - Protocol Fee (2.5%): $0.0025 USD
# - Tool Provider Payout: $0.0975 USD
# - Merkle Settlement Seal: f4a890...710c
Universal Dynamic Schema Engine & AST Gating
Seamlessly ingest, harmonize, and validate any tool schema across Anthropic Claude, OpenAI, Google Gemini, OpenAPI 3.x, and JSON Schema 2020-12 with zero manual adapter boilerplate. Executes in-process type validation, secret redaction, and destructive command interception in 3.2 µs.
# 1. Harmonize any arbitrary schema (Claude, OpenAI, Gemini, OpenAPI) to BTP Universal Contract:
$ npx btp-guard schema harmonize ./my_tool_spec.json
# 2. In-process sub-35µs dynamic schema & AST invariant validation:
$ npx btp-guard schema validate ./schema.json ./payload.json
[PASS] Invariant Verified (< 3.2 µs) - 0 vulnerabilities, secrets scrubbed in-flight
# 3. Browse all 40 registered universal security tools in chosen format:
$ npx btp-guard schema catalog --format=claude
$ npx btp-guard schema catalog --format=openai
$ npx btp-guard schema catalog --format=gemini
Cross-IDE Unified Marketplace Distribution
Single-command deployment and workspace immunization across Cursor, Windsurf, Claude Code, and VS Code.
# Cursor IDE:
$ cursor --install-extension Bartholomew.bartholomew-guard-vscode
# Windsurf Cascade:
$ windsurf --install-extension Bartholomew.bartholomew-guard-vscode
# Claude Code / Anthropic MCP:
$ claude mcp add btp-guard npx -y btp-guard mcp-serve
# VS Code / Open VSX:
$ code --install-extension Bartholomew.bartholomew-guard-vscode
# 1-Click Workspace Immunization (.cursorrules, CLAUDE.md, .windsurfrules):
$ npx btp-guard arm
SOC 2 & EU AI Act Compliance Export
Automate security audits, vendor risk assessments, and compliance filings. Every Bartholomew invariant execution produces an immutable, cryptographically verifiable ledger mapped to SOC 2 Type II trust principles and EU AI Act Article 14 human oversight requirements.
# Export complete SOC 2 Type II compliance audit bundle:
$ btp-guard audit export --format=soc2 --output=audit_soc2_dossier.json
# Verify zero uncontained data exfiltrations or unauthorized tool invocations:
$ btp-guard audit verify --dossier=audit_soc2_dossier.json
[+] [BTP COMPLIANCE] 100% Invariant Integrity Verified (2,927 vectors)
[+] Mapped Trust Services Criteria: CC6.1, CC6.6, CC7.1