Skip to main content

AgentLog

License: MIT Python 3.9+ PyPI

Audit trail for AI agents. One decorator, zero dependencies.

pip install auditlog-ai

The problem

Your agents call models, execute tools, make decisions. If something goes wrong — or an auditor asks what happened — you have nothing. No logs, no trail, no proof.

AgentLog fixes that. Every agent action gets a structured event: who did what, when, which model, who authorized it. Append-only JSONL, SHA-256 hashed I/O, ready to ship to any backend.

30 seconds to production

Decorator — wrap any function, done:

from agentlog import log_agent

@log_agent(agent_id="support-bot", model_id="gpt-4")
def answer(prompt: str) -> str:
    return call_my_model(prompt)

answer("How do I reset my password?")
# → agentlog.jsonl gets a new line

Context manager — when you need timing:

from agentlog import AgentLogger

with AgentLogger(agent_id="support-bot", model_id="gpt-4") as logger:
    result = call_my_model("How do I reset my password?")
    logger.set_output(result)
# → logged with latency_ms

Direct call — full control:

from agentlog import AgentLogger

logger = AgentLogger(agent_id="support-bot", model_id="gpt-4")
logger.log(input_text="Hello", output_text="Hi there")

What gets logged

{
  "event_id": "a1b2c3d4-...",
  "agent_id": "support-bot",
  "session_id": "e5f6g7h8-...",
  "timestamp": "2026-03-30T12:00:00+00:00",
  "input_hash": "2cf24b72...",
  "output_hash": "486ea46...",
  "model_id": "gpt-4",
  "authorized_by": "system",
  "latency_ms": 423
}

Inputs and outputs are SHA-256 hashed. The actual content never touches the log unless you opt in with store_raw=True.

v0.2 — Async, PostgreSQL, raw storage

Async support — for async agents:

from agentlog import alog_agent

@alog_agent(agent_id="async-bot", model_id="claude-3")
async def answer(prompt: str) -> str:
    return await call_my_model(prompt)
pip install auditlog-ai[async]

Store raw content — when you need the full text, not just hashes:

logger.log(input_text="Hello", output_text="Hi there", store_raw=True)
# → input_raw and output_raw fields included in the event

Bring your own backend

JSONL by default. Supabase, PostgreSQL, or build your own:

from agentlog import AgentLogger, SupabaseBackend, PostgresBackend

# Supabase
backend = SupabaseBackend(url="https://xxx.supabase.co", key="your-key")

# PostgreSQL
backend = PostgresBackend(dsn="postgresql://user:pass@localhost/mydb")

logger = AgentLogger(agent_id="my-agent", model_id="gpt-4", backend=backend)
pip install auditlog-ai[supabase]
pip install auditlog-ai[postgres]
pip install auditlog-ai[all]        # everything

Writing your own backend is one method: save(event: AgentEvent).

Design decisions

  • Zero dependencies. Core uses only the standard library. No vendor lock-in.
  • Hashed by default. Input/output never stored in plaintext unless you opt in with store_raw=True.
  • Append-only JSONL. Grep it, stream it, pipe it. No database required.
  • Vendor-agnostic. Works with OpenAI, Anthropic, LangChain, your custom stack.
  • Async-native. Full async support for non-blocking agent pipelines.

License

MIT

Metadata

Release files for auditlog-ai 0.2.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 auditlog-ai 0.2.0
File Size Uploaded Provenance
auditlog_ai-0.2.0.tar.gz 9.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for auditlog-ai 0.2.0
File Interpreter ABI Platform
auditlog_ai-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / auditlog_ai-0.2.0.tar.gz

Download URL auditlog_ai-0.2.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3e882009cb55298371ca127c857c635e6a5508a049fe3f7a24d5ccdac43fe242
BLAKE2b-256 checksum
How to use checksums
527ed93fba7e44da29d5e2ff9cf7d99f25fb459c3a0bdf0b5063507a3c0965e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / auditlog_ai-0.2.0-py3-none-any.whl

Download URL auditlog_ai-0.2.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8c3f45e474439434c4b63909950920ba98edcb0ca25368a6e53f8cb623642be
BLAKE2b-256 checksum
How to use checksums
9327ec9e7f30650e86deb87e483d34e7bbc9a194a823b76bc606b6c154f6c984
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for auditlog-ai 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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