Agent Auth Gateway v1.0

Guides / 7 min read

What an Audit Log for AI Agent Actions Must Record

Published 2026-11-14 · Reviewed 2026-11-14 · By the Ingenious AI team

Every agent incident eventually becomes one question: exactly what did it do, under whose authority, and who let it? If your logs cannot answer that in minutes, you do not have an audit trail — you have a pile of debug output.

The short answer

Log every authorisation decision, not just every action: the agent's identity, the action and its arguments in summary, the estimated and actual cost, the policy rule that decided, the outcome — allow, deny or require approval — and, for approvals, who decided and what they saw. Keep logs append-only and tamper-evident, retain them for at least a year for spend-bearing agents, and make them queryable by agent, by run and by decision. The log is written by the authorisation layer, because it is the one component that sees both the request and the verdict.

Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.

Worked example: the refund nobody could reconstruct

Alder & Rose, a fictional homeware retailer, let a support agent issue refunds up to $75. A customer was refunded twice for one order — $74.99 twice, 40 minutes apart — and complained publicly. The team's provider logs showed model calls but not decisions; the agent's own transcript had rotated away. Reconstructing the event took two engineers 6 hours and ended with 'probably a retry after a timeout', which satisfied nobody, including the customer, who was refunded a third time as an apology.

Alder & Rose moved decision logging into the gateway: every call now records agent, run, action, amount, the rule that decided and the outcome, with approval records naming the approver. When a similar double-refund appeared four months later, the on-call engineer reconstructed it in 9 minutes from one query: a tool timeout, a retry with a new idempotency key, and the exact policy gap — retries of paid actions now require the original idempotency key or a human, a rule written directly from the log that proved the failure.

Log decisions, not just activity

Activity logs record that calls happened. Decision logs record why each was permitted — which rule matched, which cap was checked, which human approved. The decision is what an auditor, a customer or a court actually asks about, and it is the one thing that cannot be reconstructed later from raw traffic. If your layer can say 'allowed by rule 4, cap at 61 percent, approved by M. Patel at 14:02', most incident conversations end there.

The minimum field set

Agent identity and run id. Timestamp from the gateway's clock, not the agent's. Action name and a safe summary of arguments — amounts, recipients and resource ids, never secrets or full personal content. Estimated cost before, actual cost after. The deciding rule and outcome. The approval record where one exists. And a link to the previous entry, or another tamper-evident structure, so a gap in the chain is itself visible. Anything less and you will meet the missing field during an incident, by name.

Retention matched to the questions you will be asked

Spend questions arrive on finance cycles, disputes on customer cycles, and regulatory questions on their own slow calendar. A year is a sensible floor for agents that move money or touch customer data; longer where your sector's rules say so. Retention is cheap compared with reconstruction — Alder & Rose spent more engineer time on one missing log than a decade of storage would have cost. Archive cold logs rather than deleting them, and keep the query path working on the archive.

Logs the agent can edit are not logs

The record must be written by a component outside the agent's control, appended without an update path, and readable by people who were not involved in the incident. An agent that can summarise its own actions into the log will, under some failure or injection, summarise them flatteringly. Treat log access like key access: few writers, many readers, and every administrative read of sensitive logs itself recorded.

A one-hour audit-log health check

Once a quarter, spend an hour attacking your own log. Pick five random entries and reconstruct each action fully; time yourself. Search for gaps — time windows with no entries from a busy agent, sequence breaks, entries missing their deciding rule. Check who can write to the log store and who has, in practice, ever read it. Verify the archive restores: pull last quarter's segment and run a real query against it. And confirm the log answers the three questions every incident asks — what did it do, under whose authority, who approved it — without interviewing the engineers who built it. Findings go in the registry as dated tasks, not in a slide deck.

Five actions to make agent audit logs trustworthy

  1. Move logging into the authorisation layer so every decision — allow, deny, approval — is recorded with its rule.
  2. Capture the minimum field set on every entry: identity, run, action summary, costs, deciding rule, approver where applicable.
  3. Make the log append-only and tamper-evident, written by a component the agent cannot modify.
  4. Set retention of at least a year for money-moving agents and keep archived logs queryable.
  5. Rehearse one reconstruction: pick a past action at random and prove you can explain it fully in under 15 minutes.

Source note and related guides

Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.

Sources

  • NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023
  • OWASP Top 10 for Large Language Model Applications, the OWASP GenAI Security Project's risk list for LLM and agent systems: owasp.org, 2025
  • RFC 6749, The OAuth 2.0 Authorization Framework, the IETF standard behind scoped, expiring access tokens: rfc-editor.org, 2012

Frequently asked questions

What should an AI agent audit log contain?

Every authorisation decision with: agent identity, run id, gateway timestamp, action and a safe argument summary, estimated and actual cost, the rule that decided, the outcome, and the approver's identity for approved actions.

How long should agent logs be kept?

At least a year for agents that spend money or touch customer data, and longer where your sector requires it. Disputes and audits arrive months after the action; storage is far cheaper than reconstruction.

Should the agent write its own logs?

No. Logs must be written by the authorisation layer or another component outside the agent's control, append-only. A record the agent can edit cannot settle a dispute about the agent.

Do audit logs need to include denied calls?

Yes — denials are evidence the controls work, and a burst of denials is often the first visible sign of a loop or an injection attempt. Log refusals with the rule that fired.

How do I know my logging is good enough?

Test it: pick a random past action and reconstruct it — who, what, under which rule, at what cost, approved by whom — in under 15 minutes. If you cannot, the gap you find is your logging roadmap.

Governing agents in production?

Spend caps, approval queues, policy simulation, burn forecasting, and step-up lockdowns — all built into the gateway. Free tier to start. Or test policies in the playground with no signup.

Share this: X Facebook LinkedIn WhatsApp
← How to Rate Limit an AI Agent (Calls, To… All guides Multi-Agent Spend Attribution: Finding W… →