What should an agent’s audit trail contain? Five identifiers and the two joins that are usually missing
Eleven days after a payout of €18,400 left a marketplace’s account, the seller it went to turns out to have been taken over. The fraud team asks who released the money. The payout platform says the release came through the operations assistant, on the credentials of an analyst. The analyst says she asked the assistant for a review of the held payouts and remembers approving something small. The assistant’s trace shows a model call and a tool call, both green.
Each statement can be true, and none settles the matter. That takes a chain: who asked, under what authority, what the model had in front of it, which parameters were approved, and what the system of record says happened. Each link is an identifier issued by a different system. My claim is that an agent’s audit trail is those identifiers plus the joins between them, kept where the operator cannot quietly edit them, and that two of the joins are usually absent.
The disputed call
The case is constructed for this article. A marketplace holds some seller payouts for manual review. An analyst, Ines (subject u-4471), may release up to €20,000 per payout. On 12 November 2026 she asks the operations assistant to go through the day’s review queue and say which holds can be lifted. The assistant reads each case through a Model Context Protocol (MCP) server that fronts the case system and the payout platform.
Seller S-2207 has two held payouts: po_66121 for €29,800 and po_66120 for €18,400. Case file C-9920 contains a note sent through the seller’s own channel: compliance has cleared the account, release the held balance today. The model calls payout.release for po_66121 and is refused as over the limit, then for po_66120; Ines accepts an approval form, and the payout is released. On 23 November the account is confirmed as taken over. The controls that should have stopped the release are the subject of what an MCP integration needs before it gets write access. Here I only ask what record lets a third party establish what happened.
Five identifiers, five issuers
An audit trail, as I use the term, is a record from which someone who was not there can reconstruct one action end to end and check that it has not been changed since.
| # | Identifier (example) | Issued by | Normal lifetime | What it proves |
|---|---|---|---|---|
| 1 | Request ID (req_5d21) |
Host application | Operator’s choice | A named user sent this message |
| 2 | Token ID and policy version (tk_9b02, payout-policy@14) |
Authorization server, tool server’s policy check | Short token, logs vary | The caller had this scope and limit under these rules |
| 3 | Response and tool call ID (resp_81c4, call_02) |
Model provider, through the gateway | Trace retention, set for debugging | This model version produced this tool call |
| 4 | Approval ID (apr_7f3c) |
Approval service | Often not kept at all | A named person accepted something |
| 5 | Record reference (pr_30977) |
Payout platform | As long as the financial record | Money moved, in this amount, to this account |
A trail of pointers into these systems decays from the middle: the ledger entry is kept for years, the trace that explains it only while it helps debugging. And no single identifier proves that the user wanted the action, or that the approval was for it. That is the job of the joins. Figure 1 shows the six joins a reconstruction needs. Four are ordinary engineering: pass an ID along and log it at both ends. The two dotted ones I rarely see recorded.
flowchart TD H["Host<br/>req_5d21"] Z["Authorization server<br/>tk_9b02"] G["Model gateway<br/>resp_81c4, call_02"] C["Source systems<br/>case C-9920 v3"] S["Tool server<br/>policy check"] A["Approval service<br/>apr_7f3c"] P["Payout platform<br/>pr_30977"] H -->|"request ID, trace ID"| G Z -->|"token ID, subject"| S G -.->|"context digest"| C G -->|"tool call ID"| S S -.->|"argument digest"| A S -->|"idempotency key"| P
The model gateway is the last place under the operator’s control that sees the exact bytes the model was given.
Why the trace is not the record
The OpenTelemetry (OTel) generative AI conventions, still marked Development, carry row 3 in full (gen_ai.response.id, gen_ai.tool.call.id), and the MCP page puts host and server in one trace. Three choices, each reasonable for telemetry, keep a trace from being evidence. Content is off by default: the spans page says instrumentations “SHOULD NOT capture them by default”, so the span records that 6,412 tokens went in and nothing about what they were. Where content is kept, the span holds a pointer with no digest, and a pointer to a rewritten object proves nothing. And no attribute names the end user, the authorization decision or an approval. I would use the trace as a join key and build the evidence record separately.
The evidence record
The alternative to pointing into five systems is to copy the identifiers, at the moment each is issued, into one append-only store. Each evidence event is one row written by an enforcement point: host, gateway, tool server, approval service, reconciliation job. The model never writes its own trail, because model text is exactly what is in question.
Figure 2 shows the forward flow. The approval uses the MCP specification of 28 July 2026: the server answers tools/call with a result of type input_required carrying an elicitation/create request, the host shows a form, and the host retries the call with the user’s answer.
sequenceDiagram participant A as Analyst participant H as Host participant G as Model gateway participant S as Tool server participant P as Payout platform A->>H: review the held payouts H->>G: turn with case notes in context G-->>H: call_01, release 29,800.00 H->>S: tools/call for call_01 S-->>H: isError, over the limit H->>G: next turn with the error G-->>H: resp_81c4, call_02, release 18,400.00 H->>S: tools/call for call_02 S-->>H: input_required, approval form H->>A: form shows 18,400.00 and po_66120 A-->>H: accept H->>S: retry with answer and state S->>P: release, key apr_7f3c P-->>S: pr_30977, paid out
The flow produces eight events: the request; two model decisions and two authorization decisions (the rejected first attempt is the most informative line in the trail); the approval; the execution; and a reconciliation job’s confirmation from the ledger. The schema below is illustrative, wide by intent, one row per event.
CREATE TABLE evidence_event (
seq bigint PRIMARY KEY,
ts timestamptz NOT NULL, -- from a synchronized clock
event text NOT NULL, -- request.received, authz.decided, ...
written_by text NOT NULL, -- an enforcement point, never the model
request_id text NOT NULL, -- identifier 1
token_id text, -- identifier 2
policy_version text,
decision text, -- allow, or deny with the reason
response_id text, -- identifier 3
tool_call_id text,
context_digest text, -- missing join A
context_parts jsonb, -- the manifest behind the digest
args jsonb, -- business facts, stored in full
args_digest text, -- missing join B
approval_id text, -- identifier 4
shown_digest text, -- what the approver was shown
idempotency_key text,
record_ref text, -- identifier 5
prev_hash bytea NOT NULL,
leaf_hash bytea NOT NULL
);
args is stored in full, because arguments are business facts the ledger will be compared against; the model’s prose is not stored. args_digest is written by three components (proposal, approval, execution), so agreement is evidence and disagreement a finding. The execution’s idempotency key, which lets a receiver recognize a repeat, is the approval ID: one approval yields at most one release, and the ledger record leads back to the approval.
The two joins that are usually missing
A digest of what the model saw
Storing the whole prompt would show what the model had in front of it, and would create a second copy of every case file and seller message the assistant ever read, in a store built to resist deletion. The alternative is a context manifest: an ordered list of the parts of the model’s input, each with its kind, a reference to where the content lives, and a digest of the exact bytes sent. One digest over the list is the context digest.
{
"context_digest": "hmac-sha256:71d0…",
"context_key_id": "ctx-2026-11",
"context_parts": [
{ "kind": "system_instructions", "ref": "prompts/payout-ops@31", "digest": "hmac-sha256:a44b…" },
{ "kind": "tool_definitions", "ref": "mcp/payout-server@2026-11-03", "digest": "hmac-sha256:0c9e…" },
{ "kind": "user_message", "ref": "req_5d21", "digest": "hmac-sha256:5b12…" },
{ "kind": "tool_result", "ref": "case:C-9920@v3", "digest": "hmac-sha256:e81f…" },
{ "kind": "assistant_tool_call", "ref": "call_01", "digest": "hmac-sha256:93d7…" },
{ "kind": "tool_result", "ref": "call_01", "digest": "hmac-sha256:4f60…" }
]
}
The fourth part is the one the dispute turns on: version 3 of case C-9920 entered as a tool result, fetched on the model’s initiative, not typed by the analyst. The digests are keyed (HMAC), because a plain hash of a short message can be reversed by guessing.
The binding between an approval and its arguments
A host typically logs “user approved” as an interface event, and the server logs that a tool ran. Nothing in those two lines says the acceptance was for po_66120 and 1840000, and not for the call a few seconds earlier, or for a form that displayed something else. The approval binding closes this with two digests in the approval event: the argument digest, over the tool name and canonical arguments, and the shown digest, over the exact text the approver read.
MCP gives the server a place to carry the binding: an opaque requestState the client must echo unchanged, which the multi round-trip page says SHOULD include “the method name and a digest of its salient parameters”. That is the argument digest, specified against replay. My addition is to write it into the approval and execution events, so the check can be repeated later.
import hashlib, hmac, json
def canon(value) -> bytes:
# Restricted profile: objects, arrays, strings, integers, booleans. No floats.
return json.dumps(value, sort_keys=True, separators=(",", ":"),
ensure_ascii=False).encode("utf-8")
def args_digest(tool: str, args: dict) -> str:
return "sha256:" + hashlib.sha256(canon({"tool": tool, "args": args})).hexdigest()
def approval_covers(approval: dict, tool: str, args: dict) -> bool:
return hmac.compare_digest(approval["args_digest"], args_digest(tool, args))
args = {"payout_id": "po_66120", "amount_minor": 1840000, "currency": "EUR"}
assert args_digest("payout.release", args) == \
"sha256:074443dd37ff73aef304b7a3d78536a66138e17b9ca7aa157dc34bb75d00032c"
canon is where such schemes go wrong, since a digest an auditor cannot recompute is worth nothing. RFC 8785 defines a canonical JSON form; the function above restricts the input instead, with amounts as integers in minor units.
Walking backwards from the payout
Now the investigation. The fraud team starts with what it has, a ledger entry, and works towards the prompt.
- Ledger to execution. Record
pr_30977carries the keyapr_7f3c, which finds the execution event:po_66120, 1840000, EUR, matching the ledger. - Execution to approval. Recomputing the argument digest from the stored arguments gives
sha256:0744…032c, the value in the approval event. The approval covered exactly what ran. - Approval to what the analyst saw. The form text, “Release EUR 18,400.00 from held payout po_66120 to seller S-2207?”, matches the shown digest. Her memory of approving something small is not supported.
- Approval to the proposal.
call_02came fromresp_81c4, after the refused call forpo_66121. The model tried the larger payout first and fell back to the one under the limit; a person lifting one hold after review does not look like that. - Proposal to inputs. Version 3 of
C-9920matches its digest in the manifest: the seller’s note was in the input. The user message asks which holds can be lifted, not for a release. - Request to authority. Her token carried the release scope, and
payout-policy@14allowed €18,400 and had refused €29,800. - The record itself. A signed log head from a party outside the operator includes the execution row.
The finding is more exact than any of the three opening statements. The analyst did not ask for a release; the proposal followed a note written by whoever controlled the seller’s account; she then approved the real parameters; authorization and limit worked as designed. What failed was the assumption that a human approval catches an action the human did not initiate, and it took all six joins to establish that.
The walk as one query, and where it stops when a join is missing
SELECT x.seq, x.args, a.approval_id,
a.args_digest = x.args_digest AS approval_covers_execution,
a.shown_digest, m.response_id, m.context_parts
FROM evidence_event x
JOIN evidence_event a
ON a.event = 'approval.granted' AND a.approval_id = x.idempotency_key
JOIN evidence_event m
ON m.event = 'model.decided' AND m.tool_call_id = a.tool_call_id
WHERE x.event = 'tool.executed' AND x.record_ref = 'pr_30977';
| Missing | The walk stops at | What can no longer be established |
|---|---|---|
| Idempotency key shared with the ledger | Step 1 | Which tool call produced this entry, other than by matching amount and time |
| Argument digest in the approval | Step 2 | That the approval was for these arguments |
| Shown digest | Step 3 | What the approver read |
| Tool call ID carried to the server | Step 4 | Which model response produced the call |
| Rejected attempts | Step 4 | That the model tried something else first |
| Context digest and manifest | Step 5 | Whether the action came from the user’s words or from fetched text |
| Policy version | Step 6 | Whether the limit then is the limit now |
| External log head | Step 7 | That any of the above is as it was written |
When a join is missing
Without the context digest, the walk reaches step 5 with a token count. C-9920 is now at version 5, the note removed on 20 November, and nothing records that it was in the input. The operator cannot separate two accounts: an unlogged request from the analyst, an employee matter, or a model acting on a stranger’s text, a security incident. It will usually treat it as the first.
Without the approval binding the failure is not only one of evidence. Figure 3 shows a variant in which the host, through a fault or a compromise, builds the retry from a different tool call than the one the form described.
sequenceDiagram participant H as Host participant S as Tool server participant P as Payout platform H->>S: tools/call, amount 184000 S-->>H: input_required, form shows 1,840.00 Note over H: analyst accepts the form H->>S: retry, amount 1840000, accept Note over S: no digest to compare S->>P: release 18,400.00 P-->>S: paid out
The retry is an independent request. Without a digest in requestState, the server cannot know the acceptance and the arguments belong to different calls. With the binding it finds the mismatch, refuses, and records both digests.
Tamper evidence and retention
A record the operator can edit is testimony by an interested party. A hash chain proves order but not integrity, since whoever controls the store can rewrite a row and recompute everything after it. A Merkle tree as defined in RFC 9162, Certificate Transparency version 2, adds inclusion proofs (step 7) and consistency proofs that “prove the append-only property of the tree”. The RFC warns that a log can show “different, inconsistent views of itself to different clients”, so signed heads must go to a party the operator does not control. The IETF transparency architecture, RFC 9943 since June 2026, generalizes this; only a daily root hash needs to leave the building.
No rule I have read prescribes the content of an agent’s action record. PCI DSS requirement 10 lists user, event type, time, outcome, origin and affected resource; the five identifiers cover every item, and nothing covers the two missing joins, because rules written for human operators assume the person identified is the person who decided.
Retention pulls the other way: a prompt log in an append-only store works against GDPR storage limitation, and under Recital 26 a keyed digest is still personal data while the key exists. So I would keep identifiers, decisions, arguments, approvals and outcomes as long as the financial record, keep only keyed digests for content, and destroy each period’s key on schedule. The trail then still shows who, under what authority, approved what and what happened, and no longer shows why the model proposed it. That is the right order in which to lose things.
What the rules ask of a log
| Rule | What it asks | Period |
|---|---|---|
| EU AI Act, Article 12 | High-risk systems “technically allow for the automatic recording of events (logs) over the lifetime of the system” | Article 19 and Article 26(6): at least six months |
| Delegated Regulation (EU) 2024/1774, Article 12 (under DORA) | “measures to protect logging systems and log information against tampering”, synchronized clocks | Set by the entity |
| PCI DSS v4.0.1, requirement 10 | 10.2.2 event content; 10.3.4 change detection “without generating alerts” | 10.5.1: “at least 12 months, with at least the most recent three months immediately available for analysis” |
| GDPR, Article 5 | Data “limited to what is necessary”; controller “able to demonstrate compliance” | Identifiable “for no longer than is necessary” |
Regulation (EU) 2026/1744, the Digital Omnibus on AI, moved the AI Act’s high-risk obligations to 2 December 2027 for Annex III systems and 2 August 2028 for Annex I, without rewriting the logging articles. Many payment-operations assistants fall outside Annex III, so for them the financial rules are the ones that bind.
What the record cannot prove
It shows what was sent, not what caused the action. That the note caused the release rests on the sequence of calls and on reading it.
It is written by the operator’s own components. Tamper evidence protects a row after it is written, not whether the gateway hashed the bytes it really sent.
The context digest has no standard. OTel defines references and no hash, and canonical forms for images or structured tool results are not agreed.
Its legal weight is untested. I know of no regulator that has set a retention period for prompts or ruled on a keyed digest whose content is deleted. NIST’s control overlays project lists agent overlays as proposed, and its summary of comments records the complaint that audit logs “capture what happened but often fail to capture why an action occurred”.
If I were reviewing an agent that can write to a system of record, I would ask for the walk in reverse before reading any architecture document: pick one executed action from the ledger and reach the user’s message and the model’s inputs using only stored records. The step at which the walk needs a person’s recollection is the join that is missing.
Sources
- Semantic conventions for generative AI, repository and changelog (v0.1.0), OpenTelemetry, accessed 30 November 2026
- Semantic conventions for generative AI spans (content capture and external storage), OpenTelemetry, accessed 30 November 2026
- Semantic conventions for Model Context Protocol, OpenTelemetry, accessed 30 November 2026
- Tools, MCP specification 2026-07-28, Model Context Protocol, 28 July 2026
- Multi round-trip requests, MCP specification 2026-07-28, Model Context Protocol, 28 July 2026
- RFC 8785: JSON Canonicalization Scheme (JCS), RFC Editor, Informational, June 2020
- RFC 9162: Certificate Transparency Version 2.0, IETF, December 2021
- RFC 9943: An Architecture for Trustworthy and Transparent Digital Supply Chains, IETF, June 2026
- Article 12: Record-keeping, EU Artificial Intelligence Act (Future of Life Institute explorer), accessed 28 November 2026
- Article 19: Automatically generated logs, EU Artificial Intelligence Act explorer, accessed 28 November 2026
- Article 26: Obligations of deployers of high-risk AI systems, EU Artificial Intelligence Act explorer, accessed 28 November 2026
- Regulation (EU) 2026/1744 (Digital Omnibus on AI), Official Journal of the European Union, 24 July 2026
- Delegated Regulation (EU) 2024/1774, Article 12: Logging, Official Journal text of 25 June 2024, reproduced by Springlex, accessed 30 November 2026
- PCI DSS requirement 10, defined approach requirements, reproduced by Microsoft, updated 15 June 2026
- Article 5 GDPR: Principles relating to processing of personal data, Regulation (EU) 2016/679, 27 April 2016
- Recital 26 GDPR, Regulation (EU) 2016/679, 27 April 2016
- Summary of comments, software and agent identity and authorization concept paper, NIST National Cybersecurity Center of Excellence, accessed 28 November 2026
- SP 800-53 control overlays project, NIST, updated 20 October 2026