Skip to content
mentoor

Topic 5 of 5 · 4 min read

Audit trails for automated actions

Goal: List the fields an automation log needs so a reviewer can reconstruct any single action a month later.

An audit trail is a log that lets a person reconstruct any single automated action later: what ran, on what input, with which settings, who approved it and what changed. If you cannot explain an action after the fact, you cannot fix it, defend it or learn from it.

Check yourself · 1 of 3

A month after an automation sent an email, a manager asks why. Which log entry lets you answer?

Choose one answer

Why it matters

Someone will ask "why did the system send this?" It might be a customer, a manager or an auditor. A month later, nobody remembers. The workflow tool's default run history often keeps only a few days and may not store the text the model wrote. Accountability also means a named person stands behind each action. The NIST AI Risk Management Framework lists accountability and traceability among its aims for trustworthy AI.

How to do it

For each action, store one record with these fields.

  1. Identity: a unique run ID and the workflow name and version.
  2. Time: when it started and finished, with the time zone.
  3. Trigger and input: what started it and which item it worked on, such as a ticket number. Store a reference rather than a copy where the input is personal data.
  4. Model and prompt: the provider and model name, and the exact prompt or the prompt version. Models are updated, and the same prompt can behave differently a month later.
  5. Output: what the model produced, as sent or saved.
  6. Decision path: which rules fired, whether it was escalated, and any confidence value.
  7. Approval: who approved or rejected, when, and whether they edited the output. Record the edit.
  8. Action and result: what was changed, in which system, plus success or error.
  9. Undo information: the old value or a pointer to the backup.

Keep logs where the automation itself cannot change them, set a retention period (for example 12 months, or what your policy or law requires), and limit who can read them. The OWASP Logging Cheat Sheet also warns against logging passwords, tokens and full card numbers. Mask or leave out secrets and sensitive personal data.

Before and after

Before: The log line says "Email sent, status OK, 14:02".

You cannot tell to whom, why, from what text, or who agreed.

After: The record reads: run 8841, Refund-Reply v3, 14:02 UTC, ticket 55120, model and prompt v7, output saved, rule "refund over 200" fired, approved by Priya Rao at 14:01 with one edit, email sent to the ticket's customer, original draft stored.

What goes wrong

  • Logging only success or failure. The reason and the content are missing.
  • Logs anyone can edit. The trail is not trustworthy.
  • Secrets in logs. A log becomes a new leak.
  • No retention rule. Logs vanish after 7 days, before anyone asks.

Examples

One log record for a refund reply

Run 8841. Workflow Refund-Reply version 3. Started 2026-11-14 14:02 UTC. Trigger: new ticket 55120. Model name and prompt version 7. Rule fired: refund over 200. Approved by Priya Rao at 14:01 with one edit (the refund amount line). Action: email sent to the ticket customer. Result: delivered. Undo: draft text and original amount stored.

The one-month test

Pick a random action from last month and try to answer five questions from the log alone: what input, which prompt and model, what output, who approved, what changed. If any answer is missing, add that field to the record.

Key points

  • Each action gets one record that lets a person rebuild what happened without asking anyone.
  • Log the run, the input reference, the model and prompt version, the output, the rules that fired, the approver and the result.
  • Record human edits as well as approvals, because edits show where the model is weak.
  • Keep logs write-protected, with a set retention period and limited access.
  • Never log passwords, tokens or unneeded personal data; store references instead.

Common mistakes

  • Logging only that a step succeeded, without the input, output or reason.
  • Leaving out the model name and prompt version, so a later change in behaviour cannot be traced.
  • Storing secrets or full personal data in the log text.
  • Keeping logs somewhere the automation or any user can edit, or for too short a time.

Check yourself · 2 of 3

Why should the audit record include the model name and prompt version?

Choose one answer

Check yourself · 3 of 3

Which item should NOT be written into an automation log?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic