AI Agents

AI Audit Trail for Agents: What to Log and a Schema to Copy

An AI audit trail is the record of what an AI agent did, for whom and under which rule. What to log, a schema to copy, how long to keep it, what UK rules expect, and how to find the AI apps staff already use.

Header card reading AI Audit Trail for Agents: What to Log and a Schema to Copy, with the name ContextGate

This page explains what an AI audit trail is, what to log for AI agents, how long to keep it and what UK rules expect. It gives you a schema to copy, and it is written for compliance and risk leads at UK FCA-regulated firms and the engineers who build the logging. If you want the practical part first, jump to the schema to copy.

Three points matter most as of 4 November 2026:

  • No UK rule says "keep an AI audit trail". The duty comes from existing rules on records, accountability and incidents.
  • The FCA's good and poor practice examples, published on 19 October 2026, name logging and audit trails as good practice and criticise limited audit trails.
  • An agent trail needs more than prompts and answers. It has to show the tools the agent called, the identity it acted under, the rule that applied and the person who reviewed it.

What is an AI audit trail?

An AI audit trail is a time-ordered record of what an AI system did, who it acted for, what it touched and which controls applied, kept so that someone else can reconstruct events later. An AI agent audit trail does the same for a system that takes actions: it records each tool call and decision in a run, not only the final answer.

The test is simple. Pick any action an agent took last month. Can a reviewer who wasn't there say who started it, what the agent did, what it changed, whether a rule applied and who checked it?

Audit trail vs logging vs observability

These terms get mixed up, and the difference decides who can use the record.

TermQuestion it answersMain reader
LoggingWhat events did the system emit?Engineers
ObservabilityWhy is it slow, costly or failing?Engineers and platform teams
Data lineageWhere did this data come from and go?Data teams
Audit trailWho did what, under which authority, and can we show it?Compliance, audit, security, regulators

An audit trail is usually built from logs. The difference is in the extra work: a fixed structure, protected storage, a retention period and a named owner.

Why AI agents need a different trail

A chatbot produces text. An agent chooses tools, writes the arguments and acts on real systems. That creates four problems an ordinary application log doesn't solve:

  • The path isn't fixed. Two runs of the same request can call different tools in a different order, so you can't work out what happened from the code.
  • Identity blurs. Many agents use a shared service account, so the target system's log shows the account, not the person or agent behind it.
  • One request becomes many actions. Without a shared trace id, those actions are scattered across a dozen systems.
  • Text steers behaviour. Content the agent reads, such as a ticket or a web page, can change what it does next. If you don't keep what it read, you can't explain why it acted.

What to log for AI agents

Log four kinds of record and tie them together with one trace id.

Diagram of the four records in one agent run: the request, the policy decision, the tool call and the human action, all sharing a trace id
  • The request. Who asked, in which app, under which credential, using which agent and model version.
  • The policy decision. Which rule and version applied, and whether the action was allowed, warned or blocked. A blocked call is evidence too. It shows the control worked.
  • The tool call. The system, the tool, the arguments, the result, what was redacted, the status and the time taken.
  • The human action. Who approved, changed or rejected the output, and why. Without this, a human in the loop is a claim you can't show.

Log two more things when they happen: changes to the agent, such as a new model version, prompt, tool or policy; and changes to who can use it. An unexplained shift in behaviour is often a configuration change.

Model reasoning is optional. Some guides suggest storing the model's chain of thought. It can help an investigation, but it is not a reliable account of why the model acted, so don't treat it as your evidence. The tool calls and the policy decisions are what you can rely on.

Logging is one control among several. For the risks it helps you investigate, such as prompt injection through tool results and malicious MCP servers, see MCP limitations and challenges.

AI audit trail schema to copy

Use one record per event. Field names are suggestions; keep whatever your logging platform already uses. If you use OpenTelemetry, its GenAI conventions name fields such as gen_ai.tool.name and gen_ai.tool.call.id, so map to those. They are still in development, so names may change.

FieldWhat to recordWho needs it
event_idUnique id for this recordEveryone
timestamp_utcTime from a synchronised clockIncident teams
trace_idThe same id across a whole runEveryone
event_typerequest, policy_decision, tool_call, human_action, config_changeEveryone
userThe person behind the run, or the trigger if noneCompliance, security
credentialThe key, token or service account usedSecurity
appThe AI app or client, such as a coding tool or assistantSecurity, compliance
agent_id, agent_versionWhich agent and which configurationModel risk, engineering
model, model_versionProvider, model and versionModel risk
system, toolThe target system and the tool calledEveryone
argumentsWhat the agent sent, with secrets removedInvestigators
resultWhat came back, redactedInvestigators
data_classesTypes of personal or sensitive data seenData protection
policy_id, policy_versionThe rule that appliedCompliance
outcomeallowed, warned, blocked, failedCompliance
reviewer, review_outcomeWho reviewed it: approved, changed or rejected, with a reasonCompliance, senior manager
use_case_idLink to your AI inventory and its accountable ownerSenior manager

Here is an invented example of one tool call:

{
  "event_id": "evt_01J9X7",
  "timestamp_utc": "2026-11-04T10:12:44Z",
  "trace_id": "run_8842",
  "event_type": "tool_call",
  "user": "j.smith@example.co.uk",
  "credential": "oauth:j.smith",
  "app": "support-assistant",
  "agent_id": "complaints-triage",
  "agent_version": "14",
  "model": "provider-x/model-y",
  "model_version": "2026-09",
  "system": "crm",
  "tool": "get_customer",
  "arguments": {"customer_ref": "C-20417"},
  "result": {"status": "open", "phone": "[PHONE_NUMBER]"},
  "data_classes": ["phone_number"],
  "policy_id": "redact-customer-pii",
  "policy_version": "3",
  "outcome": "allowed",
  "use_case_id": "AI-007"
}

What UK rules expect

The FCA says: "We do not plan to introduce extra regulations for AI. Instead, we'll rely on existing frameworks, which mitigate many of the risks associated with AI." So an AI audit trail is how you meet existing duties.

SourceWhat it saysWhat it means for your trail
FCA AI good and poor practiceNo new requirements. Good practice includes logging and audit trails of AI interactions, and auditable records of decisions including rationale, challenge and escalation. One finding: firms "kept records of consumer prompts, outputs, model versions, applied filters and escalation decisions". Some firms' AI decisions were poorly documented, with limited audit trails.The clearest guide to what the FCA looks for. Use it as your starting field list.
SYSC 9.1 (FCA record-keeping)Firms must keep orderly records of their business and internal organisation, sufficient for the regulator to monitor compliance.Whether a given tool call falls in scope is a judgement for your compliance team. Agents acting on customer or transaction data are the first place to look.
SM&CRUnder the duty of responsibility, the FCA can act against a senior manager who did not take reasonable steps to prevent a breach in their area. The burden of proof lies with the FCA.Records made at the time are a senior manager's best evidence. Link each record to a use case with an accountable owner.
Consumer DutyFirms monitor customer outcomes and report them to the board.Where AI touches retail customers, the trail feeds that monitoring and helps with complaints.
FCA PS26/2New operational incident reporting rules come into force on 18 March 2027. Our guide covers the deadlines.You need to rebuild an incident quickly, so the trail has to be searchable.
UK GDPR accountabilityThe ICO says you "must have appropriate measures and records in place to be able to demonstrate your compliance".The trail is evidence, and it usually contains personal data itself.
EU AI Act Article 12High-risk AI systems must allow automatic recording of events. Article 19 and Article 26(6) set a floor of at least six months for keeping logs. High-risk duties for Annex III systems apply from 2 December 2027.Relevant to a UK firm if it is in scope, for example where a system's output is used in the EU. See our EU AI Act page.

The FCA's examples also say firms building agentic use cases registered their agents in a central inventory, showing which are live, who owns them and what systems and data they can reach. The inventory says what exists. The audit trail shows what it did. You need both.

How long to keep an AI audit trail

There is no single AI retention period. Start from the longest rule that applies to the activity the agent performed.

SourcePeriod
SYSC 9.1, MiFID business of a common platform firmAt least five years
SYSC 9.1 guidance, other businessAs long as relevant to the purpose the record was made for
Other Handbook modulesCheck the record-keeping schedule at the end of each module
EU AI Act Article 19, high-risk systemsAt least six months. Financial institutions under EU financial services law keep these logs with the documentation that law requires.
NCSC security logging guidanceAt least six months for your most important logs
UK GDPR storage limitationNo fixed period. Don't keep personal data longer than you need it, and document your standard retention periods.

These pull in opposite directions, so split the record. Keep the structure of each event (who, when, which tool, which rule, what outcome) for your full records period. Keep raw content such as arguments, results and prompts for a shorter period, or store it redacted from the start. If you need longer, say why in your retention schedule. The split is our suggestion, not a rule. Agree the periods with your data protection lead.

How to make the trail trustworthy

A log that its subject can edit proves little. The NCSC says to protect logs from tampering so you can be confident they accurately represent what happened, and its Cyber Assessment Framework asks that log data is held securely, with access limited to those with a business need. In practice:

  • Capture outside the agent. Record at a gateway, proxy or platform layer. Don't rely on the agent to report on itself.
  • Separate write and read. Agents and their builders shouldn't be able to change records. Consider append-only or write-once storage.
  • Keep secrets out. Strip API keys and tokens before writing the record.
  • Check capture works. The NCSC advises having a way to confirm logs are still being captured. Alert if volume falls to zero.
  • Make it readable. Under SYSC 9.1 guidance, records should be capable of being reproduced on paper in English. A compliance reviewer should be able to read one without an engineer.

Find the AI apps staff already use

A trail only covers what it can see. Before you design it, find out what is in use, including AI nobody approved:

  • Single sign-on. List AI apps people sign in to with company accounts.
  • OAuth grants. Review apps with access to mail, files and calendars. AI assistants often appear here.
  • Network and browser logs. Look for traffic to AI services.
  • Expenses and card statements. Personal subscriptions show up as small monthly charges.
  • Software already bought. Vendors add AI features to existing products. Ask each one.
  • Code repositories. Search for API keys, and for MCP configuration files such as .mcp.json.
  • A short staff survey. Ask without blame. You'll learn what people need.

For each one, decide whether to approve, replace or stop it, and add approved ones to your inventory. Then write the rule down in your AI policy.

A worked example

This example is invented. A customer complains that a credit limit letter contained the wrong figure. An agent drafted it, and a member of staff sent it. With a trail in place, the compliance lead searches by customer reference and finds one trace:

  1. 10:12, request. J. Smith asks the servicing assistant, agent version 14, to draft the letter.
  2. 10:12, tool call. The agent reads the account record. The result shows the limit as £4,000, with the phone number redacted.
  3. 10:12, policy decision. A rule stops the agent sending mail directly, and the outcome is blocked. The agent saves a draft instead.
  4. 10:15, human action. J. Smith changes one line in the closing paragraph, not the figure, and approves.
  5. Config change, two days earlier. A new model version went live with no re-test recorded.

In ten minutes the firm knows the source data was right, so the error came from the draft. It also knows the reviewer didn't catch it, and that a model change is the likely cause. It can answer the complaint, sample other letters from the same period and check whether the problem needs reporting. Without a trail, the firm has a letter and a guess.

AI audit trail checklist

Scope

  • List every AI use case and agent, including AI inside bought software.
  • Name an accountable senior manager and a technical owner for each.
  • Decide which use cases need a full trail. Start with those that reach customers, money or personal data.

Capture

  • Record requests, policy decisions, tool calls and human actions.
  • Use one trace id across a run.
  • Give each agent its own identity, and record the person behind it.
  • Record blocked and failed actions as well as successful ones.
  • Log changes to models, prompts, tools and policies.

Protect

  • Capture outside the agent.
  • Remove secrets, and redact personal data where you can.
  • Limit read and write access.
  • Alert if logging stops.

Retain

  • Set periods by activity, not by tool.
  • Separate event structure from raw content.
  • Add the logs to your retention schedule and your record of processing.

Use

  • Sample records on a set schedule, and record the review.
  • Feed the results to the senior manager and, where relevant, the board report.
  • Run the drill below twice a year.

The 30-minute audit trail drill

Ask someone outside the team to pick one agent action from last month, and give them 30 minutes to answer these. The 30 minutes is our suggestion, not a rule. Each gap is a fix to make.

  1. Who started it, and under which credential?
  2. Which agent, model and version ran?
  3. Which systems did it touch, and what changed?
  4. What rule applied, and what was the outcome?
  5. Who reviewed it?
  6. Can you produce that as a readable record for a regulator?

Common mistakes

  • Logging prompts and answers only. The risk in an agent sits in its tool calls.
  • Shared service accounts. The target system can't tell one agent or person from another.
  • Leaving it in vendor dashboards. Check how long each vendor keeps logs, and whether you can export them. The FCA says firms remain responsible for outsourced AI services.
  • Keeping everything forever. Raw logs full of personal data are a risk of their own.
  • Not recording blocks. Blocked calls show that a control works.
  • Nobody reads it. A trail no one samples won't catch a problem until a complaint does.
  • Assuming the gateway sees everything. An agent can act outside it. Close those routes, or record them another way.

How ContextGate helps

ContextGate is an MCP gateway that sits between AI apps and the tools they use. It keeps an AI agent audit trail outside the agent, so you don't have to build the capture layer yourself:

  • The record. Each tool call is logged with a timestamp, the AI app, the signed-in user, the connection, the tool, the arguments as sent, the result with personal data replaced by placeholders, and the outcome: allowed, warned or blocked, with the policy that fired.
  • Secrets. A call with an API key in its arguments is blocked, and the key is kept out of the log.
  • Search and export. Filter by app, connection, tool, status, policy and date, and export the record as CSV for an auditor.
  • Reports. The AI security review pack is built from that record and shows which AI apps use your workspace, what they can do, a sample of the log and the blocked and warned calls. The SM&CR pack, incident report and others on the compliance reports page use the same record, and all are available now.

What it doesn't cover: ContextGate sees the tool calls that go through it, not an AI app's built-in tools or the chat itself, so the request and human review records in the schema above stay with you. It doesn't find AI apps used outside it, and it is not a certification. Your retention schedule and the choice of policies remain your firm's decisions, and it doesn't replace legal advice. For the wider picture, see AI agent governance.

Questions people ask

What is an AI audit trail?

A time-ordered record of what an AI system did, who it acted for, what it touched and which controls applied, kept so someone else can reconstruct events later.

Can you give me an example of an audit trail?

Yes. For an AI agent: at 10:12 a named user asked an assistant to draft a letter, the agent read one customer record, a rule blocked it from sending mail, and at 10:15 the user changed and approved the draft. See the worked example.

What should an AI agent audit trail include?

The request, the policy decision, each tool call and the human action, tied together by a trace id. The schema above lists the fields.

How do you audit AI agents?

Start from your inventory, then sample real runs from the trail. Check that each action matched the agent's approved purpose, that the right rule applied and that reviewers really reviewed. Run the drill above for one action to find the gaps.

How do you audit actions that bypass the gateway?

Remove the route where you can: give the agent no direct credentials, so its only way to a system is through the gateway. Where that isn't possible, use the target system's own logs and the AI app's logs, and join them on user and time.

Does the FCA require an AI audit trail?

No rule uses those words. The FCA relies on existing rules, including record-keeping, SM&CR and the Consumer Duty, and its October 2026 examples treat logging and audit trails as good practice.

Does the EU AI Act require logs?

For high-risk AI systems, yes. Article 12 requires them to allow automatic recording of events, and providers and deployers keep logs under their control for at least six months. Annex III duties apply from 2 December 2027.

Is an AI audit trail personal data?

It usually contains personal data, such as user names and any customer details in arguments and results. Redact what you can, limit access, set a retention period and include the logs in your records of processing.

A summary, not legal advice: check your obligations with your compliance team or adviser. Rules as of 4 November 2026.