Python SDK for ATB (Agent Trace Bundle) — local-first AI audit trail
Project description
ATB Python SDK
The official Python SDK for ATB (Agent Trace Bundle) - local-first, tamper-evident audit trails for AI workflows.
Source repository: github.com/pcguest/atb
Installation
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:
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:
pip install atb-sdk[langchain]
Quick Start
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": "fast static binaries with straightforward cross-platform builds",
"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)} records (including manifest) - chain intact.")
Bundle() starts with an atb.bundle.manifest record at seq = 0. Appended events start at seq = 1.
LangChain Integration
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 callback emits the canonical ai.chain.run, ai.llm.call, and ai.tool.exec event types and also sets the top-level timestamp, trace_id, span_id, and parent_span_id event fields used by the Go runtime.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atb_sdk-0.9.0b1.tar.gz.
File metadata
- Download URL: atb_sdk-0.9.0b1.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88576d05ae76b18e774ede99ae21f71ae51e9f77f98c008d9a2ca9f978058767
|
|
| MD5 |
872c2e4833898664faf579744054f71a
|
|
| BLAKE2b-256 |
2abb4a36c39c40f68c3d4c21d01b2ec8a5d9732f505f658281a19b77d229fef6
|
File details
Details for the file atb_sdk-0.9.0b1-py3-none-any.whl.
File metadata
- Download URL: atb_sdk-0.9.0b1-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a16190581fc441d00abd4709dd24cb170e1adda47879be2f60df3ac13eb57bee
|
|
| MD5 |
cf0ed43241bbe39491ef22035b2dec91
|
|
| BLAKE2b-256 |
caa0002638b830f3e6e41a65760beef2647af2d36e3b5be55817211d8d06590f
|