esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Let’s talk

I’ll build the agent for it.

Auditability and Audit Logs

What an audit log records for an AI system, why cloud platforms often leave call logs off, and how to keep it private, for your AI interview.

In short

An audit log is a dated record of who asked an AI system to act, what it did and who approved it, so you can prove what happened later. Cloud platforms often leave detailed call logging off, and the record holds private data, so plan what to keep, who can read it and how long it lasts.

11 min readIntermediateCommon · estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

An audit log is a dated record of what an AI system did, who asked for it and who approved it. I keep two kinds: admin changes, like new keys or roles, and a trace of each call, with the model version, the tool calls and the result. Cloud platforms often leave detailed call logging off, so I check that first. Logs hold private data too, so I redact personal details and set how long they are kept.

What is auditability, in plain words?

Auditability is how well you can look back later and prove what happened: who asked, what the system did, what it saw, and who approved it. An audit log is the written record that makes this possible.

A bank branch counts its cash drawer at the end of each shift. Every note in and out is written down with a name and a time, so a short till shows where the money went, and nobody has to remember it.

Now take an AI agent. A support agent raises a customer's card limit for them. Auditability means that months later you can show the customer's request, the model's reply, the tool call that changed the limit and the check that let it through.

Key words

Audit log
An ordered list of dated events: who did what, and the result.
Trace
The full path of one request, from question to model reply to tool calls.
Retention
How long you keep the records before they are deleted.
Redaction
Removing private details, like card numbers, before they are stored.
Tamper-evident
A later change to an old entry can be spotted, if the latest hash is stored where the writer cannot change it.

What should an AI audit log record?

There are two kinds of record. Admin logs show changes to people and settings, such as a new API key, a new user or a changed role. Call traces show what the agent did on each request, and they are where the hard privacy questions sit.

One agent action, and the trail it leaves

Customer asks

wants a higher card limit

Support agent

reads the ask, picks a tool

Your code

Limit rule check

checks the new limit against the rule

Set new limit

writes to the card system

Audit log entry

who, what, when, why, result

  1. 1The customer's words reach the support agent.
  2. 2The agent asks your code to check the limit rule.
  3. 3The rule passes, so your code sets the new limit.
  4. 4The new limit and its result are written to the audit log.
A bank's support agent asks to raise a card limit. Your code checks the rule, changes the limit and writes an audit entry. Months later, that entry answers who asked, what changed and why it was allowed.

Here is a worked example from a made-up mid-size bank. The support agent gets a request at 14:32 to raise a card limit from 1,000 to 3,000 for a customer with no missed payments. The entry should hold the fields below, so the complaints team can rebuild the decision in March without guessing.

  • Who

    The customer ID, the staff user or service account that started the run, and any approver.

  • What

    The tool called and its values, such as the new limit of 3,000.

  • When

    The time of each step, in order.

  • Which version

    The model and prompt version, so you know what made the decision. Also store the model's output and tool results, because a model may not repeat the same answer.

  • Where it came from

    IDs of any documents the model read, so outside text can be traced.

  • Result

    Done, blocked or waiting, with the reason.

Why are call and content logs often switched off?

Three large platforms say some of their detailed logs stay off until you turn them on.

  • “Model invocation logging is disabled by default.”

    Amazon Bedrock

  • “Data Access audit logs are disabled by default and aren't written unless explicitly enabled”

    Google Cloud

  • “Resource logs aren't collected by default. To collect them, you must create a diagnostic setting for each Azure resource.”

    Microsoft Azure

Google Cloud's admin activity logs are different: they cannot be turned off at all. So the first check in a review is simple: is logging on for each service you use, and where does the record go?

Tip

Before launch, write down which logs are on, who can read them and where they go. Say that in the interview before you name any tool.

How long are logs kept, and who can read them?

Retention is a decision you make, and the platform's default may not match it. OpenAI says its API Platform audit logs do not currently have a fixed retention period. It keeps them on a best-effort basis, so customers with their own retention or eDiscovery rules should export and store copies. Audit logging there must be enabled first.

Claude's Enterprise export covers the past 180 days, and organization owners and primary owners can run it. Chat titles and content are left out of that export. Chat inputs and outputs will be exportable by primary owners through a separate data export.

The privacy risk is real. Amazon's invocation logging can capture the full request and response, and documents you pass through the Converse API are logged too once delivery and image logging to Amazon S3 are turned on. So the log store needs the same care as the database it came from.

The National Institute of Standards and Technology's AI Risk Management Framework makes a related point: documentation can improve transparency, human review processes and accountability in AI system teams.

How would you keep an audit trail for an agent that can issue refunds?

A refund agent moves money, so its trail has to be harder to change than the agent's own memory. I would build it this way:

  1. 1

    Log before and after

    Write the request, the rule check and the payment result, in that order.

  2. 2

    Keep the agent out of the log

    The agent asks, and your code writes. The agent has no permission to edit or delete entries.

  3. 3

    Make edits visible

    Chain each entry to the one before it, and keep the latest hash outside the agent's reach (or sign it), so a rewritten chain shows too.

  4. 4

    Redact at the door

    Store the refund ID, amount and approver. Leave out card numbers and full chat text.

  5. 5

    Test a month back

    Replay last month's refunds from the log, and check each one has an approver and a rule result.

Here is a small tamper-evident log in plain Python, using only the standard library. It chains each entry to the one before. Changing an old entry breaks the chain from that point on, as long as the latest hash is kept where the writer cannot change it.

Python
# A tiny tamper-evident audit log: each entry carries a hash of the entry before it.
import hashlib
import json

def digest(event, prev):
    body = json.dumps({"event": event, "prev": prev}, sort_keys=True)
    return hashlib.sha256(body.encode()).hexdigest()

def add(log, event):
    prev = log[-1]["hash"] if log else "start"
    log.append({"event": event, "prev": prev, "hash": digest(event, prev)})

def verify(log):
    prev = "start"
    for i, entry in enumerate(log, start=1):
        if entry["prev"] != prev or entry["hash"] != digest(entry["event"], prev):
            return "BROKEN at entry " + str(i)
        prev = entry["hash"]
    return "OK: all " + str(len(log)) + " entries match"

log = []
add(log, "agent drafted limit rise, card ending 4417, to 3000")
add(log, "rule check passed, limit set to 3000, by agent")
add(log, "entry written, customer id 88213")
print(verify(log))
log[1]["event"] = "rule check passed, limit set to 30000, by agent"
print(verify(log))

Output

OK: all 3 entries match
BROKEN at entry 2

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: a dated record that lets you prove what happened, later.
  • Two kinds of log: admin and configuration events, and a trace of each call.
  • What each entry holds: who, what, which version and the result.
  • Check that logging is on, because many platforms leave detailed logs off by default.
  • Privacy first: redact personal data and control who can read the logs.
  • Retention and export: a period set by your policy, and copies you control.

Common traps

  • Trap"Logging everything is always the right answer."

    BetterLogs hold personal data and cost money. Record what you need to prove a decision, and redact the rest.

  • Trap"The model logs its own actions."

    BetterThe model only asks. Your code runs the tool and writes the entry, so the record can't be skipped.

  • Trap"Our vendor keeps the logs, so we are covered."

    BetterCheck the vendor's retention period, then export copies that you control for your own policy.

Can you spot the gap in an audit trail?

Spot the gap

A refund agent writes to its trail. Which setup would fail a bank's review?

Quick check

A support agent changes customer limits. Which change best makes its actions reviewable later?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q464Data retention and zero-data-retention?13 min
  2. Q462Model cards vs system cards?9 min
  3. Q465Transparency duties (AI disclosure, deepfake labels)?11 min
  4. Q466NIST AI RMF basics?10 min
  5. Q460What are the EU AI Act risk tiers?9 min
  6. Q201What is prompt injection?12 min

Learn it in depth

Last updated on 27 November 2026

Building an agent that changes records or money?

I design and build AI agents with an audit trail built in: what the agent did, who approved it and how long it is kept. Book a short call and tell me what your agent can change.