Skip to content
  1. Home
  2. AI agents
  3. Governance and regulation
  4. Audit trails

Govern and secure · Governance and regulation

What should an AI agent audit trail contain, and how do you keep it?

An AI agent audit trail is the tamper-evident record that lets someone reconstruct a single agent run after the fact: which identity acted and for whom, what it read, which tools it called with which arguments, who approved what, what it produced, and which versions of model, prompt and agent were live.

In this guide: 83 pages

Key takeaways

  1. An audit trail and a trace answer different questions. Traces are sampled telemetry for engineers; the audit trail is a complete, tamper-evident record of actions and approvals for auditors, and it must never depend on the agent reporting its own behaviour.
  2. No single product holds the whole record. Join identity logs, traces, approval events and the registry entry on a run id, and test the join before an auditor does.
  3. Default retention is shorter than most duties. Purview Audit (Standard) keeps records 180 days, CloudTrail event history 90 days and Google’s _Default log bucket 30 days, while Colorado expects compliance records for 3 years from 1 Jan 2027 and the EU AI Act expects high-risk logs for at least six months from 2 Dec 2027 for Annex III uses and 2 Aug 2028 for Annex I.
  4. Make the archive write-once. S3 Object Lock in compliance mode stops anyone, the root user included, from deleting a locked object version during its retention period, and Azure immutable blob storage offers locked time-based retention and legal holds.
  5. The trail holds personal data, so it needs the same minimisation as any other store: pseudonymous user ids, content behind a privileged role, and retention set per field instead of per log.
How an agent audit record is assembledFour sources feed the audit record of one agent run: the identity provider (agent and user ids, token issuance), the agent traces (model and tool calls, versions, errors), the approval log (approver, decision and what they saw) and the registry (owner, risk tier, approved version). They are joined on the run id and trace id and written to a write-once archive with a retention lock and legal hold. An auditor then reconstructs the run from the records alone.SourcesIdentity providerAgent and user ids,token issuanceAgent tracesModel and tool calls,versions, errorsApproval logApprover, decision,what they sawRegistryOwner, risk tier,approved versionJoin on run idand trace id; onerecord per runKept and readWrite-once archiveRetention lock,legal holdAuditor queryReconstruct one runfrom records onlyHow an agent audit record is assembledFour sources feed the audit record of one agent run: the identity provider (agent and user ids, token issuance), the agent traces (model and tool calls, versions, errors), the approval log (approver, decision and what they saw) and the registry (owner, risk tier, approved version). They are joined on the run id and trace id and written to a write-once archive with a retention lock and legal hold. An auditor then reconstructs the run from the records alone.SourcesIdentity providerAgent and user ids, token issuanceAgent tracesModel and tool calls, versions, errorsApproval logApprover, decision, what they sawRegistryOwner, risk tier, approved versionJoin on run id and trace idOne record per runKept and readWrite-once archiveRetention lock and legal holdAuditor queryReconstruct one run from records only
Four sources feed one audit record per run, joined on the run id and trace id, then written to a write-once archive that an auditor can query.

What does one audit record need to hold?

It needs enough to answer an auditor’s questions about one run without opening the agent: who acted, on whose behalf, with which versions, touching which resources and tools, under whose approval and with what result. The table lists the fields and where they come from, including the fields Microsoft Purview already records for Copilot and agent interactions.

Fields of one agent audit record, why each matters and an example source as documented on 2 Nov 2026.

FieldWhy an auditor needs itExample source
Run id, trace id and timestampsJoins every other source into one recordTrace context; the agent’s run store
Acting agent identity and the user it acted forAttributes the action and shows whether it was delegated or autonomousAgent identity sign-in logs; the user principal on the request
Agent name and versionTies behaviour to the approved versionPurview audit fields AgentId, AgentName and AgentVersion
Model provider, name and versionShows which model produced the output when several are allowedPurview ModelTransparencyDetails; modelId in Bedrock invocation logs
Instructions or prompt versionA prompt change alters behaviour as much as a model changePrompt registry version or label
Resources read, with sensitivity labelsShows whether sensitive data informed the resultPurview AccessedResources with SensitivityLabelId
Tool calls with arguments and resultsShows what the agent did, which is where harm happensexecute_tool spans; tool server logs
Guardrail and injection signalsShows attacks seen and blockedPurview XPIADetected and JailbreakDetected flags
Approval: approver, what they saw, decision, timeProves the human oversight was realThe approval service log, copied onto the run
Output and the decision it fedLinks the agent to the business outcomeThe record id in the downstream system
Stops, overrides and errorsShows the controls worked when they were neededKill-switch events; error.type on spans

Record actions from the platform side. In July 2025 Replit’s coding agent ran destructive commands on a production database during a code freeze and then told its user that a rollback was impossible, which turned out to be wrong, as The Register reported on 21 Jul 2025. An audit trail built from what an agent says about itself would have repeated the error.

How long do you keep the trail, and how do you make it tamper-evident?

Keep it for the longest period any applicable duty sets, and store it where nobody, administrators included, can change or delete it during that period. Platform defaults are often shorter than the duty, so plan an archive with a retention lock from the start.

Retention duties and platform defaults that shape an agent audit trail, as published on 2 Nov 2026.

Rule or defaultPeriodWhat it means for the trail
EU AI Act Articles 19(1) and 26(6), high-risk systemsAt least six months unless other law says otherwise; from 2 Dec 2027 for Annex III usesThe minimum for logs of high-risk agents, subject to data protection law
Colorado SB 26-189, from 1 Jan 2027Compliance records for at least 3 yearsDecision records for agents that materially influence consequential decisions
Microsoft Purview Audit (Standard)180 days by default for records created since 17 Oct 2023Copilot, Copilot Studio and Foundry interactions are included; non-Microsoft AI apps use pay-as-you-go audit with 180 days
Microsoft Purview Audit (Premium)One year by default for some workloads; custom policies up to 10 years with an add-on licenceRetention policies can target the Copilot and AI record types
AWS CloudTrail event history90 days of management events, immutableCreate a trail or a CloudTrail Lake event data store for anything longer
Google Cloud Logging buckets_Required: 400 days, not configurable; _Default: 30 days, configurable for project bucketsAdmin activity audit logs land in _Required; route data access logs to a longer bucket

For the archive itself, Amazon S3 Object Lock in compliance mode prevents any user, the root user included, from overwriting or deleting a locked object version before its retention date, and a legal hold keeps an object until someone removes the hold. Azure immutable blob storage offers time-based retention from one day to 146,000 days; once locked, a policy can be extended and never shortened, and legal holds work alongside it.

How do you keep personal data in the trail lawful?

Treat the trail as a personal-data store with a purpose, a retention period and an access list. The EU AI Act defers to data protection law on log retention, so a six-month floor never justifies keeping prompts full of personal data for years by default.

Split the record by sensitivity. Identifiers, versions, tool names, decisions and approvals are metadata an auditor needs for the full period. Prompt text, retrieved passages and tool results hold the personal data, so keep them behind a privileged role and for a shorter period where the duty allows. On Microsoft, Application Insights routes GenAI content to the AppGenAIContent table, which supports protected access in preview: set it to Protected and grant reads through the Privileged Monitoring Data Reader role or a custom role with the matching permissions.

Pseudonymise user ids in the long-term archive and keep the lookup table separately, so an investigation can still name the person when it must. Deletion and retention interact: holds suspend deletion of Copilot messages, and deleting a Copilot conversation leaves the memory derived from it in place, so an erasure request needs a check of each store.

Design for erasure before you lock anything. A write-once archive cannot drop one person’s records early, so keep prompt content and other personal fields outside the locked store, or in a store with its own shorter retention, and lock only the metadata the duty requires. Record which store holds which field, so the privacy team can answer an access or erasure request without reading the code.

How do you test that the trail works?

Run a reconstruction drill: pick a real run from last quarter and rebuild it from stored records alone, without asking the builders. Any question below that has no answer marks a gap in the trail.

  1. Which agent identity acted, and for which user?
  2. What versions of the agent, prompt and model were live at that moment?
  3. Which documents and records did it read, and which sensitivity labels did they carry?
  4. What tools did it call, with which arguments, and what came back?
  5. Who approved the action, what did they see, and when?
  6. What did the run produce, and which downstream record did it change?
  7. If a guardrail fired or someone stopped the agent, where is that event?

Repeat the drill after each platform upgrade. Changes to telemetry conventions, SDKs or table layouts can drop a field without an error, as the 30 Sep 2026 move of GenAI content into the AppGenAIContent table did for queries that read the old tables.

How do Microsoft, AWS and Google implement it?

Where each part of the audit trail lives on the three clouds, as the vendor pages showed on 2 Nov 2026.

Capability, Microsoft, AWS, Google

CapabilityMicrosoftAWSGoogle
Interaction auditPurview Audit records Copilot, Copilot Studio and Foundry interactions with agent, model and resource fieldsBedrock model invocation logging, disabled by default, with identity.arn; cross-Region requests logged in the source Region with the inference RegionAgent Runtime telemetry in Cloud Trace and Cloud Logging; content only behind a separate switch
API and admin auditUnified audit log for admin actions on Copilot and agentsCloudTrail, including AgentCore Gateway and Agent Registry callsCloud Audit Logs, with admin activity in the _Required bucket
Default retention180 days in Audit (Standard); longer with Audit (Premium) policies90 days of event history; trails and CloudTrail Lake for longer400 days in _Required; 30 days in _Default unless changed at project level
Write-once archiveAzure immutable blob storage with locked time-based retention and legal holdsS3 Object Lock in compliance mode, which administrators cannot bypass, plus legal holdsNot verified for this page

Retention periods depend on licences and settings. Check your own tenant and accounts before you write a period into a policy.

Frequently asked questions

Are agent traces the same as an audit trail?

No. Traces are telemetry: often sampled, readable by many engineers, kept for weeks and easy to delete. An audit trail is complete for actions and approvals, protected against tampering, often in a write-once archive, and kept for the period the law sets. Build it from traces where you can, then copy the fields it needs into the locked archive.

How long should we keep AI agent logs?

As long as the longest duty that applies, and no longer: at least six months for high-risk systems under the EU AI Act, from 2 Dec 2027 for Annex III uses and 2 Aug 2028 for Annex I, three years for Colorado compliance records from 1 Jan 2027, and longer where sector rules or litigation holds require it. Keep prompt content for less time than metadata where you can.

Should prompts and responses be in the audit trail?

For agents that influence decisions about people or money, usually yes, behind a privileged role, because the content is what an investigation needs. For low-risk agents, metadata and tool calls are often enough. Decide per risk tier, write the reason down and set a deletion date.

Can the agent write its own audit record?

It should never be the only writer. Record identity, tool calls and approvals at the platform, the gateway and the identity provider, where the model cannot change or invent them. The agent’s own summary of what it did is useful context, and it belongs next to the record rather than in place of it.

More in Governance and regulation

Sources

Each source was read on 2 November 2026. The date shown is the date on the page, or the page’s ms.date for Microsoft Learn; an undated page shows the date it was read.

  1. Audit logs for Copilot and AI applications Microsoft Learn, 26 August 2026
  2. Manage audit log retention policies Microsoft Learn, 19 June 2026
  3. Retention policies for Copilot and AI apps Microsoft Learn, 25 June 2026
  4. Search for and delete Copilot and AI app data with eDiscovery Microsoft Learn, 19 June 2026
  5. Restrict access to sensitive content in traces Microsoft Learn, 21 July 2026
  6. Immutable storage for blob data overview Microsoft Learn, 18 August 2026
  7. Working with CloudTrail event history AWS documentation, undated page, read 2 November 2026
  8. Locking objects with S3 Object Lock AWS documentation, undated page, read 2 November 2026
  9. Amazon Bedrock model invocation logging AWS documentation, undated page, read 2 November 2026
  10. Increase throughput with cross-Region inference AWS documentation, undated page, read 2 November 2026
  11. Cloud Logging quotas and limits Google Cloud, undated page, read 2 November 2026
  12. EU AI Act, Article 19: Automatically generated logs artificialintelligenceact.eu, undated page, read 2 November 2026. An unofficial transcription of Regulation (EU) 2024/1689.
  13. EU AI Act, Article 26: Obligations of deployers of high-risk AI systems artificialintelligenceact.eu, undated page, read 2 November 2026. An unofficial transcription of Regulation (EU) 2024/1689.
  14. SB 26-189, Automated Decision-Making Technology Colorado General Assembly, 14 May 2026
  15. Vibe coding service Replit deleted production database, faked data, told fibs galore The Register, 21 July 2025

Planning an AI program?

Talk to the team that builds it and runs it after launch.

  • Built to SOC 2, HIPAA and GDPR standards
  • EU AI Act-aligned delivery
  • Microsoft Solutions Partner