Audit trails for AI agents: what to log, and how to make the record tamper-evident
When an agent changes something important, three people will ask about it: the engineer who wants to know what happened, the security lead who wants to know why it was allowed, and the auditor who wants proof that someone approved it. Traces and chat transcripts answer the first. An audit trail has to answer all three.
In short
- Observability traces show how an agent reasoned. An audit trail shows what it did, why it was allowed and who approved it.
- Record the person the agent works for, the exact action, the rule and rules version that decided, the approver and the outcome.
- Redact secrets before they're stored, not after.
- Chain each entry to the one before it, so an edit or a deleted entry shows. That is tamper-evident, not tamper-proof.
Traces are not an audit trail
LLM observability tools record prompts, completions, tool calls and latency. They're built for debugging, and they're good at it. They tend to fall short as evidence for three reasons:
- They record what the agent did, not what it was allowed to do, by which rule, and who agreed.
- They're often sampled, rotated after days, and editable by the team they're meant to hold to account.
- They're hard for anyone outside engineering to read.
Keep your traces. Add a record of decisions next to them.
What an AI agent audit log should record
| Field | Why it matters |
|---|---|
| Time, agent and agent version | Which agent, on which machine or service |
| The person or team it works for | An agent acts for someone; the record should say who |
| Conversation or session | Groups steps, so you can see what led to an action |
| The tool and its input, with secrets redacted | The exact command, query or API call, not a summary |
| Decision, rule and rules version | Allowed, held or blocked, and by which version of which rule |
| Approver, time to decide and reason | Proof of sign-off, and that the approver wasn't the requester |
| What it changed | "deleted 4,312 rows", "destroyed 12 resources", shown before approval |
| Outcome | Ran, failed, rejected, timed out, undone |
Making the record tamper-evident
A log that the people it covers can quietly edit is weak evidence. The standard fix is a hash chain: each entry includes a hash of the entry before it, so changing or removing any entry breaks every hash after it. Add periodic signed checkpoints and anyone can verify the chain offline, without trusting the server that wrote it.
Redaction and retention
- Redact on the way in. Agents read
.envfiles and print tokens. Strip secrets before the entry is written; an audit log full of keys is a new risk. - Keep it as long as your other change records. Many teams keep change-management evidence for at least the audit period plus a year. Your auditor or legal team sets the number.
- Stream a copy out. Send each decision to Splunk, Datadog or an OpenTelemetry collector, so security sees agent actions next to everything else.
What auditors will ask for
Auditors don't yet have agent-specific checklists. They apply the change controls they already test, such as SOC 2 CC8.1, to changes an agent made. Expect questions like: which changes reached production, who approved each one, was the approver independent of the requester, and can you show the record wasn't altered. A one-page evidence pack per period answers most of them. More in SOC 2 for AI agents.
How Squidbrake records agent actions
Every decision Squidbrake makes, allowed, held, approved, rejected or blocked, goes into a hash-chained record with signed checkpoints:
squidbrake audit verify # check the chain and checkpoints, offline squidbrake evidence # a one-page evidence pack for auditors
- Each entry has who asked, which agent, the redacted input, the rule and rules version, the approver and the steps that led to it.
- Every rules version that decided something is kept, with a diff.
- Settings → Send to your SIEM streams decisions to Splunk, Datadog or an OTLP collector.
FAQ
What should an AI agent audit log contain?
Time, agent, the person it works for, the session, the exact tool call with secrets redacted, the decision with the rule and rules version, the approver and their reason, what changed, and the outcome.
Is a hash-chained audit log tamper-proof?
No, it is tamper-evident: any edit or removed entry breaks the chain and shows up on verification. Someone with full access could still delete the whole log, so keep a copy in a second system such as a SIEM.
Are OpenTelemetry traces enough for an AI agent audit trail?
Usually not on their own. Traces show what the agent did, but often not which rule allowed it or who approved it, and they're often sampled or short-lived. Use them for debugging alongside a decision record.
How long should AI agent audit logs be kept?
As long as your other change-management evidence, which your auditor or legal team sets. Many teams keep at least the audit period plus a year.
Try it on your own agents. pipx install squidbrake, then
squidbrake connect all. Start in shadow mode: nothing is blocked in week one, you see what would have been.
Quickstart · Benchmark · Book a demo