AI Agent Audit Trail: What to Log and How to Prove It

An AI agent audit trail is a time-ordered record of every action an agent takes: who asked for it, which tool was called with which arguments, what came back, and what changed as a result. To be useful as evidence, each entry must be written before the action runs and be protected so that edits can be detected.
This guide is for security, platform and compliance leads who let agents touch production systems. It covers what to log, how to make the log tamper-evident, what the EU AI Act and logging guidance actually say, and a checklist you can apply this week. Everything time-sensitive is stated as of 2026-11-11.
Key takeaways
- Log the action, not just the conversation. Chat transcripts show what an agent said. An audit trail shows what it did: tool, arguments, requesting user, result.
- Write the intent before the call. A record created after the fact can be missing, wrong or invented. A record created first, with a matching outcome entry after, can be checked.
- Plain logs are not evidence. The OWASP Logging Cheat Sheet asks for tamper detection and read-only copies of log data. Hash chains and write-once storage are the usual ways to get there.
- Regulation is coming, with long lead times. Article 12 of the EU AI Act requires high-risk systems to record events automatically, and the page lists application dates of 2 December 2027 and 2 August 2028 depending on the system type.
- Retention has a floor. Providers and deployers of high-risk systems must keep logs for at least six months, unless other law says otherwise.
What is an AI agent audit trail?
An AI agent audit trail is a durable, attributable record of the actions an agent performs, kept separately from the agent's own memory or chat history. It answers four questions after the fact: who triggered this, what exactly ran, what did it touch, and what was the result.
It differs from an application log in one way that matters: an application log helps engineers debug, while an audit trail has to convince a third party. An auditor, a customer or an incident responder will ask whether the record could have been edited, and "we trust our database admins" is not an answer they accept.
It also differs from an agent's chat transcript. A transcript is the model's narrative. An agent can describe an action it never took, or omit one it did. The audit trail has to be written by the system that executes the action, not by the model that requests it.
Why do AI agents need an audit trail that ordinary logs do not provide?
Agents act with delegated authority across many systems, at machine speed, based on instructions that can be influenced by untrusted text. That combination makes after-the-fact reconstruction both more necessary and harder.
Three properties set agents apart from a normal service:
- Non-determinism. The same request can produce different tool calls on different runs, so you cannot infer what happened from the code.
- Delegation. The agent acts for a person. Without recording the requesting user, you cannot say whose authority was used.
- Injection. Content the agent reads can steer it. If you cannot see the exact arguments of each call, you cannot tell a normal run from a hijacked one. The MCP security best practices guide covers how tool descriptions and results become attack surface.
What should an AI agent audit trail log?
Log one intent entry and one outcome entry for every tool call, with enough fields to replay the decision. The minimum set below fits on one line per entry.
| Field | Why it matters |
|---|---|
| Timestamp (UTC) | Orders events and anchors retention |
| Requesting user and workspace | Shows whose authority the agent used |
| Agent run ID | Groups every call from one task |
| Tool or connector name | Identifies the system touched |
| Operation and full arguments | Lets a reviewer see exactly what was requested |
| Policy decision | Records whether the call was allowed, denied or sent for approval |
| Outcome status and result summary | Shows what actually happened |
| Previous-entry hash | Links the entry into a chain (see below) |
Two cautions apply. First, arguments and results often contain personal or secret data, so redact or hash sensitive values rather than writing them in clear text. The OWASP cheat sheet warns that logs may contain personal and other sensitive information and need protection of their own. Second, do not log everything just to be safe. OWASP notes that a blind checklist approach can create "alarm fog" in which real problems go unnoticed, so tie the field list to the risks you identified.
How do you make an agent audit trail tamper-evident?
The most common method is a hash chain: each entry stores a SHA-256 hash of the previous entry, so changing or deleting any entry breaks every hash after it. A verifier can then recompute the chain and find the first point of damage.
An individual IETF Internet-Draft, draft-sharif-agent-audit-trail, describes this pattern for agents: records link by a SHA-256 digest of the previous record's canonical JSON, with optional ECDSA signatures for non-repudiation. It is a working document that expires on 3 March 2027, not an adopted standard, so treat it as a useful design reference and not a compliance requirement.
A hash chain gives you tamper evidence, not tamper proof. Someone with write access can rebuild the whole chain after an edit unless you also anchor it. Add at least one of these:
- Periodic anchoring. Publish the latest hash to a system the agent platform's admins do not control, such as a separate account or a notarisation service.
- Signatures. Sign entries or chain heads with a key held outside the logging system.
- Read-only copies. The OWASP cheat sheet recommends storing or copying log data to read-only media as soon as possible, and restricting and periodically reviewing who can read the logs.
Why write the intent record before the tool call runs?
Write the intent first because a record created after the action depends on the action succeeding, the process surviving and the code being honest. A record created before the action does not.
The IETF draft calls this pre-execution recording: writing an audit record before the action it describes. The practical rule that follows is to make logging a precondition. If the intent entry cannot be written, the call does not happen. You lose some availability, and you gain a trail with no silent gaps.
After the call, write an outcome entry that references the intent entry. A pair with no outcome is itself a signal: the call may have crashed, timed out or been interrupted, and someone should look.
Kentron's Receipt works this way: its gateway writes an intent receipt (tool, arguments, requesting user, workspace) before each connected-app call and an outcome receipt after, chained with SHA-256 hashes, and a failed intent write stops the call. The receipts are unsigned, so the chain makes tampering evident, not impossible.
What does the EU AI Act require for AI agent logging?
For high-risk AI systems, the Act requires automatic event recording and a minimum retention period. Whether a given agent is high-risk depends on its use case, so check the classification before assuming the rules apply.
- Recording. Article 12(1) says high-risk AI systems "shall technically allow for the automatic recording of events (logs) over the lifetime of the system." The article's minimum content includes the period of each use, the reference database checked, the input data that led to a match and the people who verified results, where applicable.
- Provider retention. Article 19 requires providers to keep the logs to the extent they are under their control, for a period appropriate to the intended purpose and at least six months, unless other Union or national law provides otherwise.
- Deployer retention. Article 26 contains a matching duty for deployers to keep the logs the system generates, to the extent the logs are under their control.
- Timing. The article pages state that the obligations apply from 2 December 2027 for Annex III high-risk systems and 2 August 2028 for Annex I systems, according to Article 113(c). Confirm current dates against the official text, because the application schedule has been amended before.
The Act does not prescribe hash chains. Hash chaining is an engineering choice that makes the logs credible; the regulation asks for traceability. For a wider view of what auditors ask to see, read the guide to agentic compliance and immutable evidence.
What does NIST say about protecting logs?
NIST's log management guide, SP 800-92, lists integrity checking among the log storage concerns, alongside rotation, archival, compression, reduction and normalisation. It dates from 2006, and NIST has been revising it as a draft SP 800-92 Revision 1 on its project page, so check which version your auditors cite. The principle is stable: log data should be protected, retained on purpose and checkable.
How do you build an AI agent audit trail step by step?
Follow these six steps in order. Each is small, and together they cover the common failure modes.
- Inventory the tool surface. List every connector and operation an agent can reach, and mark which are writes. Start logging with the writes.
- Put logging at the chokepoint. Record at the gateway that executes tool calls, not inside each agent or prompt. One chokepoint means one place to prove completeness.
- Define the entry schema. Use the field table above. Fix the field names early, because auditors compare entries over time.
- Write intent first, outcome second. Make the intent write a precondition and link the outcome to it by ID.
- Chain and anchor. Add the previous-entry hash, then anchor the chain head outside the platform's admin reach.
- Verify on a schedule. Run an independent verifier that recomputes the chain and reports breaks, orphan intents and gaps in time.
The Intent-Outcome-Anchor test: does your trail pass?
The Intent-Outcome-Anchor test is a three-question check for any agent audit trail. If you answer no to any one, you have a log, not evidence.
- Intent: Was an entry written before the action, and does the action stop if it cannot be written?
- Outcome: Does every intent have a linked outcome, and are orphans flagged?
- Anchor: Can someone outside the logging system's admin group confirm the chain has not been rewritten?
Run it as a tabletop exercise: pick one agent action from last week and try to answer all three using only the stored records.
What does a worked example look like?
Suppose an agent is asked in Slack to close stale support tickets. The trail should show two linked entries per call.
The intent entry records the time, the requesting user, the run ID, the ticketing connector, the operation tickets.update, the arguments (ticket ID and new status) and the policy decision "write enabled, allowed". Its hash covers the previous entry.
The outcome entry records the same run ID, a reference to the intent entry, a success status and a short result summary. If the ticket system had returned an error, the outcome would say so, and a reviewer would see the failed attempt instead of a clean story. If an injected instruction had steered the agent into updating a different ticket, the arguments in the intent entry would show it.
What are the common mistakes?
Most failed audit trails break in predictable ways:
- Logging the prompt and response only. This records the conversation and misses the tool calls that changed systems.
- Logging after the fact. If the process dies mid-call, the action happened and the record did not.
- Writable log tables. A database table any admin can update is a log, not evidence.
- Secrets in the log. Tokens and personal data copied into arguments turn the audit store into a breach target.
- No verification. A chain nobody checks is decoration. Schedule the verifier.
- Mixed identity. Recording only a shared service account hides which person's request caused the action.
How do you measure whether the trail is working?
Track three numbers weekly: the share of tool calls with a matching intent and outcome pair (target: all of them), the count of chain verification failures (target: zero, and every failure investigated), and the time to answer a sample question such as "who changed record X and why" using only the trail. If that last answer takes more than a few minutes, the schema or the tooling needs work.
When should you not build a full audit trail?
Skip the heavy version for agents that only read public data, run in a throwaway sandbox with no credentials, or produce drafts a human fully reviews before anything happens. A lightweight log is enough there. Add the full pair-and-chain design when an agent holds real credentials or can change production data, which is where IT and security teams usually draw the line. If you are weighing a build against a platform, the comparison with custom scripts lists what you would have to maintain yourself.
FAQ
What is an AI agent audit trail? It is a tamper-evident, time-ordered record of the actions an agent takes, including the requesting user, the tool, the arguments and the outcome. It is written by the system that executes the action, not by the model.
What should be in an AI agent audit trail? At minimum: UTC timestamp, requesting user and workspace, run ID, tool and operation, full arguments with sensitive values redacted, the policy decision, the outcome, and the hash of the previous entry. Log intent before the call and outcome after it.
Are AI agent logs required by law? For high-risk systems under the EU AI Act, yes: Article 12 requires automatic event recording, and Articles 19 and 26 require retention of at least six months. Whether your agent is high-risk depends on its use. Other sectors have their own record-keeping rules, so check with counsel.
How do you make AI agent logs tamper-proof? You cannot make them truly tamper-proof, but you can make tampering evident. Chain entries with SHA-256 hashes, sign or anchor the chain head outside the platform's admin control, and keep read-only copies. Then verify the chain on a schedule.
How long should AI agent audit logs be kept? The EU AI Act sets a floor of six months for high-risk systems, unless other law says otherwise. Many organisations keep them longer to match their audit cycle or sector rules, so set retention from the strictest rule that applies to you.
Is a chat transcript enough as an audit trail? No. A transcript records what the model said, not what the system executed. Use the tool-call record from the gateway as the source of truth and keep the transcript as supporting context.
Does a hash chain prove the log is complete? No. It proves entries were not changed or removed from the middle after the fact. Completeness comes from writing the intent entry before each call and flagging any intent without a matching outcome.