kosa8 / Guides / AI agent audit trail

Guide · Audit · Last checked: November 2026

AI agent audit trail: tamper-evident, hash-chained, signed logs

An audit trail for AI agents should answer, for any action, who asked, which agent did it, what it touched, what policy decided and who approved it, in a form a third party can verify without trusting the machine that wrote it. That means four things: the log is written by something outside the agent's sandbox; each entry is chained to the previous one by a hash, so an edit or a gap breaks the chain; the chain is signed, so it cannot be quietly rebuilt; and copies leave the host as they are written, so even an administrator cannot rewrite history unseen.

01Why ordinary logs are not enough for agents

Application logs were built for debugging. They are written by the process being observed, can be edited by anyone with access to the disk, and rarely record what was refused. With an agent, the process being observed is the one that may have been steered. If it can reach its own log, the record is only as trustworthy as the agent.

Agents also blur identity. An action happens because a person started an agent, the agent read a document, and a tool did something. A useful trail records the agent's own identity and the human accountable for it, so "who did this" has an answer that names both. NIST SP 800-53 has controls for exactly these properties: AU-9 (protection of audit information) and AU-10 (non-repudiation).

02What to record

  • Actor: the agent's identity, its accountable human owner, and whether the entry was caused by a person or the agent.
  • Action and target: commands run, files written, sandboxes created, forked, restored or deleted, tools called.
  • Policy decisions: allowed, denied or held, and which rule decided it.
  • Approvals: who approved which exact call, when, and that the approval was used once.
  • Network: every brokered request and every refused connection, with host, port and time. Refusals are often the first sign of a steered agent.
  • Configuration changes: policy installed, keys rotated, approvers changed.
  • Not the secrets. Never the credential, and usually not full prompts or tool output. Digests let you prove what was sent without storing personal data in the log.

What an audit log for AI agents should record goes deeper on fields and retention.

03How hash chains and signatures make a log tamper-evident

In a hash chain, each entry includes a cryptographic hash of the entry before it. Change one entry, delete one or reorder two, and every hash after that point stops matching. A verifier walks the chain from the start and reports the first break.

A hash chain alone has a weakness: whoever can write the file can rebuild the whole chain after an edit. Two additions close that. A keyed MAC (such as HMAC) on each entry means rebuilding needs a key the attacker may not hold. A digital signature (such as Ed25519) over the chain's state, made with a key whose public half you have given to the verifier through another channel, means a rebuilt chain will not carry a valid signature. Transparency logs go one step further with Merkle trees and published tree heads, so outsiders can check that nothing was removed.

None of this stops someone with full control of the host from rewriting and re-signing everything. Forwarding each entry off the host as it is written, to a SIEM or write-once storage that person cannot reach, is what turns "tamper-evident" into "tampering would be noticed".

04Approaches compared

ApproachWho writes itDetects edits or gaps?Survives a compromised host?Fit
Application or agent framework logsThe agent processNoNoDebugging
Tracing and observability spansThe agent process or SDKNoOnly if exported in real timePerformance and behaviour analysis
Central log pipeline or SIEMA shipper on the hostNot on its ownYes, for entries already shippedDetection and search
Write-once (WORM) object storageAny writer with accessPrevents deletion within retentionYesRetention requirements
Hash-chained logA service outside the agentYes, unless the chain is rebuiltNo, unless forwardedLocal integrity checks
Hash chain + keyed MAC + signature, forwardedA service outside the agentYes, and rebuilding needs keysYes, for forwarded entriesEvidence for auditors and incident response
Transparency log (Merkle tree, published heads)A log serviceYes, including removalYes, with outside monitorsPublic or multi-party verification

Most teams combine a signed hash chain written on the host with forwarding to a SIEM and write-once retention. Each covers a failure of the others.

05Which approach fits

  • One developer, one laptop. A host-written, hash-chained log with a verify command is enough to answer "what did the agent do last night".
  • A team with a security function. Add forwarding to your SIEM in a standard format (syslog per RFC 5424, CEF or JSON lines), alerts on refused egress, and a public key held by the security team.
  • Regulated work. Add retention you can show (sealed segments rather than deletions), a minimum retention set by policy, and evidence packages an assessor can verify offline. See the regulated industries checklist.

06One way to do it: kosa8

kosa8 writes every state-changing action, brokered network request, refused connection, tool decision and approval to an audit log kept on the host, outside the agents' microVMs. Entries are hash-chained, HMAC-keyed and signed with Ed25519 by the host service, and marked human or agent. kosa8 audit verify proves nothing was edited or removed; kosa8 audit key prints the public key to hand to your verifier. The log exports as JSON lines or ArcSight CEF and forwards as it is written to syslog (RFC 5424 over TLS, TCP or UDP), Splunk HEC or HTTPS, with cursors that survive outages. kosa8 audit prune seals old entries so the chain still verifies, and a signed policy can set a minimum retention.

terminal
kosa8 audit verify
kosa8 audit export --format cef > audit.cef
kosa8 evidence export --sandbox agent -o evidence.tar
kosa8 evidence verify evidence.tar

An evidence package holds the entries about a sandbox, snapshot, approval or time range with the chain around them, signed; the recipient checks it with no kosa8 service or network, or in a single offline HTML page. The limits: the log is tamper-evident, not tamper-proof, against someone with full control of the host, so forward it. Attribution is verified only for agents that present an agent token. Prompts, tool arguments and results are kept as digests, reads are not logged, and inside an encrypted tunnel the log records host and port, not the request. On hosted kosa8 Cloud, each sandbox is still its own microVM, but the audit log, evidence export and signed policy are features of the software on your own machines and hosts; hosted Cloud sandboxes do not expose them yet. kosa8 Cloud's own organisation audit log can be exported and streamed to a SIEM on the Team and Scale plans.

kosa8 limits what a hijacked agent can reach; it does not detect prompt injection. SOC 2 Type II is in progress; there is no SOC 2 report and no external penetration test yet.

To try a kosa8 sandbox without installing anything or making an account, kosa8.com/try runs code in a fresh sandbox with no outbound network: 15 minutes of run time free per 24 hours, each run up to 60 s.

Try it free See pricing

Try free with no account. Starter is free with no card; plans from $29 a month.

07Questions

What is a tamper-evident audit log?

A log in which any edit, deletion or reordering can be detected. Hash-chaining links each entry to the one before it, so a change breaks every later link, and a signature over the chain stops it being quietly rebuilt.

Why should the agent not write its own audit log?

Because the agent is the thing that may have been steered. If it can reach the log, it can edit or delete the record of what it did. The log must be written by a host service or control plane outside the agent's sandbox.

Is a hash-chained log tamper-proof?

No. Someone with full control of the machine that holds the log and its keys can rewrite and re-sign it. Forward entries off the host as they are written so that rewriting would be noticed.

Should prompts and tool outputs go in the audit log?

Usually as digests, not text. A digest proves what was sent without putting personal or confidential data into a log many people can read. Keep full text, if policy requires it, in a separate, access-controlled store.

What should an auditor be able to check?

That the record is complete and unedited, using only the evidence and a public key received through a separate channel, without trusting the system that produced it.

08Sources and further reading

Last checked: November 2026 · Updated 2026-11-29