Python SDK for transient trace ATP reference implementation
Project description
transient-trace
Governance SDK for AI agents. Intercepts, evaluates, and audits every action an agent takes — with policy enforcement, tamper-evident receipts, and a self-learning rule engine.
Install
pip install transient-trace
For development (editable install — picks up source changes immediately):
pip install -e /path/to/transient-trace-py
Quickstart
The fastest path to governed agents is the wrap command. It installs a
persistent shell shim so every invocation of the binary goes through
governance automatically — no prefix required.
# Wrap Claude Code and add shims to your shell RC file
transient-trace wrap install claude --auto-rc
# Restart your shell (or source the RC file)
source ~/.zshrc
That's it. Every claude invocation is now governed with a full receipt trail.
# Check governance is active
transient-trace wrap status
# View recent receipts
transient-trace receipts list --since 30m
# Summary with deny rate
transient-trace receipts summary --since 1h
Documentation
| Document | Description |
|---|---|
| Quickstart | Get governance running in under five minutes |
| CLI Reference | All commands, flags, and environment variables |
| Policy Format | Writing and testing governance policies |
| How It Works | Architecture, interception model, trust boundaries |
| Receipts | Audit trail, tamper detection, agent self-check |
Enforce a policy
By default, transient-trace runs in audit mode — records everything, blocks nothing. To enforce a policy, switch to strict mode:
cat > my-policy.json << 'EOF'
{
"version": 1,
"defaultAction": "deny",
"rules": [
{ "id": "allow-git", "action": "allow", "actionClasses": ["read", "write_low"] },
{ "id": "allow-anthropic", "action": "allow", "actionClasses": ["network"],
"hosts": ["api.anthropic.com"] }
]
}
EOF
transient-trace run --mode strict --policy "$(cat my-policy.json)" claude -p "..."
Or set strict mode as the permanent default:
transient-trace config set mode strict
How transient-trace intercepts agent actions
transient-trace uses three complementary interception layers:
-
PATH shims — thin bash scripts for
git,curl, and other monitored binaries are prepended to PATH. Shell-resolved calls are caught here. -
Popen hook —
sitecustomize.pyis injected viaPYTHONPATHinto every Python subprocess. It monkey-patchessubprocess.Popento catch calls that use absolute binary paths, bypassing PATH. This is why transient-trace works inside Claude Code without any changes to Claude Code itself. -
Inherited environment — both mechanisms are inherited by child processes, giving coverage across nested agents and subprocesses.
See How It Works for the full architecture.
Python SDK (low-level)
For direct integration into Python agents:
from transient_trace import Client_init
policy = {
"version": 1,
"defaultAction": "allow",
"rules": [{"id": "allow-all", "action": "allow"}]
}
client = Client_init({"agentId": "my-agent", "policy": policy})
result = client.executeActionWithReceipt(
lambda: {"ok": True},
{"target": "resource-1", "action_class": "write_low"}
)
print(result["receipt"]["receipt_id"]) # TR-...
print(result["receipt"]["outcome"]) # allow
print(result["receipt"]["signature"]["alg"]) # Ed25519
If policy returns deny, raises RuntimeError: Denied: <reason_code>.
Key differences from the TypeScript SDK
- Synchronous API — no
await, noasyncio - Config is a dict —
Client_init({"agentId": "..."}), not keyword args - Default policy is deny-all — pass a policy or set
ATP_POLICY_PATH
Building sdist / wheel (macOS, external drives)
Setuptools writes a staging directory under the current working directory. On
exFAT/FAT32 volumes (many external SSDs), macOS creates AppleDouble ._*
metadata files during staging — cleanup then fails and python -m build
errors out.
Fix: build from an APFS temp path:
./scripts/build_release.sh
Or copy the repo to ~/Developer (APFS) and run python -m build there.
To remove stray ._* files: ./scripts/clean_macos_artifacts.sh
Interoperability with TypeScript SDK
Receipt signatures are cross-verifiable — a receipt signed by the Python SDK can be verified by the TypeScript SDK and vice versa.
- Canonicalization: RFC 8785 JCS (both SDKs, action receipts)
- Signing: Ed25519 via PyNaCl (Python) / @noble/curves (TypeScript)
- Session receipts: legacy deep-sort canonicalization (both SDKs, phase 1 parity)
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 transient_trace-0.1.0a3.tar.gz.
File metadata
- Download URL: transient_trace-0.1.0a3.tar.gz
- Upload date:
- Size: 162.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08dcd721fc595001cc95c41b3b00e38fbfb589d515a6a4b7d086d2d80a5e1474
|
|
| MD5 |
c31d4b7b4c2a6538377353ae1760379c
|
|
| BLAKE2b-256 |
183d2ff75acfc6cb0adfc9fc0a6151397dcf84707375c77dbfac491ee8d516dd
|
Provenance
The following attestation bundles were made for transient_trace-0.1.0a3.tar.gz:
Publisher:
publish.yml on james-transient/transient-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transient_trace-0.1.0a3.tar.gz -
Subject digest:
08dcd721fc595001cc95c41b3b00e38fbfb589d515a6a4b7d086d2d80a5e1474 - Sigstore transparency entry: 1338974156
- Sigstore integration time:
-
Permalink:
james-transient/transient-trace@84c70da5ddb2bdae1752f7be206b046ef1f90a2b -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/james-transient
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@84c70da5ddb2bdae1752f7be206b046ef1f90a2b -
Trigger Event:
push
-
Statement type:
File details
Details for the file transient_trace-0.1.0a3-py3-none-any.whl.
File metadata
- Download URL: transient_trace-0.1.0a3-py3-none-any.whl
- Upload date:
- Size: 106.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9232c9f1729ff18167172d7a4cc2679f9365188911cc4ca5ac1e2c6fc78b10c
|
|
| MD5 |
f665da80e353e2e5941fba4b0d618468
|
|
| BLAKE2b-256 |
7f6ebab3aa4a9fb503dd830b25fc04caa35ec53ddb7fa55113fa9118a6ce0f34
|
Provenance
The following attestation bundles were made for transient_trace-0.1.0a3-py3-none-any.whl:
Publisher:
publish.yml on james-transient/transient-trace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transient_trace-0.1.0a3-py3-none-any.whl -
Subject digest:
b9232c9f1729ff18167172d7a4cc2679f9365188911cc4ca5ac1e2c6fc78b10c - Sigstore transparency entry: 1338974191
- Sigstore integration time:
-
Permalink:
james-transient/transient-trace@84c70da5ddb2bdae1752f7be206b046ef1f90a2b -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/james-transient
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@84c70da5ddb2bdae1752f7be206b046ef1f90a2b -
Trigger Event:
push
-
Statement type: