Lesson 12.11 · Phase 12 · Safety, Security & Guardrails

Audit logs

When an agent does something it shouldn't have, you will be asked three questions: what exactly happened, who allowed it, and what made the agent do it. A trace helps you debug. An audit log answers those questions in a way nobody, including the agent's own operators, could have quietly edited afterwards.

Learning objectives

  • Explain how an audit log differs from a trace: purpose, contents, retention, and who may change it.
  • Record agent events with actor, cause and decision, so "why did the agent do X?" is a walk up the cause links.
  • Make the log tamper-evident with an HMAC hash chain plus an external anchor, and detect edits, deletions, reordering and truncation.
  • Minimise what's stored: omit secrets, hash content, and still prove later which content was involved.

Finance asks why the agent paid €8,400 to an IBAN nobody recognises. You open your traces. They show the tool call, but the spans from that hour were sampled out except one. The email the agent read was logged in full, including the supplier's bank details and a customer's address, so the trace store is now a privacy problem of its own. The approval isn't in the trace at all; it lived in a Slack thread. And when the security team asks whether anyone could have edited these records, the honest answer is "anyone with write access to the log bucket".

Loading the full lesson…