Audit trails and logging of agent actions
The record an agent leaves is the only thing that makes its actions reviewable.

An agent that acts can be asked, afterwards, what it did; the only thing able to answer is the record it left. NIST’s log-management guide fixes the terms: “A log is a record of the events occurring within an organization’s systems and networks. Logs are composed of log entries; each entry contains information related to a specific event that has occurred within a system or network.” (nist-sp800-92.txt, lines 334–336). An audit trail is that record used as evidence — entries written when events happened, ordered in time, attributable to an actor.
What an audit record has to contain
The content of an entry is a settled question. NIST SP 800-53’s control AU-3 requires an audit record to establish “What type of event occurred”, “When the event occurred”, “Where the event occurred”, “Source of the event”, “Outcome of the event”, and the “Identity of any individuals, subjects, or objects/entities associated with the event” (nist-sp800-53r5.txt, lines 5319–5329). OWASP states the same requirement more plainly: “The application logs must record "when, where, who and what" for each event.” (owasp-logging-cheatsheet.txt, line 305). Mapped onto an agent, “what” is the proposed action — the tool and its arguments — and “who” is both the requesting principal and the component that emitted the call. The field most easily dropped is the one a review most needs: the decision that let the call run. A record that shows the action but not the policy behind it explains what happened, not why.
Two records, not one
Operational logs and audit logs answer different questions, and OWASP warns against merging them: “Process monitoring, audit, and transaction logs/trails etc. are usually collected for different purposes than security event logging, and this often means they should be kept separate.” (owasp-logging-cheatsheet.txt, line 235). The distinction blurs easily for an agent, because the trace that makes it work — the conversation and step history — looks like a log and is stored like one, yet a trace kept for replay is not an audit trail: it may be sampled or truncated, or stored where the agent’s own tools can edit it. The audit record is kept for a different reader, out of the agent’s reach.
Protecting the record
An audit trail that its subject can rewrite is not evidence. NIST requires systems to “Protect audit information and audit logging tools from unauthorized access, modification, and deletion” (nist-sp800-53r5.txt, line 5769), and one control enhancement buys integrity with media that cannot be overwritten, directing teams to “Write audit trails to hardware-enforced, write-once media” (line 5790). CISA and the NSA reach the same conclusion for AI systems, recommending an immutable store “to ensure that every object, especially log data, is immutable and cannot be changed” (cisa-deploying-ai-systems-securely.txt, lines 507–509). Integrity is also testable: NIST defines log file integrity checking as “Comparing the current message digest for a log file to the original message digest to determine if the log file has been modified.” (nist-sp800-92.txt, lines 2752–2753). The failure modes are concrete — an attacker can “prevent writes in order to cover their tracks” (owasp-logging-cheatsheet.txt, line 463) — and an entry is attributable only if its timestamp is, which is why NIST requires timestamps that “use Coordinated Universal Time” (nist-sp800-53r5.txt, lines 5734–5735).
What must not go in the log
A log is a copy of whatever passed through the system, and not everything should be copied. OWASP lists data that “should usually not be recorded directly in the logs, but instead should be removed, masked, sanitized, hashed, or encrypted” — “Authentication passwords” and “Encryption keys and other primary secrets” among it (owasp-logging-cheatsheet.txt, lines 346, 351, 353). For an agent the exposure is wider, because prompts, tool outputs and retrieved documents all flow into the same record; the secrets-and-data-exposure sheet owns what must not enter it. The reverse risk lives inside the logs too: OWASP requires teams to “Perform sanitization on all event data to prevent log injection attacks e.g. carriage return (CR), line feed (LF) and delimiter characters” (line 377).
Review, retention and disposal
A record nobody reads changes nothing. NIST requires organizations to “Review and analyze system audit records” for unusual activity, and to retain them long enough “to provide support for after-the-fact investigations of incidents” (nist-sp800-53r5.txt, lines 5520, 5975). The volume has to be tuned: “It is important not to log too much, or too little.” (owasp-logging-cheatsheet.txt, line 237). For AI systems the guidance tilts towards more — CISA and the NSA advise teams to “Collect logs to cover inputs, outputs, intermediate states, and errors; automate alerts and triggers” (cisa-deploying-ai-systems-securely.txt, lines 398–399) — and the OWASP Top 10 for LLM Applications is honest about the ceiling, since logging and monitoring “will not prevent Excessive Agency, but can limit the level of damage caused” (owasp-llm-top10-2025.txt, line 1108).
Level and prerequisites. L4 — the advanced, risk-and-operations level: the reader must design the record a production agent leaves and reason about its integrity, not merely enable a logger. Prerequisites: the L1 sheet on how a model generates text, the L2 sheets on serving and structured output, and the L3 sheet on deterministic workflows; within this layer, execution policy and human approval define the decisions this sheet records.
Where to go next
- Automation & AI — the macro-area this sheet belongs to.
- Operations and risk — the node this sheet sits in.
References
- NIST — Guide to Computer Security Log Management (SP 800-92) — the definition of a log and a log entry, the log-management process, and log file integrity checking.
- OWASP — Logging Cheat Sheet — what an entry must record, the separation of audit and security logs, data to exclude, log injection, and the attacks on logs.
- NIST — Security and Privacy Controls for Information Systems and Organizations (SP 800-53 Rev. 5) — the audit (AU) control family: event logging, record content, review, protection, timestamps and retention.
- CISA and NSA — Deploying AI Systems Securely — AI-specific logging, monitoring and immutable log storage.
- OWASP — Top 10 for LLM Applications 2025 — logging and monitoring as a damage-limiter for excessive agency.