Tamper-proof compliance audit trail for AI agents. EU AI Act Article 12 + SOC 2 ready.
Project description
AgentLedger
Tamper-proof compliance audit trail for AI agents.
One-line SDK integration. SHA-256 hash-chained logs. Pre-built compliance reports for EU AI Act Article 12 and SOC 2 Type II. The EU AI Act high-risk system rules take effect August 2, 2026.
Quick Start
import agentledger
# Initialize (one line)
ledger = agentledger.init(agent_id="my-agent")
# Log an AI action
agentledger.log_event(
action_type="llm_call",
input="What is the capital of France?",
output="The capital of France is Paris.",
model="claude-sonnet-4-20250514",
provider="anthropic",
tokens_in=12,
tokens_out=8,
latency_ms=340,
)
That's it. Every action is hash-chained and tamper-detectable.
Features
- Tamper-proof — SHA-256 hash chain links every log entry to the previous one. If any entry is modified, the chain breaks.
- EU AI Act Article 12 — Pre-built compliance report covering logging capability, traceability, integrity, and retention requirements.
- SOC 2 Type II — Evidence report for CC6.1, CC7.2, CC7.3, and CC8.1 trust service criteria.
- One-line SDK —
agentledger.init()and you're logging. No configuration files, no infrastructure. - Local-first — SQLite storage with WAL mode. No cloud dependency. Your data stays on your machine.
- REST API — FastAPI server for querying logs, exporting (JSON/CSV), and generating reports.
- CLI — Query, verify, generate reports, and serve the API from the command line.
- Auto-capture — Anthropic SDK adapter for automatic logging of all API calls.
Installation
pip install agent-audit-trail
CLI Usage
# Query recent logs
agentledger query --agent-id my-agent --limit 20
# Verify hash chain integrity
agentledger verify
# Generate EU AI Act compliance report
agentledger report eu-ai-act --output report.md
# Generate SOC 2 evidence report
agentledger report soc2
# Show statistics
agentledger stats
# Start the API server
agentledger serve --port 8100
REST API
Start the server with agentledger serve, then:
| Method | Endpoint | Description |
|---|---|---|
GET |
/logs |
Query log entries (filters: agent_id, action_type, since, until) |
GET |
/logs/{id} |
Get a single entry |
GET |
/stats |
Log statistics |
GET |
/verify |
Verify hash chain integrity |
POST |
/export |
Export logs as JSON or CSV |
GET |
/reports/eu-ai-act |
EU AI Act Article 12 compliance report |
GET |
/reports/soc2 |
SOC 2 Type II evidence report |
GET |
/reports/audit |
Basic audit trail report |
GET |
/health |
Health check |
Architecture
┌─────────────────────────────┐
│ Your AI Agent Code │
│ │
│ import agentledger │
│ agentledger.init(...) │
│ agentledger.log_event(...) │
└──────────┬──────────────────┘
│ SDK appends entries
▼
┌──────────────────────────────┐
│ Append-Only Storage │
│ SQLite + WAL mode │
│ SHA-256 hash chain │
└──────────┬───────────────────┘
│
┌─────┴─────┐
▼ ▼
┌─────────┐ ┌──────────┐
│ CLI │ │ FastAPI │
│ query │ │ /logs │
│ verify │ │ /verify │
│ report │ │ /reports │
└─────────┘ └──────────┘
Action Types
| Type | Description |
|---|---|
llm_call |
LLM API calls (input, output, model, tokens) |
tool_use |
Tool/function invocations |
decision |
Agent decisions with reasoning |
outcome |
Final outcomes and results |
error |
Error events |
human_approval |
Human-in-the-loop approvals |
Anthropic Auto-Capture
from agentledger.adapters.anthropic_adapter import patch_anthropic
# Automatically logs all Anthropic API calls
patch_anthropic(agent_id="my-agent")
Why AgentLedger?
| Feature | AgentLedger | LangSmith | Braintrust | Helicone |
|---|---|---|---|---|
| Tamper detection | SHA-256 chain | No | No | No |
| EU AI Act reports | Built-in | No | No | No |
| SOC 2 reports | Built-in | No | No | No |
| Local-first | SQLite | Cloud only | Cloud only | Proxy |
| Framework-agnostic | Yes | LangChain | Eval-focused | Proxy |
| Open source | MIT | Partial | Partial | Partial |
License
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 agent_audit_trail-1.0.0.tar.gz.
File metadata
- Download URL: agent_audit_trail-1.0.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff30d4a3e1b4950021075299a433d48caf29c30e0fd07aa7f9a6ea8408a40dcf
|
|
| MD5 |
aefb51a3a359d0c7bbd0dd8c7d2a5d87
|
|
| BLAKE2b-256 |
dfc4e97b3f0adf6d8968566386433fc1e9681d54cf62ba1735f47bb88a263279
|
Provenance
The following attestation bundles were made for agent_audit_trail-1.0.0.tar.gz:
Publisher:
publish.yml on jblacketter/agent-ledger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_audit_trail-1.0.0.tar.gz -
Subject digest:
ff30d4a3e1b4950021075299a433d48caf29c30e0fd07aa7f9a6ea8408a40dcf - Sigstore transparency entry: 1236507792
- Sigstore integration time:
-
Permalink:
jblacketter/agent-ledger@55af15f5dc8634e49cd8a47744c65ad3293ac012 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jblacketter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55af15f5dc8634e49cd8a47744c65ad3293ac012 -
Trigger Event:
release
-
Statement type:
File details
Details for the file agent_audit_trail-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agent_audit_trail-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb45573a887407b703f269fa0cef995e99df9a44938165b31306962a8af67f3d
|
|
| MD5 |
cbdb2ed27ab14dc96541d29a4625eb86
|
|
| BLAKE2b-256 |
b3bc4433945b3088cc16d0dac5fe073b97c81537762310cbe3d80917a9973708
|
Provenance
The following attestation bundles were made for agent_audit_trail-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on jblacketter/agent-ledger
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_audit_trail-1.0.0-py3-none-any.whl -
Subject digest:
fb45573a887407b703f269fa0cef995e99df9a44938165b31306962a8af67f3d - Sigstore transparency entry: 1236507795
- Sigstore integration time:
-
Permalink:
jblacketter/agent-ledger@55af15f5dc8634e49cd8a47744c65ad3293ac012 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jblacketter
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55af15f5dc8634e49cd8a47744c65ad3293ac012 -
Trigger Event:
release
-
Statement type: