Skip to main content

Automatic compliance logging for AI agents. One line install, vendor-agnostic, audit-ready.

Project description

AgentLog

License: MIT Python 3.9+

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 put it in metadata.

Bring your own backend

JSONL by default. Supabase if you want cloud:

from agentlog import AgentLogger, SupabaseBackend

backend = SupabaseBackend(url="https://xxx.supabase.co", key="your-key")
logger = AgentLogger(agent_id="my-agent", model_id="gpt-4", backend=backend)
pip install auditlog-ai[supabase]

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.
  • Append-only JSONL. Grep it, stream it, pipe it. No database required.
  • Vendor-agnostic. Works with OpenAI, Anthropic, LangChain, your custom stack.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auditlog_ai-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auditlog_ai-0.1.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file auditlog_ai-0.1.0.tar.gz.

File metadata

  • Download URL: auditlog_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for auditlog_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 086c3af8e037d93f596cc657b25c6a27f864e68eea8a1aee305fa1af207aa929
MD5 06459143c3d2545e7dd6a3d15241802e
BLAKE2b-256 964700086f2f614d0925d75f7b708597c0a1ac14a165df49d19b0d5a97c1b2f8

See more details on using hashes here.

File details

Details for the file auditlog_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: auditlog_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for auditlog_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc6379fe61d275cf26b5797f829dc30febc2631d5d48e9c41c59aa5d939f27ee
MD5 b3ad0e4657f3ab4d28c9577e3515a9e0
BLAKE2b-256 e38301e31677ea32736666541f13b8cb74f85da772399f5a1ef6483120558a53

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page