Metadata-Version: 2.4
Name: atb-sdk
Version: 1.6.0
Summary: ATB (Agent Trace Bundle) Python SDK - local-first, tamper-evident audit trails for AI workflows
Author-email: Paddy Guest <patrickcguest@proton.me>
License-Expression: MIT
Project-URL: Homepage, https://github.com/pcguest/atb
Project-URL: Repository, https://github.com/pcguest/atb
Project-URL: Documentation, https://github.com/pcguest/atb/blob/main/docs
Keywords: audit,ai,traceability,verification,privacy,local-first
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=42.0.0
Provides-Extra: langchain
Requires-Dist: langchain>=0.1.0; extra == "langchain"
Requires-Dist: langchain-core>=0.2.0; extra == "langchain"
Provides-Extra: llamaindex
Requires-Dist: llama-index>=0.10.0; extra == "llamaindex"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

# ATB Python SDK

The official Python SDK for [ATB (Agent Trace Bundle)](https://github.com/pcguest/atb) - local-first, tamper-evident audit trails for AI workflows.

## Installation

```bash
pip install atb-sdk
```

Use this package when you need to write or verify bundles from Python code. The Go CLI remains the authoritative CLI path:

```bash
go install github.com/pcguest/atb/cmd/atb@latest
```

The package does not include a standalone ATB CLI. The installed `atb` command is a compatibility stub that prints Go CLI install guidance and will be removed in a future major release.

With LangChain integration:

```bash
pip install atb-sdk[langchain]
```

## Quick Start

```python
from atb import Bundle

# Create a new bundle in Python
bundle = Bundle()

# Append events
bundle.append("dev.session", {
    "date": "2025-01-15",
    "features_built": ["hash chaining", "CLI init"],
    "blockers": ["RFC 8785 library compatibility"],
})

bundle.append("decision", {
    "choice": "Go over Rust for CLI",
    "reason": "Solo founder velocity",
    "alternatives": ["Rust", "Python-only"],
})

# Save to disk
bundle.save("run.atb/bundle.atb")

# Later - reload and verify integrity
b = Bundle.load("run.atb/bundle.atb")
b.verify()  # Raises ATBVerificationError if tampered
print(f"Verified {len(b)} events - chain intact.")
```

## LangChain Integration

```python
from atb import Bundle
from atb.langchain_callback import ATBCallbackHandler
from langchain.chat_models import ChatOpenAI

bundle = Bundle()
handler = ATBCallbackHandler(bundle, auto_save=True)

llm = ChatOpenAI(callbacks=[handler])
# All LLM calls are now automatically recorded in the bundle.
```

The deprecated shim import path `atb.integrations.langchain.ATBCallbackHandler` still works for compatibility, but it emits a `DeprecationWarning`. Use `atb.langchain_callback.ATBCallbackHandler` for new code.

## Licence

MIT
