Catalog PyPI
PACKAGE EXPLORERView in registry

agent-audit-trail

PyPI

Tamper-proof compliance audit trail for AI agents. EU AI Act Article 12 + SOC 2 ready.

agentsaiauditcomplianceeu-ai-actloggingsoc2
Versions collected1
Direct dependencies7From release 1.0.0
Last observed20 Oct, 21:30 UTC

README

Version 1.0.0 documentation

AgentLedger

Tamper-proof compliance audit trail for AI agents.

PyPI Python 3.11+ License: MIT

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:

MethodEndpointDescription
GET/logsQuery log entries (filters: agent_id, action_type, since, until)
GET/logs/{id}Get a single entry
GET/statsLog statistics
GET/verifyVerify hash chain integrity
POST/exportExport logs as JSON or CSV
GET/reports/eu-ai-actEU AI Act Article 12 compliance report
GET/reports/soc2SOC 2 Type II evidence report
GET/reports/auditBasic audit trail report
GET/healthHealth 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

TypeDescription
llm_callLLM API calls (input, output, model, tokens)
tool_useTool/function invocations
decisionAgent decisions with reasoning
outcomeFinal outcomes and results
errorError events
human_approvalHuman-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?

FeatureAgentLedgerLangSmithBraintrustHelicone
Tamper detectionSHA-256 chainNoNoNo
EU AI Act reportsBuilt-inNoNoNo
SOC 2 reportsBuilt-inNoNoNo
Local-firstSQLiteCloud onlyCloud onlyProxy
Framework-agnosticYesLangChainEval-focusedProxy
Open sourceMITPartialPartialPartial

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.04 Apr 20267

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
jblacketter/agent-ledger

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:30 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:69f7a47f7eb575d5b056b70d1f30705a361753882a75c5249d9392f6753455ab