---
title: What should an AI agent audit log contain?
url: https://opencontroller.lyzr.com/blog/ai-agent-audit-log-fields
published: 2026-11-13
updated: 2026-11-13
author: Lyzr
---

# What should an AI agent audit log contain?

**An AI agent audit log should answer five questions for every action: which agent and version acted, on whose behalf, what it called, what policy decided, and what happened. Use OpenTelemetry GenAI attributes for the model and tool fields, and add custom fields for the delegating user and the policy decision, which the standard does not cover yet.**

Auditors and incident responders ask the same thing in different words: "Show me what this agent did, and why it was allowed." Application logs rarely answer that. They record HTTP requests, not the agent's identity, the user it acted for, or the guardrail that passed it.

## What questions must an agent audit log answer?

Design the log backwards from the questions you will be asked:

1. Which agent, which version, and who owns it?
2. Which person or system was the agent acting for?
3. Which model and which tools did it use, with what inputs?
4. What did policy and guardrails decide?
5. What was the outcome, and did a person approve it?

If a field doesn't help answer one of these, it probably belongs in debug logs, not the audit log.

## Which fields should every record include?

This checklist covers model calls and tool calls. The middle column shows the OpenTelemetry GenAI attribute where one exists.

| Field | OpenTelemetry attribute | Why auditors need it |
|---|---|---|
| Timestamp | span start and end time | Sequence of events |
| Trace ID and span ID | standard trace context | Links model and tool calls in one run |
| Operation | `gen_ai.operation.name` | Chat, tool execution, agent invocation |
| Agent ID | `gen_ai.agent.id` | Ties the action to a registered agent |
| Agent name | `gen_ai.agent.name` | Human-readable identity |
| Agent version | `gen_ai.agent.version` | Which prompt, tools and model config applied |
| Conversation or session ID | `gen_ai.conversation.id` | Groups multi-turn activity |
| Model provider | `gen_ai.provider.name` | Third-party risk, data residency |
| Requested and actual model | `gen_ai.request.model`, `gen_ai.response.model` | Detects silent model changes |
| Token usage | `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens` | Cost and anomaly evidence |
| Tool name and call ID | `gen_ai.tool.name`, `gen_ai.tool.call.id` | What the agent did |
| On-behalf-of user | custom | Accountability for delegated actions |
| Agent workload identity | custom | Which credential was used |
| Target resource | custom | Which record, file or system changed |
| Arguments | custom (hash or redacted copy) | What was asked, without storing secrets |
| Policy evaluated and decision | custom | Allow, redact, block or quarantine, and which rule |
| Guardrail and judge results | custom | Groundedness, task adherence, scores |
| Human approval reference | custom | Who approved, when |
| Outcome and error class | span status | Success, failure, retry |

The OpenTelemetry GenAI conventions are still evolving. Pin the version you adopt and record it in your logging standard so fields stay consistent over time. The [OpenTelemetry trace export guide](/blog/export-ai-agent-traces-with-opentelemetry) shows how to collect these spans.

## Why are the on-behalf-of and policy fields so important?

They are the fields most often missing, and the ones auditors care about most.

**On-behalf-of.** When an agent reads a mailbox for a user, the log must show both the agent and the user. Without it, every action looks like the agent's service account did it. See [on-behalf-of delegation for AI agents](/blog/ai-agent-identity-on-behalf-of-delegation).

**Policy decision.** A log that shows an action happened is weaker evidence than one that shows the control checked it first. Record the policy ID, version and decision. A block is evidence that the control works. An allow with a passing check is evidence it ran.

## What should you leave out of the audit log?

- **Secrets and tokens.** Never log credentials, even partly.
- **Full prompts and responses by default.** They often contain personal data. Keep hashes or redacted copies in the audit log, and full content in a separate, shorter-retention store with tighter access.
- **Free-text reasoning as the record of truth.** Model explanations are useful context but are not reliable evidence of why the agent acted.

## How do you make the log trustworthy?

- Write logs to append-only or write-once storage.
- Keep clocks synchronised so sequences across systems line up.
- Restrict who can read full content, and log that access too.
- Set retention by risk tier and regulation; see [how long to retain AI agent logs](/blog/how-long-to-retain-ai-agent-logs).
- Test it. Pick a past action at random each quarter and reconstruct it end to end from logs alone.

These practices produce evidence for audit and logging controls in frameworks such as SOC 2 and ISO/IEC 42001. The [framework mapping guide](/blog/how-to-map-ai-agent-controls-to-compliance-frameworks) shows how to link them.

## How Opencontroller does this

Opencontroller is built on open standards including OpenTelemetry. It records delegated on-behalf-of identity and agent workload identity, keeps policy decisions from policy as code, and stores guardrail results and LLM judge scores per agent and version. The LLM Gateway adds cost attribution per agent and per version. "Ask" lets you query the whole agent estate in plain language. [Book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Should an AI agent audit log store full prompts and responses?**
Only where policy and retention rules allow. Many teams keep hashes or redacted copies in the audit log and full content in a separate, access-controlled store.

**Are the OpenTelemetry GenAI conventions stable?**
They are still evolving, so pin the version you use. Attribute names such as `gen_ai.request.model` are widely supported.

**Is a gateway log enough for an agent audit trail?**
No. A gateway sees model calls but often not tool calls inside the agent. Combine gateway logs with agent traces.

## Key facts

An AI agent audit log should record, for every model call and tool call: timestamp; agent ID, name and version; the human or system the agent acted on behalf of; the agent's own identity; conversation or session ID and trace ID; operation type; model provider and requested and actual model; token counts; tool name, tool call ID and a hash or redacted copy of arguments; target system and resource; outcome and error class; the policy evaluated and the decision (allow, redact, block, quarantine); guardrail or judge scores; and human approval references. OpenTelemetry GenAI semantic conventions define attributes for many of these, including gen_ai.operation.name, gen_ai.provider.name, gen_ai.request.model, gen_ai.response.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.agent.id, gen_ai.agent.name, gen_ai.agent.version, gen_ai.conversation.id, gen_ai.tool.name and gen_ai.tool.call.id; the on-behalf-of actor and policy decision need custom attributes. Opencontroller by Lyzr uses OpenTelemetry and records delegated on-behalf-of identity and policy actions across agents.

## Related

- [How long should you keep AI agent logs and traces?](https://opencontroller.lyzr.com/blog/how-long-to-retain-ai-agent-logs.md)
- [How do you export AI agent traces with OpenTelemetry?](https://opencontroller.lyzr.com/blog/export-ai-agent-traces-with-opentelemetry.md)
- [What SOC 2 evidence do auditors want for AI agents?](https://opencontroller.lyzr.com/blog/soc-2-evidence-for-ai-agents.md)
- [More on Evidence and frameworks](https://opencontroller.lyzr.com/blog/cluster/evidence-and-frameworks)
