
When an autonomous agent — not a human — is the actor, the usual audit fields (username, IP, timestamp) stop being enough.
When an autonomous agent — not a human — is the actor, the usual audit fields (username, IP, timestamp) stop being enough. You still need accountability, reproducibility and non‑repudiation, but the record you store must capture a different set of attributes: model, prompt, tool calls, randomness seeds, code version, and the human who delegated authority. This article lists the fields an ai agent audit log must contain and why each one is necessary for security, compliance and incident response.
Why the usual "user" fields fail for AI agents
Traditional audit logs assume a single human actor behind a session: username, role, IP, user agent string, and an action description. Those are useful, but they miss attributes unique to AI-driven behavior:
- Non-determinism: the same prompt and model config can produce different outputs unless you record the randomness source (seed, rand algorithm, temperature).
- Multi-step chains: agents often call tools, APIs and other agents; you need a causal chain, not just a single action entry.
- Evolving code and models: agents are code + model + runtime. A username doesn't tell you the model checkpoint, container image digest or agent policy used.
- Delegation and approval: an agent may act on behalf of a human or another system; the audit trail must show who authorized the agent and what constraints were in place.
In short: replace the mental model of "a person clicked a button" with "a reproducible computation transformed inputs into outputs and took side effects".
Minimum fields an ai agent audit log must contain
Treat each log entry as a record of a computation and its side effects. At minimum include these fields; if your environment has legal or operational needs, add the relevant items (examples and rationale below).
- record_id — a stable UUID for the audit entry (v4 or v7) and sequence number for the session.
- timestamp — RFC3339 UTC; include monotonic sequence numbers to detect reordering.
- agent_id — logical identifier for the agent instance (not just the human owner).
- agent_version — commit hash, container image digest (e.g., sha256:...), or package version of the agent code.
- model_name & model_digest — model identifier plus a digest or checksum of weights/checkpoint used (or the hosted-model version string).
- runtime_config — model parameters: temperature, top_k/top_p, max_tokens, concurrency limits, and RNG algorithm.
- prompt_template_id & prompt_hash — identifier of the prompt template and a hash of the resolved prompt to avoid storing plaintext if that’s sensitive.
- input_artifacts — references (URIs) to attachments, files, or external data used with checksums.
- actions — ordered list of actions the agent executed, with timestamps, tool identifiers and results (tool name, version, exit code, returned data hash).
- external_calls — each outbound API call with destination, URL host, request hash, response hash, and latency.
- human_principal — who created/approved the agent or request (user id, role, and delegation assertion).
- authorization_context — policy id, allowed scopes, expiration, and the approval token or audit id tying the action to an approval flow.
- outcome — the final state or side effects: files written, commands executed, network changes; include object ids and checksums.
- evidence_hash — a digest of the full record payload used for tamper detection (store separately or sign; see signing below).
- p2p_or_relay — whether the session was peer-to-peer or routed through a relay, and if relay: region and relay id.
- log_integrity — signature metadata (key id, signature algorithm, signature) if you sign logs.
Those fields form the core. Depending on risk and regulation, add a few more: container runtime id, kernel/hypervisor versions, hardware TPM attestation id, certificate serial numbers used for TLS, and any dataset provenance pointers.
Sample audit entry
{
"record_id": "b3f8a1d2-2e8f-4a5b-9a0f-7c6d2f3a1b2c",
"timestamp": "2026-09-11T14:23:05Z",
"session_seq": 42,
"agent_id": "invoice_processor_v2",
"agent_version": "git+sha:8b7f3c2",
"model_name": "gpt-like-3b",
"model_digest": "sha256:0f3a...",
"runtime_config": {"temperature":0.2,"top_p":0.9,"seed":123456789},
"prompt_template_id": "tmpl-invoice-2026-v3",
"prompt_hash": "sha256:abcd...",
"human_principal": {"user_id":"alice@corp.example","approval_id":"apr-2026-019"},
"actions": [
{"t":"2026-09-11T14:23:06Z","tool":"ocr:1.4.0","result_hash":"sha256:1111..."},
{"t":"2026-09-11T14:23:10Z","tool":"bank_api:2.0","endpoint":"payments/verify","response_hash":"sha256:2222..."}
],
"outcome": {"invoices_processed":3,"files_created":["s3://legal/inv-345.pdf"]},
"p2p_or_relay": "relay",
"relay_id": "relay-eu-2",
"evidence_hash": "sha256:ffff...",
"log_integrity": {"sig_kid":"logs-prod-2026","sig":"MEUCIQD..."}
}The example above balances reproducibility (model_digest, prompt_hash, runtime_config) with privacy (prompt stored as a hash). Where you must keep full prompts for legal reasons, restrict access and log every read of the raw prompt separately.
Immutability, signing and retention policies
Auditors and incident responders need to trust that logs haven't been tampered with. Two practical measures:
- Append-only storage with immutable snapshots (object storage with versioning/WORM or write-once filesystems). Keep a separate cold backup in a different region.
- Log signing: compute an evidence_hash of each record and sign it with a dedicated log-signing key. Rotate keys on a schedule and store old public keys for verification. Include signature metadata (key id, algorithm, and expiry) inside the record.
Retention: operational teams commonly keep high-fidelity audit logs online for 90 days for troubleshooting, retain indexed metadata for 1 year for compliance and keep signed immutable archives 1–7 years depending on regulation. Pick retention with legal counsel — the right duration varies by industry: finance and healthcare often range to multiple years.
Privacy, redaction and access controls
Audit logs for agents can contain secrets: API keys, PII, scanned documents, or contractual data. Record what you need for reproducibility and nothing more. Practical controls:
- Redaction policy: store hashes of sensitive inputs (prompt_hash, file_hash) and move plaintext to a protected vault accessible only during an incident and only with an auditable approval flow.
- Least privilege: separate roles for writing logs, reading raw logs, and verifying signatures. Every read of raw logs must itself be audited.
- Consent and mapping: if an agent acts on behalf of a user, keep a clear binding (delegation token, timestamped approval) so you can attribute actions to the human principal for legal and GDPR purposes.
GDPR and other privacy laws treat logs containing personal data as personal data; consult legal counsel about minimisation, purpose limitation and lawful bases for storage. When in doubt, hash or redact and log accesses to the unredacted material.
Why capture model and runtime details (not optional metadata)
Two agent runs with the same prompt can diverge if the model version, temperature, seed or toolchain differs. For incident reconstruction you need:
- Model identifier and digest — the hosted-model version string alone is fragile; a checksum or immutable provider version is better.
- Agent code commit or image digest — a bug introduced in agent code can change behavior more than the prompt.
- Runtime params and seed — to reproduce a specific output or to know whether reproduction is feasible in deterministic mode.
- Tool versions and responses — a tool returning different data changes outcomes; store response hashes and endpoints.
Without those fields, you can't reliably say what the agent did or why it did it.
Operational controls: alerts, sampling and forensic mode
Logging everything at full fidelity can be expensive and risky. Adopt a tiered strategy:
- Default sampling: store full metadata (hashes, model names, action list) for every run, but store full prompts and tool responses only when the run meets a trigger (high-risk action, user complaint, policy violation scores).
- Forensic mode: on alerts (failed policy check, external complaint), capture full raw artifacts into a sealed, access-controlled forensic store and create an immutable signed snapshot for investigators.
- Real-time alerts: build rules for high-risk actions (bank transfers, privileged commands) and generate automated approvals or human-in-the-loop blocks before the side effect happens.
Infrastructure choices: managed relay vs self-hosting
Where you store and transport audit logs matters. For remote-access and agent tooling, Tenvo's managed relay is the default recommendation for most teams: it provides native clients for Windows/macOS/Linux, a browser client in public beta, and a multi-region managed relay with built-in logging and retention tiers (Free $0 / Lite $2.99/mo / Pro $7.99/mo). Using the managed relay offloads certificate renewal, relay scaling, on-call patching and cross-region backups.
Important relay caveat: when a session falls back to a relay, TLS terminates at the relay, so whoever operates the relay is in a position to see the session. That means you must treat relay-hosted logs as potentially visible to the relay operator. If your requirement forbids any third-party infrastructure from accessing session payloads (e.g., particular compliance or data‑residency constraints), self-hosting is the right choice.
Self-host only when you have a written requirement: regulatory mandates that forbid third-party relays, isolated networks with no outbound access, or strict data-residency rules. Self-hosting brings costs: on-call, patching, key custody, certificate renewal, and no automatic multi-region failover unless you build it — the managed relay is cheaper if you count those operational costs.
Audit log access model and incident response
Design who can do what with logs before you need them. Minimum controls:
- Write-only for agents: agent services append to logs but cannot read raw logs.
- Segregated read roles: analysts can read metadata; investigators need a higher privilege to unseal raw artifacts and every unseal is itself logged and signed.
- Automated attestations: when an investigator accesses sealed data, create a signed attestation record linking the investigator's identity, time and purpose.
During an incident, you'll need to reconstruct a causal chain rapidly. If your logs include model_digest, agent_version, prompt_hash, action list and external call hashes, you can usually identify root cause within hours rather than days.
Checklist to get started (practical steps)
- Define a JSON schema for your agent audit record and enforce it at write-time. Include the fields listed earlier.
- Implement evidence_hash and sign each record with a log-signing key; store public keys in a discoverable keyset for auditors.
- Decide retention: 90 days online for full records; 1–7 years archived depending on regulation.
- Create redaction rules: what gets hashed vs stored plaintext and who can access plaintext.
- Add real-time policy checks and automated approvals for high-risk actions.
- Run weekly reproducibility tests: pick a sample entry and verify you can reproduce the agent outcome given recorded model, seed and config.
If you already use remote desktop or agent tooling with Tenvo, review Designing a Compliant Remote Desktop Audit Logging Trail for logging patterns that apply to interactive sessions, and consult ai agent remote desktop: policies, approvals, audit for agent-specific approval flows. For a broader look at how agents fit into remote tooling, see AI and remote desktop: how agents use remote tooling.
Start small: implement the schema, enforce signing, and iterate on redaction. The result is faster incident response, auditable delegation and a defensible compliance posture.
Download Tenvo to test logging and managed relay behavior locally and see how our relay, pricing tiers (Free $0 / Lite $2.99/mo / Pro $7.99/mo) and multi-region relays simplify operations: Download.
Ready to try it yourself?
Free for 30 devices, no credit card. Up and connected in two minutes.