Your Agent Changed Production. Where Is the Decision Record?
Agent traces can show what executed without proving why a consequential action was allowed. Build durable decision records that bind evidence, policy, authorization, tool activity, side-effect receipts, and reconciliation into an audit-grade history for production AI agents.
On this page
A production agent can leave behind a beautiful trace and still leave you unable to answer the most important question after an incident:
Why was this action allowed?
Imagine an operations agent changes a customer's account limit. The trace is healthy. You can see the model call, retrieval step, policy tool, database tool, latency, token usage, and final response. But three days later the customer disputes the change and the incident team asks:
- Which evidence was considered authoritative?
- Which version of policy permitted the action?
- What authority was the agent operating under?
- Was human approval required, and if so, who approved it?
- Did the external system actually apply the change?
- Was the result later reconciled against the system of record?
If answering those questions requires an engineer to reconstruct a story from spans, you have observability, but you do not yet have a durable decision record.
That distinction matters as agents move from answering questions to changing real systems.
Observability records execution. Accountability records decisions.
Modern agent tracing is excellent at showing execution chronology. For example, the OpenAI Agents SDK traces model generations, function calls, handoffs, guardrails, and other workflow events. OpenTelemetry similarly gives us structured primitives such as spans, attributes, logs, and events for instrumenting distributed systems.
Those are exactly the artifacts I want when I am debugging latency, a broken tool call, an unexpected handoff, or a failed run.
But a consequential action needs another artifact with a different contract.
A trace asks:
What executed, and in what order?
A decision record asks:
What action was proposed, what evidence and policy justified it, under whose authority did it proceed, and what effect was ultimately verified?
The two should link to each other. They should not be treated as the same thing.
This is also consistent with the direction of broader AI risk-management guidance. NIST's AI RMF separates governance, mapping, measurement, and management, and emphasizes documented accountability structures and systematic documentation. That does not prescribe a specific agent ledger implementation, but it is a useful design signal: accountability has to survive longer than a model's context window.
The unit of audit is the consequential action
Do not create an audit record for every token or every internal thought-like step.
Create one around actions with meaningful external consequences:
- changing permissions;
- sending money or issuing a refund;
- altering customer data;
- publishing content;
- deleting or creating infrastructure;
- sending an external communication;
- accepting or rejecting a request under a business rule;
- escalating to a human;
- executing an irreversible workflow step.
Ordinary reasoning and low-risk internal operations can remain in traces.
For a consequential action, however, I want a record that still makes sense months later without replaying the entire conversation.
A useful rule is:
If the action can create a support ticket, financial loss, security incident, legal dispute, or manual rollback, it deserves a decision ID.
What should a decision record prove?
I design the record around six questions.
1. What was being attempted?
Capture a stable action type and a normalized intent. Avoid relying on free-form prose alone.
For example:
action_type = "customer.credit_limit.update"target = "customer:cus_8421"requested_effect = { "limit": 25000 }2. What evidence supported the decision?
Do not store only a mutable URL or a query string. Record immutable or versioned references where possible:
- document IDs and versions;
- database row/version identifiers;
- retrieval snapshot ID;
- tool result hash;
- policy input snapshot;
- checkpoint hash;
- timestamp or effective date.
The goal is not to duplicate every source into the audit log. It is to preserve enough provenance to recover the evidence that was actually available at decision time.
3. Which policy allowed, denied, or escalated it?
Record the exact policy version and structured result.
policy_id = "credit-limit-policy"policy_version = "2026-10-03.4"decision = "allow"reason_codes = ["ACCOUNT_AGE_OK", "RISK_SCORE_IN_RANGE"]Reason codes are more durable than a paragraph generated after the action. They can be queried, counted, regression-tested, and mapped back to executable policy.
4. Who or what had authority to act?
Agent identity is not enough.
Record the authorization boundary:
- service principal or workload identity;
- delegated user/account;
- role or capability;
- scope;
- expiration;
- human approval reference when required.
That lets an investigator distinguish "the agent asked for this" from "the system was authorized to do this."
5. What was actually executed?
Capture the operation identity and tool contract:
- operation ID;
- idempotency key where relevant;
- tool name/version;
- tool schema version;
- normalized input hash;
- external request/receipt identifier;
- execution status.
This is especially important for retries. A task can have multiple attempts, and an attempt can involve one or more operations. Reusing a single identifier for all three makes incident reconstruction unnecessarily ambiguous.
6. What effect was verified?
A successful HTTP response is not always proof that the intended business effect happened.
The record should eventually carry a reconciliation outcome:
requested_effect = "refund 120.00 USD"execution_result = "accepted"external_receipt = "rfnd_39g..."reconciliation = "observed_in_system_of_record"For ambiguous writes, the audit trail should say unknown until a reconciler proves otherwise.
That is much stronger than turning a timeout into a fictional failure or success.
Architecture: put the recorder on the action boundary
The most reliable place to emit a decision record is the same seam where you already decide whether a consequential action may proceed.

There are two records worth separating:
- Decision-time record — what was proposed, evidence used, policy outcome, authorization, and whether execution was permitted.
- Outcome update/event — what the external system reported and what reconciliation later proved.
I prefer appending events instead of mutating the original decision row. The original record should represent what was known at that moment. Later evidence should extend the history rather than rewrite it.
A TypeScript model that survives an incident review
Here is a deliberately explicit model.
type RiskTier = "low" | "medium" | "high" | "critical";type PolicyOutcome = "allow" | "deny" | "escalate";type EffectStatus = | "not_executed" | "accepted" | "rejected" | "unknown" | "reconciled_applied" | "reconciled_not_applied";interface EvidenceRef { kind: "document" | "database" | "tool_result" | "checkpoint" | "retrieval"; ref: string; version?: string; sha256?: string; observedAt: string;}interface AuthorizationRef { actor: string; role: string; scope: string[]; delegatedBy?: string; expiresAt?: string; approvalId?: string;}interface PolicyDecision { policyId: string; policyVersion: string; outcome: PolicyOutcome; reasonCodes: string[];}interface ActionReceipt { operationId: string; idempotencyKey?: string; tool: string; toolVersion: string; schemaVersion: string; inputHash: string; providerReceiptId?: string; status: EffectStatus;}interface DecisionRecord { schemaVersion: "1"; decisionId: string; taskId: string; runId: string; attemptId: string; traceId?: string; recordedAt: string; environment: "development" | "staging" | "production"; releaseId: string; riskTier: RiskTier; agentId: string; actionType: string; targetRef: string; requestedEffect: Record<string, unknown>; evidence: EvidenceRef[]; policy: PolicyDecision; authorization: AuthorizationRef; model: { provider: string; model: string; configurationHash: string; promptVersion: string; }; stateHash?: string; receipt?: ActionReceipt; // Structured, reviewable explanation of the application decision. // This is not hidden chain-of-thought. explanation: { summary: string; reasonCodes: string[]; uncertainty?: string[]; };}The comment on explanation is intentional.
Do not turn an audit requirement into a requirement to persist private chain-of-thought.
For production accountability, I want externally checkable artifacts: evidence references, rule identifiers, structured reason codes, approval IDs, action receipts, and a concise decision summary. Those are more useful than asking a model to narrate an unverifiable internal monologue.
Capture facts, not stories
A common failure mode is saving a natural-language explanation and assuming that explanation proves causality.
It does not.
A model can generate a plausible explanation after the fact. The safer pattern is to bind the explanation to structured artifacts that can be checked independently.
Instead of:
{ "reason": "The customer met the requirements."}store something closer to:
{ "policy": { "id": "refund-policy", "version": "17", "outcome": "allow", "reasonCodes": ["ORDER_FOUND", "WINDOW_VALID", "AMOUNT_WITHIN_LIMIT"] }, "evidence": [ { "ref": "order:8132", "version": "42" }, { "ref": "policy-input:9d41", "sha256": "..." } ], "approvalId": null}Now the explanation can be tested against the artifacts.
This also makes analytics possible. You can answer questions such as:
- Which policy reasons generate the most high-risk actions?
- Which actions lack immutable evidence references?
- How often do escalations execute without an approval ID?
- Which release introduced a jump in
UNKNOWN_SIDE_EFFECToutcomes?
Decision records, traces, evals, and replay are different layers
I think of the production evidence stack like this:
| Artifact | Primary question | Typical consumer |
|---|---|---|
| Trace | What executed and when? | Engineer / operator |
| Trajectory eval | Was the execution path acceptable? | Eval / quality system |
| Decision record | Why was this consequential action permitted, under what evidence and authority, and what effect was verified? | Incident reviewer / security / governance / support |
| Counterfactual replay | Which component change makes the failure disappear? | Incident / reliability engineer |
This is why I would not replace tracing with decision records.
Tracing remains essential. OpenAI's Agents SDK, for example, can record model generations, function calls, handoffs, and guardrails. OpenTelemetry gives us interoperable conventions for structured spans and events.
A decision record should simply carry correlation IDs back into that telemetry:
decision_id -> trace_id -> span_idWhen the audit artifact tells you *which* action is disputed, the trace gives you the execution detail around it.
I explored the execution-path side separately in trajectory evaluation and the causal-debugging side in counterfactual replay.
Retries make identity design non-negotiable
Suppose the agent tries to issue a refund and the client times out.
A naive system might create this timeline:
task_123 refund attempt timeout refund attempt successThat is not enough.
You need to know whether the second attempt was the same external operation, a new external operation, or merely a status check.
Keep these identities distinct:
task_id— user/business objective;run_id— one orchestrated execution;attempt_id— one reasoning/execution attempt;decision_id— one consequential authorization decision;operation_id— one external side-effect operation.
The resulting history might look like:
task_id = task_123run_id = run_88attempt_id = attempt_1decision_id = decision_Aoperation_id = refund_op_9001status = unknownattempt_id = attempt_2decision_id = decision_Boperation_id = refund_status_check_9001status = reconciled_appliedThat distinction prevents the audit layer from accidentally blessing duplicate writes.
For recovery design, see clean retry forks and side-effect reconciliation.
The action receipt is as important as the authorization
A decision record that says "allowed" is incomplete if the system later cannot prove what happened.
I want an executor to return a typed receipt.
type ExecutionReceipt = { operationId: string; providerRequestId?: string; acceptedAt?: string; effectStatus: "applied" | "not_applied" | "unknown"; responseHash?: string;};async function executeAuditedAction( record: DecisionRecord, execute: () => Promise<ExecutionReceipt>, append: (event: AuditEvent) => Promise<void>,) { await append({ type: "decision_recorded", decisionId: record.decisionId, at: new Date().toISOString(), payload: record, }); if (record.policy.outcome !== "allow") { return; } const receipt = await execute(); await append({ type: "execution_receipt_recorded", decisionId: record.decisionId, at: new Date().toISOString(), payload: receipt, });}This small example is not crash-atomic: a process can fail after the remote effect but before execution_receipt_recorded is appended. Persist an execution intent with the decision in a transaction, dispatch from an outbox, and reconcile unknown operation IDs if the receipt is missing. Authorization must be checked at the trusted executor's effect boundary, not inferred solely from a previously appended allow decision.
If effectStatus is unknown, a separate reconciliation worker should query the system of record and append what it learns.
That produces an honest sequence:
DECISION_ALLOWEDWRITE_SENTCLIENT_TIMEOUTEFFECT_UNKNOWNRECONCILIATION_STARTEDEFFECT_CONFIRMED_APPLIEDHonest unknowns are a feature.
A fabricated success or fabricated failure is much harder to recover from.
Tamper evidence without magical thinking
An append-only table is better than an editable row, but "append-only" is not automatically synonymous with "tamper-proof."
A useful baseline is to make modifications detectable.
For example, canonicalize each audit event, hash it, and include the previous event's digest.
import { createHash } from "node:crypto";function canonicalJson(value: unknown): string { if (Array.isArray(value)) { return `[${value.map(canonicalJson).join(",")}]`; } if (value && typeof value === "object") { const obj = value as Record<string, unknown>; return `{${Object.keys(obj) .sort() .map((key) => `${JSON.stringify(key)}:${canonicalJson(obj[key])}`) .join(",")}}`; } const serialized = JSON.stringify(value); if (serialized === undefined || (typeof value === "number" && !Number.isFinite(value))) { throw new TypeError("Audit payload must be finite JSON data"); } return serialized;}function sha256(value: string): string { return createHash("sha256").update(value).digest("hex");}type LedgerEnvelope<T> = { sequence: number; previousHash: string; payload: T; hash: string;};function seal<T>( sequence: number, previousHash: string, payload: T,): LedgerEnvelope<T> { const material = canonicalJson({ sequence, previousHash, payload }); return { sequence, previousHash, payload, hash: sha256(material), };}This lets a verifier detect many forms of modification or reordering.
But there is an important security caveat:
A hash chain by itself does not prove an attacker could not rewrite the whole history and recompute every hash.
For stronger integrity guarantees, combine techniques such as:
- protected signing keys;
- digital signatures over digests;
- write-once or immutable storage controls;
- service/account separation between application writers and audit administrators;
- external checkpoints or anchors;
- independent retention and backup policies;
- monitored integrity verification.
AWS CloudTrail's log-integrity design is a useful systems analogy: it hashes log files, groups them into digest files, digitally signs digests, and chains digest information so modification or deletion can be detected during validation. The lesson is not "copy CloudTrail's implementation." The lesson is that integrity comes from a system of hashes, signatures, key protection, storage controls, and verification—not from a single sha256() call.
Verify the ledger independently
The verifier should not be the same code path that writes the record.
Here is a compact Python example for chain verification. The JavaScript and Python samples are not a shared canonicalization standard: number formatting, unsupported values, and string escaping can produce different bytes. A production cross-language ledger must choose one tested, versioned canonical JSON format (for example, RFC 8785/JCS), reject invalid data, and use shared byte-level fixtures before signing or validating hashes. These snippets demonstrate chaining only on a compatible restricted JSON subset.
from __future__ import annotationsfrom dataclasses import dataclassfrom hashlib import sha256import jsonfrom typing import Anydef canonical(value: Any) -> str: return json.dumps( value, sort_keys=True, separators=(",", ":"), ensure_ascii=False, allow_nan=False, )def digest(sequence: int, previous_hash: str, payload: dict[str, Any]) -> str: material = canonical({ "sequence": sequence, "previousHash": previous_hash, "payload": payload, }) return sha256(material.encode("utf-8")).hexdigest()@dataclass(frozen=True)class LedgerEntry: sequence: int previous_hash: str payload: dict[str, Any] hash: strdef verify(entries: list[LedgerEntry]) -> None: expected_previous = "GENESIS" for expected_sequence, entry in enumerate(entries, start=1): if entry.sequence != expected_sequence: raise ValueError(f"sequence gap at {expected_sequence}") if entry.previous_hash != expected_previous: raise ValueError(f"broken chain at {entry.sequence}") expected_hash = digest( entry.sequence, entry.previous_hash, entry.payload, ) if entry.hash != expected_hash: raise ValueError(f"content mismatch at {entry.sequence}") expected_previous = entry.hashIn a real system I would also verify signatures/checkpoints, authorization on the writer, storage immutability controls, retention policy, and gaps between the business event stream and the audit ledger.
Your audit log is a security boundary
Audit data is valuable precisely because it contains high-context evidence about production actions. That also makes it sensitive.
OWASP's logging guidance explicitly warns against directly logging secrets and sensitive values such as access tokens, passwords, encryption keys, connection strings, and certain personal data.
An agent system creates extra opportunities to get this wrong because prompts and tool payloads can contain enormous amounts of data.
Do not respond by dumping every prompt, retrieved chunk, credential, and tool response into a permanent ledger.
Prefer references and minimization:
BADraw_customer_record = {...everything...}raw_access_token = "eyJ..."full_prompt = "..."BETTERcustomer_snapshot_ref = "snapshot:cus_8421:v17"policy_input_hash = "sha256:..."retrieval_bundle_id = "ret_0192"credential_scope = ["refund:create"]Then enforce:
- encryption at rest and in transit;
- RBAC for audit readers;
- separation of duties;
- retention schedules;
- redaction/tokenization before write;
- deletion strategy for data that is legally erasable while preserving non-sensitive integrity metadata where appropriate;
- alerts on unusual audit-log reads or integrity failures.
Auditability should not create a second data breach waiting to happen.
An investigation should start with one ID
A mature incident workflow should not begin with "search every trace around 14:00."
It should begin with a stable decision_id.

From that ID the investigator should be able to fetch:
- the decision record;
- linked execution trace;
- exact evidence snapshot;
- exact policy version;
- authorization/approval artifact;
- action receipt;
- reconciliation history;
- integrity-verification result.
If the behavior is still unexplained, the same frozen artifacts can feed a safe sandbox replay. That is where counterfactual replay becomes useful: swap one component at a time while the rest of the incident bundle remains fixed.
Once the root cause is understood, promote the minimal failing case into the living evaluation system described in eval-set drift and golden-set maintenance.
The evidence then forms a loop:
production decision -> incident evidence -> attribution -> fix -> regression eval -> deployment gate -> production decisionMetrics I would put on the dashboard
Do not measure auditability only by asking whether an audit table exists.
Measure coverage and evidence quality.
Decision-record coverage
consequential actions with a decision record--------------------------------------------all consequential actionsThis should approach 100% for actions that require the control.
Evidence completeness
How many records have:
- evidence version/hash;
- policy version;
- authorization scope;
- operation ID;
- final reconciliation state?
A record that contains only decision_id and a prose summary should not count as complete.
Orphan side effects
External effects observed without a corresponding decision record.
This is one of the most important alerts in the system.
Unreconciled side effects
Actions stuck in unknown beyond an expected window.
Approval integrity
High-risk actions that require approval but have no valid approval reference—or whose approval was for a different action/input hash.
Policy-version coverage
Actions whose historical policy version can no longer be resolved.
Integrity verification failures
Broken sequence, invalid signature, unexpected mutation, missing checkpoint, or retention gap.
Audit retrieval latency
How long does it take an investigator to reconstruct a consequential decision from a decision_id?
If the data exists but takes two engineers and half a day to assemble, the system is technically logged but operationally weak.
These metrics complement the production reliability controls in agent SLOs and error budgets.
Failure-inject the audit layer
I would test this infrastructure as aggressively as the agent itself.
| Injected failure | Expected control |
|---|---|
| Tool executes but recorder write fails | Fail closed for high-risk action or use a durable transaction/outbox boundary |
| Policy version is missing | Block or escalate consequential action |
| Approval ID belongs to different payload | Reject authorization |
| Action times out after request is sent | Record unknown; reconcile system of record |
| Ledger event is modified | Integrity verifier detects mismatch |
| Ledger event is deleted | Sequence/checkpoint verification detects a gap |
| Retrieval source changes later | Historical evidence ref/version still resolves |
| Retry repeats the same write | Idempotency/operation identity prevents duplicate effect |
| Raw access token appears in audit payload | Redaction validation rejects the record |
| Tool schema changes | Historical schema version remains resolvable |
| Writer loses audit-store access | Alert and apply risk-tier-specific fail-safe policy |
The first row deserves special attention.
For a high-risk action, "we changed production but failed to write the decision record" is not an ordinary logging warning. It may be a control failure.
Architectures commonly solve this with some combination of transactional outbox patterns, durable queues, action gateways, and risk-tier-specific fail-closed behavior. The right mechanism depends on the external system, but the invariant is stable:
Do not silently permit an unaudited high-risk side effect.
What not to put in the audit record
More data is not automatically more defensible.
I would avoid storing by default:
- hidden chain-of-thought;
- access tokens or credentials;
- raw secrets;
- entire customer records when a versioned reference will do;
- every retrieved document when only a small evidence set was material;
- giant unbounded prompts;
- duplicate telemetry already available in traces;
- speculative claims presented as facts.
The audit record should be compact enough to inspect, structured enough to query, and rich enough to recover its evidence.
A rollout path that does not require rebuilding your agent
You can add decision records incrementally.
Phase 1: classify consequential tools
Create a registry:
const actionRisk = { "crm.read": "low", "email.draft": "low", "email.send": "high", "refund.create": "high", "iam.role.grant": "critical",} as const;Phase 2: introduce stable IDs
Standardize task, run, attempt, decision, and operation IDs.
Phase 3: version policy and evidence
Stop relying on "whatever policy is live now" to explain historical actions.
Phase 4: record before execution
Emit the decision artifact before crossing the side-effect boundary.
Phase 5: append receipts and reconciliation
Prove what external effect was observed.
Phase 6: harden storage integrity
Add separation of duties, immutable retention where required, signatures/checkpoints, and independent verification.
Phase 7: build investigation queries
Your support/security interface should answer common questions directly:
show decision decision_8F13show all production actions by policy version 17show high-risk actions without reconciliationshow approvals whose input hash differs from execution input hashshow orphan external receiptsPhase 8: promote incidents into evals
Use disputed decisions as high-value regression cases rather than letting them disappear into postmortems.
Decision records are not a compliance certificate
One final boundary matters.
Adding a decision ledger does not make a system "compliant" with a regulation, security standard, or governance framework by itself. Requirements vary by jurisdiction, system risk, organization, sector, data type, and actual control implementation.
Treat this architecture as engineering infrastructure for accountability, incident response, and evidence quality—not a substitute for legal, security, privacy, or compliance review.
That distinction keeps the design honest.
The production test
For every consequential agent action, I want to be able to ask one question:
Could someone who did not operate this system reconstruct the decision without guessing?
If the answer is yes, the record should show:
- what was requested;
- which evidence was used;
- which policy version evaluated it;
- what authorization allowed it;
- whether human approval was involved;
- exactly which external operation ran;
- what effect was observed;
- whether the evidence chain still verifies.
The trace remains invaluable. It tells me how the workflow moved.
The decision record gives the action a durable identity and evidence boundary.
As agents gain more autonomy, that boundary becomes part of the product—not just part of logging.
If an agent can change the world outside its context window, the evidence for that change needs to outlive the context window too.
References
KEEP READING
Related engineering notes
A Failover Route Is Not a Recovery Path: Proving Independence in AI Infrastructure
Two LLM providers can share the same failure domain. Build an evidence-backed recovery graph that checks cloud, networking, identity, control-plane and capacity dependencies before admitting fallback routes, then test correlated outages without weakening safety.
Read articleAn Eval Platform Sunset Can Erase Your Release Evidence: Build an Evidence-Escrow Migration Gate
When a hosted LLM evaluation platform retires, switching runners is not enough. Preserve the historical evidence, reconstruct grader semantics, validate scoring parity, and enforce a fail-closed release gate that survives the service shutdown.
Read articleWhen the Package Runs Before Your App: Quarantining AI Framework Releases
The 2026 agent-framework PyPI compromise exposed a blind spot in AI build pipelines: Python startup hooks execute before application imports. Design an artifact-quarantine gate, inspect wheels without installing them, separate credentials, and recover from suspected exposure.
Read article