Agentic AI Security
What an AI Audit Trail Should Record: OpenTelemetry GenAI Conventions Without Leaking Prompts
OpenTelemetry's generative AI conventions give an audit trail a vendor-neutral schema for models, agents and tools. What to record by default, what to keep out, and how to store prompt content when an audit needs it.
When an AI system makes a decision that someone later questions, three groups want different things from its logs. Engineers want to see why a request was slow or failed. Security teams want to know which identity called which tool with which data. Auditors and risk owners want to reconstruct what the system did for a given person on a given day. A trail designed around one of these audiences needs deliberate work to serve the others.
OpenTelemetry’s semantic conventions for generative AI are the closest thing the industry has to a shared schema for this record. They describe model calls, agent invocations and tool executions as spans with standard attribute names, so the same trail can feed an observability backend, a security pipeline and an audit archive. They are also explicit about the hardest part of the problem: prompts and responses are sensitive, and they are not recorded by default.
The conventions are usable, and still marked Development
As of version 1.40.0, released in February 2026, every generative AI page in the conventions carries the status “Development.” Two consequences follow for anyone building an audit trail on them.
The names can change. Version 1.37.0 renamed gen_ai.system to gen_ai.provider.name, a breaking change for any dashboard or query that used the old name. The conventions handle this with a transition mechanism: existing instrumentations are expected to keep emitting the version they started with unless the operator opts in to the latest experimental conventions through the OTEL_SEMCONV_STABILITY_OPT_IN environment variable. For an audit trail, I pin the convention version deliberately and change it as a reviewed decision, with queries and retention rules updated in the same change.
The coverage is broad enough to start. The conventions define operation names for chat, text_completion, generate_content, embeddings, retrieval, create_agent, invoke_agent and execute_tool, which covers the model calls, retrieval steps, agent invocations and tool executions an audit needs to reconstruct.
Metadata answers most audit questions without any content
| Audit question | Attribute or span | Requirement level in v1.40.0 |
|---|---|---|
| What kind of operation ran? | gen_ai.operation.name | Required |
| Which provider served it? | gen_ai.provider.name | Required (conditionally required on retrieval spans) |
| Which model was requested, and which answered? | gen_ai.request.model; gen_ai.response.model | Conditionally required if available; Recommended |
| How much did it consume? | gen_ai.usage.input_tokens; gen_ai.usage.output_tokens | Recommended |
| Which conversation did it belong to? | gen_ai.conversation.id | Conditionally required when available |
| Which agent acted? | invoke_agent span; gen_ai.agent.name, gen_ai.agent.id, gen_ai.agent.version | Conditionally required when available or applicable |
| Which tools ran? | execute_tool spans; gen_ai.tool.name, gen_ai.tool.call.id | Recommended; Recommended if available |
| How did the response end? | gen_ai.response.finish_reasons | Recommended |
Source: OpenTelemetry semantic conventions v1.40.0, gen-ai-spans.md and gen-ai-agent-spans.md (requirement levels as stated). Questions are the author's.
Two things the table does not contain are worth adding from outside the conventions. The first is the identity of the user on whose behalf the system acted, which belongs in the trace from the application’s own authentication context. The second is a reference to the data the model was given, such as document or record identifiers, which lets an investigator establish what the system could have disclosed without storing the text itself.
Content is opt-in, and should stay out of the default trail
The conventions define attributes for the content of a model call, gen_ai.input.messages, gen_ai.output.messages and gen_ai.system_instructions, and for the arguments and results of tool calls, gen_ai.tool.call.arguments and gen_ai.tool.call.result. All of them are “Opt-In.” The documentation is direct about why: the message attributes are “likely to contain sensitive information including user/PII data,” and system instructions “may contain sensitive information.” The rule for instrumentations is normative: “OpenTelemetry instrumentations SHOULD NOT capture them by default, but SHOULD provide an option for users to opt in.”
My default follows the conventions. The trail that flows to observability tools carries metadata only. Most operational and security questions, from latency to which tool ran under which identity, can be answered without the words of the prompt.
Some audit duties do require content: a regulated advice process, a dispute over what an assistant told a customer, an investigation of a suspected data exposure. For those, I keep content out of the general telemetry pipeline and write it to a separate store, inside the organization’s boundary, with its own access controls and retention. The conventions describe this pattern as “Store content externally and record references on the spans,” and say it “is recommended in production environments where telemetry volume is a concern or sensitive data needs to be handled securely. Using external storage enables separate access controls.” The trace and span identifiers join the two stores, so an investigator with the right role can move from a span to its content, and an engineer looking at latency never sees it.
Source: Author's design, based on the content-capture options in the OpenTelemetry generative AI conventions v1.40.0.
An audit trail is only as good as its integrity
Telemetry pipelines are built for volume, sampling and fast queries. An audit record has different requirements: it must be complete for the events it covers and resistant to tampering. The OWASP Top 10 for Agentic Applications, published in December 2025, makes the tamper-resistance point in its guidance on human-agent trust, asking organizations to “Keep tamper-proof records of user queries and agent actions for audit and forensics.”
Three design rules close the gap between a telemetry stream and an audit record:
- Exclude audit spans from sampling. Head or tail sampling that drops a fraction of traces is acceptable for latency analysis and unacceptable for an audit trail. Tool executions and agent invocations that the audit depends on should be kept in full.
- Write audit records to append-only storage. Object storage with write-once retention, or a log store with integrity checks, gives the record a property ordinary observability backends do not promise.
- Treat telemetry as a data flow under governance. Attribute names, the convention version and every opt-in setting belong in a reviewed configuration, so that nobody can switch on content capture in production by changing an environment variable on one service.
Built this way, the same instrumentation serves all three audiences: engineers see performance, security sees identities and tools, and auditors can reconstruct what happened, with the content of conversations available only to the people whose role requires it.