AI governance

AI Audit Trail for Agents: The Six Questions Your Log Must Answer

An immutable log of API calls tells an investigator what happened, never why. Design the agent's audit trail around the questions an investigation asks, and capture each answer from the system that knows it, not from the agent.

An open ruled ledger crossed by a trail of footprints, an amber bookmark ribbon at the key page, a small loupe beside it, on parchment.

TL;DRThe 10-minute read in 60 seconds

An AI agent's audit log must answer six questions: who asked, which version acted, what it saw, what allowed it, who approved, what changed. A locked API-call log alone cannot.

  1. Get each answer from the system that knows it, such as the approval step. An agent's own story of its reasoning may be untrue or faked.
  2. Fully log any action that changes core records, moves money, sends outside or changes access. Write the log first; if that fails, block the action.
  3. The EU AI Act's logging rules start on 2 December 2027 for high-risk (Annex III) systems, kept six months at least. MAS's SAFR paper is voluntary.
  4. Singapore's data law (PDPA section 25) limits keeping personal data. Keep a lean log for a set audit window; delete raw prompts much sooner.

An AI audit trail for agents is useful only if it answers six questions: who asked, which build acted, what it saw, what allowed it, who approved, and what changed. An API-only log answers an easier seventh question: which API was called. Making it immutable does not help; immutability preserves the gaps too. This is for the CTO and compliance lead signing off an agent before go-live: a field-level schema, a rule for which actions need it, the legal hooks with their real dates, and one test. Can someone reconstruct a decision from the log alone?

On 3 July 2026, MAS published, with industry partners, SAFR, the Safeguards for Agentic Finance at Runtime white paper, in which a tamper-evident audit log is one of four components. On 5 August, MAS told Parliament its AI risk guidelines covering agentic AI "will be finalised soon". This is general information, not legal advice.

Why isn't an immutable AI audit trail enough?

An immutable AI audit trail proves a record was not altered after it was written. It cannot prove the record holds the right facts. A tamper-evident line reading "service account called the refunds endpoint, 200 OK" is perfectly preserved and still useless to an investigator, because it says nothing about who asked, what the agent knew, or which rule let the call through.

Immutability is a storage property. Usefulness is a schema property. It is easy to buy the first and assume the second.

IMDA's Model AI Governance Framework for Agentic AI (version 1.5, published 20 May 2026, updated 5 June 2026) lists "ensure log immutability" as one practice among several. Before it, it says organisations should decide "what to log" by working back from their monitoring objectives. Decide what an investigation needs. Then lock it down.

The second problem is less obvious: an agent is an unreliable narrator of its own work. The same IMDA framework warns that chain-of-thought reasoning "may not be a faithful explanation of the agent's actions." SAFR goes further: the trace an agent submits with a proposed action is agent-declared; both "can be fabricated together by a sophisticated adversarial injection." So SAFR treats that package "as a document to be authenticated against its origin, not merely as a record of what the agent reported."

It is tempting to treat the reasoning trace as the "why" of an audit record. Keep it, label it agent-declared, and never let it be the only answer to a question. What the agent saw should come from the retrieval layer and the tools.

What six questions will an investigator ask about an agent?

An investigator reconstructing an agent action asks six things. Who asked, and on whose authority? Which agent, model, prompt and policy version was running? What did the agent actually see? What rule allowed the action? Who approved it, and what were they shown? What changed in the target system, and can it be reversed? Each answer belongs to a different system.

Your identity provider knows who asked. Your agent registry knows which build ran. Your retrieval layer and tool gateway know what data came back. Your policy engine knows which rule fired; your confirm step knows who approved; the target system knows what changed. The decision record joins those answers under one action ID at the moment of decision, so nobody stitches six systems together under deadline later.

IMDA's framework adds one detail. The capacity in which an agent acts, "independently or on behalf of a specified human user", should be "recorded for auditability". That is the on_behalf_of field, and it is separate from the service account the agent runs under.

Anatomy of an agent decision recordSix questions, one record, each answer taken from the system that knows itINVESTIGATOR ASKSRECORD FIELDSCAPTURED FROMWho asked?principal_idon_behalf_ofIdentity providerWhich agent, which build?agent_id, modelprompt + policy versionAgent registryWhat did it see?input_refscontent hashesRetrieval and tool layerWhat allowed it?rule_idoutcomePolicy engineWho approved?approver, shown_payload_hashapproved_atConfirm stepWhat changed?before / afterreversal_refTarget systemWhat an API-only log holds: timestamp, service account, endpoint, 200 OK.On its own, that line answers none of the six questions above.
Anatomy of an agentdecision recordSix questions, one record, each answertaken from the system that knows itINVESTIGATOR ASKSRECORD FIELDSCAPTURED FROMWho asked?principal_idon_behalf_ofIdentity providerWhich agent, which build?agent_id, modelprompt + policy versionAgent registryWhat did it see?input_refscontent hashesRetrieval and tool layerWhat allowed it?rule_idoutcomePolicy engineWho approved?approver, shown_payload_hashapproved_atConfirm stepWhat changed?before / afterreversal_refTarget systemWhat an API-only log holds: timestamp,service account, endpoint, 200 OK.On its own, that line answers noneof the six questions above.
The decision record joins six answers under one action ID; the API call line is the least useful part.

SAFR's audit entry covers part of this. Each entry "should capture the essential elements of a governance decision: the governance envelope as submitted, the mandate against which the action was checked, the outcome produced by the Disposition Engine, the specific rules applied, the basis for that outcome, and the time elapsed at each stage." Mandate and rules answer "what allowed it".

The envelope is not an independent answer to "what did it see", though. SAFR defines it as the proposed action, an agent-declared trace of how the agent reached it, and context metadata such as agent identity, mandate and account state. It has no field for the human who asked, so add principal_id yourself. SAFR targets financial institutions; the six questions are the same for a clinic.

The EU AI Act does not prescribe this schema either. Article 12 lists minimum log fields only for remote biometric identification systems (Annex III point 1(a)). One of them is "the identification of the natural persons involved in the verification of the results", tied to the two-person check in Article 14(5). That is a narrow biometric safeguard, not a general duty to log approvers. Still, where the law lists fields, it asks for the human who checked.

Which agent actions need a full decision record?

An agent action needs a full decision record when it writes to a system of record, moves money, sends something outside the organisation or changes a permission. Read-only lookups can live in ordinary traces. IMDA's agentic framework (v1.5, May 2026) points the same way, telling organisations to prioritise monitoring for "updating database records or financial transactions".

Write the record before the action executes, and fail closed: if the record cannot be written, the action does not run. A record assembled afterwards by a pipeline that can drop events is a trace, not evidence.

Never sample. Tracing pipelines often keep a fraction of spans to save cost; a decision record for one refund in ten is worthless in a dispute about the other nine.

Log denials and escalations as well as approvals. SAFR's log captures the record and outcome "for every action regardless of result", and a run of denied attempts is exactly what you want to see when you suspect a prompt injection.

Give every step its own record. SAFR says an Auto-Execute or Observe outcome "at one step carries no authority into the next", so each consequential step is checked and logged separately, linked by a parent_action_id.

Then alert on gaps: any consequential record with an empty field for one of the six questions should page someone. A blank approver on a refund above the cap is an incident, not a data-quality issue.

Illustrative example: at 2 KB per record and 5,000 consequential actions a day, the decision record grows by about 10 MB a day, or roughly 3.7 GB a year. Storage is not the cost. Instrumenting the policy engine and the confirm step is.

What should an AI agent log? A field-by-field schema

An AI agent should log one decision record per consequential action. The record holds identifiers and hashes, not raw content: who asked, which versions ran, references to the inputs used, the rule that fired, the approver and the before-and-after state. Raw prompts and outputs go to a separate store with shorter retention.

Here is the schema we would hand an engineering team, with the question each field answers. Retention figures are design suggestions, not legal minimums.

Field Answers Why Suggested retention
action_id, parent_action_id, stage timestamps All six Joins everything Life of the record
principal_id, on_behalf_of Who asked Requester, not service identity Record window
agent_id, model, prompt_version, policy_version Which build Ties incidents to changes Record window
input_refs, content_hash What it saw Points; does not copy Refs: record window. Raw: short
tool, target, parameters_hash What it did What most logs hold Record window
rule_id, outcome, reason_code What allowed it Which rule fired Record window
approver_id, shown_payload_hash, approved_at Who approved Shown equals executed Record window
before_state_ref, after_state_ref, reversal_ref What changed Scope and fix Record window
raw prompt, output, retrieved text Context Forensics; personal data Separate store, shortest defensible

Two fields do more work than their size suggests. The first is policy_version. When an agent misbehaves after weeks of good conduct, check what changed before blaming the model. That is a working hypothesis, not a measured base rate, and you cannot test it without versions in every record.

The second is shown_payload_hash. An approval proves little if the approver saw one version and the agent executed another. Hashing the exact payload shown at the confirm step and comparing it with the executed payload closes that gap.

Now the privacy tension. Singapore's PDPA section 25 requires an organisation to "cease to retain its documents containing personal data, or remove the means by which the personal data can be associated with particular individuals" as soon as it is reasonable to assume the original purpose is no longer served and retention "is no longer necessary for legal or business purposes." Because the section allows retention for a legal or business purpose, the answer is design: a lean decision record kept for a documented audit and dispute window, and raw transcripts on a much shorter clock.

Two cautions. A principal_id is still personal data, so the lean record stays in scope. And a hash de-identifies nothing while you still hold the transcript it came from; delete the raw store on schedule, or the hash is only a pointer. IMDA's framework flags a further risk in multi-agent setups, where sharing context between agents "increases the likelihood for sensitive data to be unintentionally logged".

What does the law require of AI agent logs in the EU and Singapore?

The EU AI Act will require automatic logging, kept for at least six months, for Annex III high-risk AI systems from 2 December 2027. Article 12 sets the logging duty; Articles 19 and 26(6) set retention for providers and deployers. Annex I systems follow from 2 August 2028. Singapore has no agent-logging statute that we found; MAS and IMDA guidance set expectations, and the PDPA limits retention.

The table separates binding law from guidance.

Instrument Status On logs Retention
EU AI Act, Art. 12 Law, high-risk only; from 2 Dec 2027 (Annex III) Automatic logs over the system lifetime Set by Arts 19 and 26(6)
EU AI Act, Arts 19 and 26(6) Law, same dates Providers and deployers keep logs Six months minimum, unless other law differs
Regulation (EU) 2026/1744 Law, in force 27 July 2026 Defers the above: Annex III to 2 Dec 2027, Annex I to 2 Aug 2028 Not applicable
MAS TRM Guidelines (Jan 2021) Supervisory guidance Log privileged activity; monitor service accounts; retain system logs Not set
MAS SAFR (July 2026) Voluntary reference model Tamper-evident log of every governance decision Not set
IMDA MGF for Agentic AI v1.5 Voluntary guidance Log behaviour; choose fields by objective; keep immutable Not set
PDPA s25 Law Stop retaining, or de-identify, personal data once purpose ends As short as purpose allows

Three readings matter for a Singapore business. First, the EU dates moved. Regulation (EU) 2026/1744 defers Chapter III Sections 1 to 3, which hold Article 12 as well as Articles 19 and 26. EU-regulated financial institutions keep the logs with their financial-services records. The legal duty touches a Singapore firm only if it places high-risk systems on the EU market; the schema matters regardless.

Second, MAS has not made SAFR a rule. The 5 August 2026 parliamentary question asked whether MAS would move from SAFR towards mandatory supervisory requirements. The reply made no such commitment. It called SAFR "a potential approach to how agent actions are authorised, how human oversight is activated, and what is recorded at the point of every consequential decision", and said MAS would keep its supervisory expectations under review. Do not tell your board that supervisors have asked for this schema.

What already applies is narrower. The Technology Risk Management Guidelines are supervisory guidance, not statute. Paragraph 9.2.2 asks institutions to "manage and monitor the use of system and service accounts for suspicious or unauthorised activities." An agent acting through a service account falls inside that sentence. The paragraph says nothing about a decision record, a rule ID or an approver. That part is design.

Third, the tracing standard does not cover the audit questions. The OpenTelemetry GenAI semantic conventions were still at Development status in August 2026. They name agents, models, tools and conversations. We found no attribute for an approver or a policy-rule outcome. Adopt them for tracing, then add questions four and five yourself.

A worked investigation: the refund nobody approved

In the made-up case below, an API-only log lets the team confirm that a refund call happened and little else, so it blames the model. A decision record shows the actual causes directly: a policy change that shipped without review, and a tool output the agent misread. Neither is fixed by a prompt rewrite.

Illustrative example: an online retailer runs a customer-service agent that can issue refunds. Refunds up to SGD 500 auto-execute; anything larger needs a supervisor at the confirm step. On a Monday, finance spots a SGD 4,000 refund with no approval attached.

The API log shows one line: 14:02, service account svc-cs-agent, POST /refunds, 200 OK. The team suspects the model "hallucinated", plans a prompt rewrite and pauses the agent for a week.

The decision record tells a different story. The request came from an authenticated customer chat (who asked). The agent ran policy version 12 (which build). Its input refs point to the order record and a courier lookup; the courier tool output, stored by hash, said "delivered", while the agent's own summary said "not delivered" (what it saw). Rule refund.auto_cap fired with outcome Auto-Execute, because version 12 had raised the cap from SGD 500 to SGD 5,000 (what allowed it). No approval was requested, correctly under that rule. The order was refunded in full and is reversible within the payment provider's window. The change history shows version 12 went live two days earlier, with no reviewer.

The SGD 4,000 refund sat between the old cap and the new one

SGD per refund, one scale. Illustrative, not measured data.

01,0002,0003,0004,0005,000tenfold, in policy version 12Old cap: SGD 500above this, a supervisor approvesThe refund: SGD 4,000no approval requestedv12 cap: SGD 5,000live two days, no reviewer
02,0003,000tenfold, v12The refund: SGD 4,000no approval requestedv12 cap: SGD 5,000live two days, no reviewerOld cap: SGD 500above this, a supervisor approves
Illustrative case, not measured data.

Two findings, neither of them "the model went rogue": an unreviewed tenfold cap change, and a misread tool output. The fixes are change control on policy thresholds and a rule that delivery status comes from the tool, never from the agent's paraphrase.

Myth or fact

What the API log suggested, and what the record showed

Five readings of the refund case above. Decide for yourself, then reveal the answer.

The model hallucinated the refund.

Myth

Rule refund.auto_cap fired with outcome Auto-Execute under policy version 12, which had raised the cap from SGD 500 to SGD 5,000. The other cause was a misread tool output: the courier tool said "delivered", the agent's summary said "not delivered".

No approval on a SGD 4,000 refund means the confirm step failed.

Myth

No approval was requested, correctly under that rule. The failure was a tenfold cap change that went live two days earlier with no reviewer.

A prompt rewrite fixes it.

Myth

Neither cause is fixed by a prompt rewrite. The fixes are change control on policy thresholds and a rule that delivery status comes from the tool, never from the agent's paraphrase.

An immutable log would have shown the cause.

Myth

Immutability preserves the gaps too. Immutability is a storage property; usefulness is a schema property.

The agent's reasoning trace explains why it acted.

Partly

Keep it, label it agent-declared, and never let it be the only answer. IMDA warns that chain-of-thought reasoning "may not be a faithful explanation of the agent's actions." What the agent saw should come from the retrieval layer and the tools.

Illustrative case from this post.

Each role takes a different lesson. For the CTO, build the instrumentation before go-live, because retrofitting identifiers into a running system means a migration. For the compliance lead, the record turns "we have logs" into "we can show who approved what, under which rule", the kind of evidence SAFR and IMDA describe, though neither is binding. For the owner, the API-only log cost a week of a paused agent and a fix aimed at the wrong cause.

Interactive check

Can your agent log answer an investigator?

8 checks drawn from the six investigator questions. Tick what is true for your agent today. A design check, not a compliance assessment. Nothing you enter leaves your browser.

0of 8 checks in place

Close these gaps first

    Origin Pi's design check, drawing on IMDA's agentic framework v1.5 and MAS SAFR. None of these eight checks is a legal requirement in itself.

    Where Origin Pi stands

    We build the decision record before the agent, because the agent is the wrong author of its own log. SAFR (MAS, July 2026) aims for the same thing: every action reconstructable "without relying on the agent's own account of what occurred."

    In the agent-ready layer we build, every consequential action passes a policy check and, where the risk warrants it, a confirm step, and each writes its own entry under the action ID. Permissions are bounded per agent, so "who asked" and "on whose authority" are recorded facts rather than inferences. That separation is our design choice; SAFR and IMDA describe the problem, not a product. Cerebrum, the governed record we have in build, treats the decision record as a core primitive, and the pattern carries across many agents in one governed brain.

    It also settles the accountability question IMDA's framework raises: you cannot hold a person accountable for an approval you cannot show they gave.

    Before go-live, pick a plausible failure, hand the log to someone who did not build the agent, and ask for the six answers within an hour. Whatever they cannot answer is your schema backlog.

    Frequently asked questions

    Does the EU AI Act require AI agents to keep logs?
    Only if the agent is part of a high-risk AI system, and not yet. Article 12 requires automatic logging over the system's lifetime, and Articles 19 and 26(6) set at least six months of retention. Regulation (EU) 2026/1744 moved these duties to 2 December 2027 for Annex III systems and 2 August 2028 for Annex I. A generic customer-service agent is usually not high-risk; one that scores credit, prices life or health insurance, or screens job applicants can be.
    How long should AI agent logs be kept?
    No single number fits. For EU high-risk systems, Articles 19 and 26(6) set a six-month floor once they apply (2 December 2027 for Annex III), unless other law such as data protection says otherwise. Singapore's PDPA section 25 requires you to stop retaining personal data, or de-identify it, as soon as it is reasonable to assume no legal or business purpose remains. A workable split: keep the lean decision record for a documented audit window and expire raw prompts much sooner.
    Is the agent's chain-of-thought a valid audit record?
    Treat it as evidence of what the agent claimed, never as proof of why it acted. IMDA's agentic framework, version 1.5 of May 2026, warns that chain-of-thought may not be a faithful explanation of an agent's actions. MAS's SAFR white paper of July 2026 adds that agent-declared traces can be fabricated by a sophisticated injection. Record inputs, the policy decision and the approval from the systems around the agent instead.
    Is MAS SAFR mandatory for Singapore financial institutions?
    No. SAFR, published by MAS with industry on 3 July 2026, describes itself as an industry reference model. On 5 August 2026 MAS told Parliament that SAFR sets out a potential approach and made no commitment to mandatory agent rules. The Technology Risk Management Guidelines already expect privileged-account activity to be logged and reviewed, service-account use to be monitored, and system logs to be retained.
    What is the difference between an AI audit trail and observability tracing?
    Tracing tools record spans for model calls, agents and tools so engineers can debug latency and errors, and they are often sampled. An audit trail records every consequential decision: who asked, what rule allowed it, who approved it and what changed. The OpenTelemetry GenAI conventions, still at Development status in August 2026, define agent and tool attributes, but we found no field for an approver or a policy-rule outcome.

    Next step

    Ready to make your business agent-ready?

    20 minutes on your sector, your systems, and where this applies. No deck, no templates.

    Talk to us →