learning-it by example

Back to the video

An End-to-End Audit Trail for AI Agent Actions in Python

One line in my log had no request id, and it was the audit record of a refund.

Video #235 ยท Enterprise architecture and AI agents

Steps in the video

  1. 0:00 One log line had no request id
  2. 0:28 The idea
  3. 1:03 Setup
  4. 1:31 Stamp every line
  5. 1:58 The platform
  6. 2:29 Run it twice
  7. 3:33 What this does not show
  8. 4:11 Mistakes to avoid
  9. 4:42 My take and next steps
  10. 5:11 Recap

Files

  • compare.py (29 lines)
  • platform_parts.py (36 lines)
  • trail.py (26 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

One made-up program in one process, no model. Only a run_in_executor thread was tested; asyncio.to_thread copies the context by itself. Queues, scheduled jobs and separate services, which need a header such as traceparent, were not tested. The trail is not tamper-evident.

Sources

Learning IT by Example.