Metadata-Version: 2.4
Name: btp-guard
Version: 6.6.3
Summary: BTP v6.6.3 Universal Cryptographic Trust Guard & In-Process Gateway (Gemini 3.8, Claude 3.7, AutoGen, Semantic Kernel, LangGraph, Claude Code)
Home-page: https://github.com/bartholomew-ai/bartholomew
Author: Bartholomew AI Contributors
Author-email: Bartholomew Security Contributors <security@bartholomew.info>
License: MIT
Project-URL: Homepage, https://bartholomew.info
Project-URL: Documentation, https://github.com/bartholomew-ai/bartholomew/tree/main/docs
Project-URL: Repository, https://github.com/bartholomew-ai/bartholomew
Project-URL: Changelog, https://github.com/bartholomew-ai/bartholomew/tree/main/docs/release-notes-v2.4.0.md
Project-URL: Tracker, https://github.com/bartholomew-ai/bartholomew/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=41.0.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# **`btp-guard` &bull; BTP v2.2 Universal Agent Trust Guard**
### **Cryptographic Governance for LangGraph, AutoGen, CrewAI &amp; LlamaIndex**

`btp-guard` is the official Python SDK for the **Bartholomew Trust Protocol (BTP v2.2)**. It provides 100% offline, zero-network mathematical verification of autonomous agent trajectories, tool executions, and cross-framework delegations using RFC 8785 JSON Canonicalization (JCS) and FIPS 186-5 Ed25519 signatures.

---

## **Installation**

```bash
pip install btp-guard
```

---

## **Quickstart: 1-Line Tool Guard (LangGraph / LangChain)**

```python
from btp_guard import BTPGuard

# 1. Initialize guard with your organization's recognized root authorities
guard = BTPGuard(
    trusted_authorities=["<64-hex-char-ed25519-public-key>"],
    agent_id="Agent-Production-Cluster"
)

# 2. Decorate critical tools
@guard.wrap_tool
def execute_sql_patch(sql_query: str):
    # Automatically blocked if unauthenticated or payload tampered
    return db.execute(sql_query)
```

---

## **Quickstart: Microsoft AutoGen Interceptor**

```python
from btp_guard import BTPGuard

guard = BTPGuard(trusted_authorities=[ROOT_KEY])

# Drops or alerts on unattested high-privilege tool requests in transit
safe_message = guard.intercept_autogen_message(inbound_packet)
```

---

## **Quickstart: Standalone Offline Verification (Zero-SDK)**

```python
from btp_guard import verify_btp_receipt

ok, msg = verify_btp_receipt(
    receipt_json_str=inbound_packet,
    candidate_payload={"file": "worker.py", "patch": "fix()"},
    trusted_root_pubkeys=[ROOT_KEY],
    expected_recipient_context="Agent-Production-Cluster"
)

if not ok:
    raise PermissionError(f"Attestation rejected: {msg}")
```

---

## **Specification & Challenge Package**
* **Frozen Protocol Spec:** [BTP_PROTOCOL_SPECIFICATION.md](https://github.com/bartholomew-ai/bartholomew/blob/main/BTP_PROTOCOL_SPECIFICATION.md)
* **8-Invariant Red-Team Challenge:** [CHALLENGE_PACKAGE.md](https://github.com/bartholomew-ai/bartholomew/blob/main/CHALLENGE_PACKAGE.md)
* **Live Interactive Simulator:** [https://app.bartholomew.info/simulator](https://app.bartholomew.info/simulator)
