← All posts
AI & growth 1 December 2026 7 min read

An audit trail for AI agents: what to record about every change

An AI agent's audit trail should record one entry for every change the agent makes to a live system: when it happened, which tool made it, what it was asked to change, whether it worked, and the error if it didn't. Leave customer details such as addresses and free-text notes out of it, keep it for a fixed period, and write each entry at the moment a change a person approved is carried out.

What is the purpose of an audit trail for AI agents?

An audit trail answers the question you ask the morning after something looks wrong: did the agent do that, and if so, when, and was it approved? Without one, you're piecing it together from a chat history that may be gone, summarised or simply wrong about what happened.

An agent can make a lot of changes in a short time and doesn't remember them afterwards, so the log is its memory. It's also how you check that your rules are holding. If the rule is that the agent only changes prices after a person approves, the log is where you see each price change and can match it to an approval.

Deciding which jobs an agent may do on its own is a separate question, covered in how much an AI agent should be allowed to do: act, draft or escalate. The audit trail is how you check, afterwards, that it stayed inside those limits.

What should an AI agent's audit trail record?

Write one entry for each change the agent makes to a live system. Each entry needs five things:

Reads are a different matter. An agent that only looks things up hasn't changed anything, so the audit trail can stay focused on writes. That keeps it short enough that someone actually reads it.

Record failures as well as successes

A failed change is often the most useful entry in the log. It tells you the agent tried, what stopped it, and whether anything was left half done. If you only log successes, a failure looks the same as nothing happening.

Pay special attention to changes that fail part-way. If an agent is updating ten prices and the sixth one fails, the log should say which five were already changed. Otherwise someone has to check every record by hand to find out.

What should you keep out of the log?

Keep customer personal data out. An audit log is kept and read for its own purpose, so it shouldn't become a second copy of your customer records. Record identifiers and counts, not the details themselves:

Free-text fields deserve particular care. An order note or a message can hold almost anything a customer or a member of staff typed, so the safe default is to count them and leave the text where it already lives. Data protection rules vary from country to country, so check the rules where you trade before deciding what your own log keeps.

How long should you keep an AI agent's audit log?

Pick a fixed period and let entries expire on their own. Keeping everything forever builds up data you don't need, and deleting by hand means it gets forgotten. A fixed retention period, set when each entry is written, avoids both.

The right length depends on how far back you need to look when something goes wrong and on any record-keeping rules that apply to your business. There is no single number that suits everyone, and the example below uses that product's own setting, not a recommendation.

Pair the log with preview-then-confirm

An entry tells you what happened. On its own, it doesn't tell you whether anyone wanted it to happen. The fix is to write the entry at the confirm step of a preview-then-confirm flow.

The agent first prepares the change and shows a preview of exactly what will change, and nothing is written. A person says yes. Only then does the confirm step carry out that one change and write the audit entry. Because the confirm step is the only way a change gets made, every entry in the log lines up with a preview a person approved. There's more on that flow in AI agent human approval: how preview-then-confirm works in practice.

This matters most when nobody is watching. An agent that runs on a schedule leaves the log as the only record of what it did, which is why it's one of the guard rails in running AI agents on a schedule.

An audit trail example: our Linnworks MCP server design

The change tools we designed for our Linnworks MCP server keep their audit log this way. The hosted service we sell today, the Hosted MCP Server for Linnworks, is read-only and doesn't offer these tools, so treat this as a worked example of the pattern rather than a product description.

Those change tools come in preview and confirm pairs. A preview reads the current values live, shows the before and after, and writes nothing. The confirm tool runs only after the person has said yes, works once, and expires 10 minutes after the preview. Audit entries are written only at that confirm step, so read-only lookups don't add to the log.

Say you ask Claude to change the retail price of one SKU, [EXAMPLE-SKU]. You see the preview with the old and new price and say yes. The entry written when the change is confirmed holds:

If carrying out the change fails, the entry is marked as an error and the detail holds the error message instead. (A lost connection to Linnworks is handled separately: the person is asked to reconnect.) When a batch of price changes fails part-way, that message lists the SKUs that were already updated before the failure. When a new order fails part-way, the server tries to delete the half-built order, and the message says whether it managed to or gives the order ID to remove by hand.

For a new order, the entry keeps the location, each line's SKU, quantity, unit cost and tax rate, any order references, the number of notes and whether there was a separate billing address. It doesn't keep the addresses or the note text, because they can hold customer data the product doesn't keep.

Each entry is stored with a 90-day expiry, so it drops out of the log on its own after 90 days. That's that design's own setting, not a legal requirement or a figure to copy. What the hosted server does today is in the Hosted MCP Server for Linnworks and Claude.

A short checklist

Want an AI assistant that reads your Linnworks data and can't change it? Have a look at the Hosted MCP Server for Linnworks, or browse the rest of the MCP-G blog.

Frequently asked questions

What should an audit trail include?

For an AI agent, each entry should include when the change happened, which tool made it, what it was asked to change (IDs, SKUs, old and new values), whether it worked or failed, and a plain-English line describing the change or the error.

What is the purpose of audit trails in AI systems?

An audit trail shows what an AI agent actually changed, when, and whether it was approved. The agent doesn't remember its actions afterwards, so the log is the record you check when something looks wrong and the way you confirm your rules are being followed.

Should an AI agent's audit log record failed actions?

Yes. A failed change tells you the agent tried, what stopped it and whether anything was left half done. If a batch fails part-way, the entry should list the items that were already changed.

Should customer data go in an AI agent's audit log?

Keep it out. Record identifiers and counts, such as SKUs, quantities and the number of notes, rather than names, addresses or note text. Data protection rules vary, so check the rules where you trade.

What is the right audit log retention period?

There is no single right number. Pick a fixed period that covers how far back you need to look, check any record-keeping rules that apply to your business, and set entries to expire automatically. The Hosted MCP Server for Linnworks uses 90 days as its own setting, not as a recommendation.

How does an audit trail work with human approval?

Write the audit entry at the confirm step of a preview-then-confirm flow. The agent shows a preview, a person says yes, and only then is the change made and logged, so each entry lines up with an approved preview.

Practical apps for busy operators

Order entry, pricing, quote follow-up and AI connectors, built by a business that uses them every day.

See the apps