Skip to main content

View the live site

Agent Audit Logger

Every agent call logged. SOC 2 ready.

A lightweight Python middleware that wraps any agent framework (LangChain, CrewAI, AutoGen, n8n, Hermes) and logs every tool call — what was invoked, what data passed through, what changed. Output as JSON to file or Google Sheets. Exportable PDF reports for compliance.

Target: startups that need SOC 2 prep but can't afford $10K/mo enterprise stacks.

Features

  • Framework-agnostic middleware — wrap any Python callable or agent tool function
  • JSON log rotation — daily rolling files with optional gzip compression
  • Google Sheets export — real-time audit trail in a shared sheet
  • PDF compliance reports — cover page, executive summary, detailed entry table, checksums
  • Tamper-evident — each entry includes a SHA-256 checksum
  • Session tracking — correlate all calls from a single agent run

Quick Start

pip install agent-audit-logger

Basic usage

from agent_audit_logger import AuditLogger, AuditEntry, AuditMiddleware
from agent_audit_logger.exporters.json_logger import JsonLogExporter

# Create logger and add JSON output
logger = AuditLogger()
logger.add_exporter(JsonLogExporter("audit_logs/"))

# Create middleware
middleware = AuditMiddleware(logger, agent_name="my_agent")

# Use as a decorator
@middleware(tool_name="search_web", tags=["search"])
def search_web(query: str) -> str:
    return f"Results for {query}"

# Or wrap existing functions
wrapped_func = middleware.wrap(
    my_existing_tool,
    agent_name="worker",
    tool_name="my_tool",
)

# Log manually
entry = AuditEntry(
    agent_name="my_agent",
    tool_name="web_search",
    tool_input={"query": "SOC 2 compliance"},
    tool_output="Results...",
    duration_ms=1200.5,
)
logger.log(entry)

LangChain integration

from langchain.tools import Tool
from agent_audit_logger import AuditLogger, AuditMiddleware

logger = AuditLogger()
logger.add_exporter(JsonLogExporter("audit_logs/"))

middleware = AuditMiddleware(logger, agent_name="langchain-agent")
wrapped_tools = AuditMiddleware.wrap_langchain_tools(middleware, tools_list)

CrewAI integration

middleware = AuditMiddleware(logger, agent_name="crewai-agent")
AuditMiddleware.wrap_crewai_tools(middleware, crew_tools_list)

Generate PDF report

report_path = logger.generate_report(
    "compliance_report.pdf",
    title="Q3 SOC 2 Audit Log",
    date_range=("2025-01-01", "2025-03-31"),
)

Log rotation

# Manual rotation (happens automatically on file size threshold)
summary = logger.rotate(archive=True)

Configuration

Setting Default Description
AGENT_AUDIT_LOG_DIR audit_logs/ Directory for JSON log files
AGENT_AUDIT_MAX_FILE_MB 10 Rotate when log file exceeds this size
AGENT_AUDIT_COMPRESS False Gzip old rotated files
GOOGLE_SERVICE_ACCOUNT_PATH ~/.hermes/secrets/client_secret.json Path to Google service account JSON

Pricing

  • $49/mo — Up to 3 agents, 10K logs/month
  • $99/mo — Unlimited agents, 50K logs/month, PDF exports

License

MIT

Release files for agent-audit-logger 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-audit-logger 0.1.0
File Size Uploaded
agent_audit_logger-0.1.0.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-audit-logger 0.1.0
File Interpreter ABI Platform
agent_audit_logger-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.2 kB

Release files / agent_audit_logger-0.1.0.tar.gz

Download URL agent_audit_logger-0.1.0.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d13b058587d7514b0150587d3393fb94fe4875d0c5961c0e20c5788d1ef1bd36
BLAKE2b-256 checksum
How to use checksums
9021491ca27efd461cd4e9b467972b14a3d722fe3309e1d1bb4cebb917588c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / agent_audit_logger-0.1.0-py3-none-any.whl

Download URL agent_audit_logger-0.1.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d5779bc81bc6ca57a90e39466460ae813dac4dd174d99fdf1867bbab7f52307
BLAKE2b-256 checksum
How to use checksums
f533ccc8397c667ad94eaeba73dfab9d2bcc8fc2a94969a69a44f1c33b0b8a69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page