Skip to content
TheAgent Ecosystem
AI Agents

AI Agent Audit Log Requirements: What to Record and Why

One question decides the design: can you rebuild a single decision months later, from records nobody edited?

Muhammad Qasim HammadAI-assisted7 min read1,337 words

AI-drafted, reviewed by Muhammad Qasim Hammad on September 25, 2026. See our AI disclosure.

Accountability: Rebuild one decision, months later
Table of contents
  1. What does an audit log actually have to contain?
  2. How is this different from your observability traces?
  3. How long do you have to keep it?
  4. What breaks when the log itself holds personal data?
  5. What does this cost to run?

Somebody asks what your agent did on 14 March for one specific customer. AI agent audit log requirements are really one question: can you rebuild a single decision months later, from records nobody edited? Most teams discover the answer is no, and they discover it on the day the question is asked rather than the day the log was designed.

What does an audit log actually have to contain?#

Enough to reconstruct one decision without the person who built the system. That means the inputs as they were, the model and version that ran, the tools it called, the output it produced before anything downstream touched it, and who approved it. Aggregates and averages answer a different question entirely.

The field people leave out is the model version, and it is the one that makes historical records interpretable. Six months later, explaining an odd output is impossible if you cannot say which version produced it, because the current one behaves differently and reproducing the call proves nothing about what happened in March.

The second omission is the retrieved context. An agent that looked up 4 documents and answered from them cannot be assessed on the prompt alone, since the prompt was fine and the retrieval was wrong. Storing document identifiers and versions rather than full text keeps this affordable.

Table of six audit record fields with what each one is for and the common mistake made with itThe middle column is the test. A field nobody can name a use for is storage rather than evidence.

Write the output before downstream processing, not after. A record showing the final value in the destination system tells you what was saved, not what the agent said, and the gap between those two is exactly where an integration bug hides.

How is this different from your observability traces?#

Different consumers, different guarantees. Traces exist so an engineer can debug latency and errors this week, so they sample, expire quickly and are edited freely. An audit record exists so somebody can answer a question about one case much later, which requires completeness, immutability and a retention period nobody can casually shorten.

Sampling is the incompatibility that catches teams. A tracing setup keeping 1 percent of requests is a sensible engineering choice and a useless audit record, because the case you will be asked about is chosen by a complainant rather than by your sampler. Audit records cannot be sampled.

PropertyObservability traceAudit record
CoverageSampled, often 1 percentEvery decision
LifetimeDays to weeks6 months or considerably longer
MutabilityEdited and enriched freelyAppend only, no edits
ConsumerAn engineer, this weekAn auditor or lawyer, much later
Optimised forAggregates and latencyOne specific case
Comparison of observability traces against audit records across coverage, lifetime, mutability and intended consumerCoverage is the incompatibility. Everything below it follows from who is going to read the record.

The practical answer is two sinks rather than one system doing both badly. Emit the audit record to append-only storage on every decision, and let tracing stay sampled and cheap for its own purpose. Trying to make one pipeline satisfy both usually produces a trace store that is too expensive and an audit trail with holes in it.

How long do you have to keep it?#

At least 6 months for automatically generated logs of high-risk systems under the AI Act, and longer where other law says so. That figure is a floor rather than a target, and data protection rules, sector regulation and your own contracts routinely push the real number higher.

The word doing the work is high-risk. The Act's record-keeping duties attach to systems in defined high-risk categories, and a lot of internal automation is not one. Establish which side of that line you are on before you commit to the obligations, because copying them unnecessarily is expensive and ignoring them when they apply is worse.

Three periods interact and the longest wins. The Act's floor is one input. Your sector may set another, and limitation periods for the claims somebody could actually bring against you set a third, often measured in years rather than months. A record that expires before the claim window closes was never a defence, only a cost.

Pick a retention period deliberately either way. The failure mode is having no policy, which in practice means logs live until a storage bill is questioned and are then deleted by whoever was asked to reduce it, usually a few weeks before somebody needs them.

Four step sequence for choosing an audit log retention period from regulatory floors, sector rules and claim limitation windowsThe longest of the three wins. A record expiring before the claim window closes was only ever a cost.

What breaks when the log itself holds personal data?#

Your erasure obligations collide with your retention obligations. Prompts contain whatever the customer typed, which is frequently personal data, so the audit trail you built as a defence becomes a data protection liability with its own deletion duties pointing the opposite way.

The workable resolution is to separate identity from content. Store the record with a stable subject reference rather than the personal data itself, keep the personal fields in a store you can actually delete from, and accept that a redacted record still proves the decision was made, which is the point.

Checklist of six ways an AI agent audit trail fails when it is actually needed, including sampling and missing version identifiersEach of these passes every day until the day somebody asks about one specific case.

Test the deletion path before you need it. A subject erasure request against an append-only store is a genuinely hard problem if nobody designed for it, and discovering that during a 30 day statutory window is a bad time to start. Redacting personal data in the pipeline is the upstream half of this.

What does this cost to run?#

Less than people fear, because the expensive part is text and most of it is unnecessary. Storing document identifiers rather than retrieved passages, and hashes rather than full prompts where the prompt is reconstructable, cuts the volume sharply while keeping the record able to answer the question it exists for.

Decision flowchart for designing an AI agent audit trail, testing high-risk status, whether records are complete and immutable, and whether erasure is possibleCompleteness comes before immutability. An append-only store with gaps is still a store with gaps.

A log record feeding three downstream uses: training data, a dispute shield, and a fix ticket.The same record pays for itself three ways: training data, a dispute shield, and a fix ticket. Volume is worth estimating rather than assuming. An agent handling 2,000 decisions a day writes 730,000 records in a year, and at a few kilobytes each that is single-digit gigabytes, which is unremarkable. The number only becomes alarming when every record embeds full retrieved passages, which is the design choice to avoid rather than a reason to log less.

The cost that does bite is engineering, not storage. Append-only guarantees, a deletion path that does not break immutability, and a retrieval interface somebody can use under pressure are real work, and they are much cheaper before the log has 6 months of data in the wrong shape. Tracing at the call level gives you the plumbing; the guarantees are what you add on top.

Frequently asked questions

What should an AI agent audit log record?
Enough to rebuild one decision without the builder present. That means the inputs exactly as they were, the model and version identifier that served the request, every tool call with arguments and results, the output before any downstream processing, the retrieved context by document identifier and version, and whether a person reviewed or approved it, with timestamps throughout.
How long must AI agent logs be kept?
Under the EU AI Act, automatically generated logs of high-risk systems must be retained for at least 6 months, and longer where other law requires it. Treat that as a floor rather than a target. Data protection rules, sector regulation and the limitation periods for claims someone could bring against you commonly push the real number higher, sometimes into years.
Can our existing tracing setup serve as the audit log?
Usually not, because the guarantees differ. Traces are sampled, short lived and freely enriched, which is right for debugging and wrong for evidence. Audit records need full coverage, immutability and a retention period nobody can casually shorten. Two sinks works better than forcing one pipeline to do both, which tends to produce an expensive trace store and an audit trail with gaps.
How do we handle deletion requests against an immutable audit trail?
Separate identity from content. Keep the audit record against a stable subject reference and hold the personal fields in a store you can actually delete from. A redacted record still shows the decision was made and what drove it, which is what the trail exists for. Test that path before a statutory window is running.
Do these requirements apply to every AI agent?
No. The AI Act's record-keeping duties attach to systems in defined high-risk categories, and a great deal of internal automation is not one of them. Work out which side of that line you are on first, because adopting the obligations unnecessarily is expensive and missing them when they apply is worse. The record shape is worth copying regardless.

Sources

Primary references and vendor documentation used while drafting and reviewing this article.

  1. EU Artificial Intelligence Act, Article 19: Automatically Generated Logs

Written by

Muhammad Qasim Hammad
Muhammad Qasim Hammad
AI agents & automationFounder · Cart Gaze LLCPMP-certified PM

Muhammad Qasim Hammad is an AI agent and automation expert and the founder of Cart Gaze LLC (cartgaze.com). He builds product for the love of it: when an idea lands, a working prototype is usually running within hours, built with the same AI agents and automations he sells. He puts his own output at roughly 20× what it was before agents, and the Agentic OS behind this site is the working proof, documented in public with the tools he actually ran and what they really cost.

AI & Automation Services

Want a pipeline like this running in your business?

I'm Qasim — I design and ship AI agents and n8n automations for solo operators and small teams. Tell me what's eating your team's week, and I'll scope a fix.

Related reading