---
id: TIE-AGT-025
title: "Attributable audit trail for agent actions"
url: https://exchange.trevonix.com/patterns/tie-agt-025-attributable-audit-trail-for-agent-actions
version: "1.0"
maturity: documented
collection: "Agent identity"
category: "Audit and evidence"
last_reviewed: 2026-11-24
problems: ["Audit evidence for AI governance","Incident investigation","Accountability for AI actions","Regulatory record-keeping","Non-repudiation","Privacy in AI logs"]
standards: ["EU AI Act Article 12 (record-keeping) and Article 26 (deployer obligations)","OpenTelemetry semantic conventions for generative AI (development status)","W3C Trace Context","ISO/IEC 27001:2022 Annex A 8.15 (logging)","NIST SP 800-92 (log management)"]
recipes: {ping: documented, okta: documented, entra: documented, saviynt: documented, misc: documented}
license: CC BY 4.0
publisher: Trevonix
---

# Attributable audit trail for agent actions (TIE-AGT-025)

**Intent:** Record every consequential agent action so that anyone investigating can answer who asked, which agent acted, through which chain, under which policy and approval, with which credential, on what, and with what result, from logs that cannot be quietly altered.

Agent activity is spread across identity provider sign-ins, gateway calls, policy decisions, approvals and the agent's own traces. This pattern defines one record shape, one correlation ID carried end to end, where each part is logged, how logs are protected, and what not to keep.

## In short

- Every consequential action produces records that answer **who, which agent, through which chain, why, with what, on what, and what happened**.
- One **correlation ID** travels from the user's request through the agent, gateway, policy decision, approval and resource, so the records can be **joined**.
- Logs go to a store the agents and their operators **cannot alter**, are kept as long as rules require, and **minimise personal and prompt content**.

## Problem

When an agent does something unexpected, the first questions are simple: who asked for it, which agent did it, was it allowed, did anyone approve it, and what exactly changed? In most estates the answers sit in different places with nothing to join them: the identity provider knows the agent signed in, the API knows a service account called it, the agent framework has a trace with a different ID, and the approval lives in a chat message.

Teams then over-correct by logging every prompt and response in full, creating a sensitive data store that is itself a risk and still lacks the decision context investigators need.

> **Why this matters:** For high-risk AI systems, the EU AI Act requires automatic logging, and deployers must keep the logs under their control. Even where the Act does not apply, auditors increasingly expect agent actions to be attributable to a person and an accountable owner.

## Use it when

- Agents take actions with business, financial or security impact.
- You need to investigate incidents involving agents, or answer customer disputes.
- Regulators, auditors or customers ask what your agents did and on whose authority.

## Avoid it, or add more, when

- Purely conversational assistants with no tools and no access to personal data may need only standard application logs.

## Forces

- **Completeness against privacy.** Full prompts and outputs help investigations and create a store of personal and confidential data.
- **Consistency against heterogeneity.** Each product logs in its own format and with its own IDs.
- **Retention against cost.** Rules may require months or years of logs.
- **Integrity against operations.** Operators need access to logs but must not be able to change them.

## Solution

Define one canonical **action record** and make every enforcement point emit it, or emit something that maps to it. Generate a correlation ID at the start of each user request or task and propagate it (as W3C trace context) through the agent, every tool call, the gateway, the PDP, the approval service and the resource. Include identity facts from the token (subject, agent, actor chain, client, token ID) rather than what the agent claims. Send records to a central store with write-once retention, outside the administrative control of the agent's operators, and join them with identity provider sign-in and audit logs on agent ID and time.

![Diagram. A request starts with correlation ID c-91f2. Records flow from five sources into a central, write-once log store: identity provider sign-in and audit logs (agent ID, blueprint, user, token ID), the agent's OpenTelemetry trace (invoke_agent and execute_tool spans, model and tool names), the ](https://exchange.trevonix.com/img/TIE-AGT-025/tie-agt-025-solution.png)

*One correlation ID joins identity, gateway, decision, approval, resource and trace records into a single story.*

*Action record*

| Field | Source | Example |
| --- | --- | --- |
| correlation_id, trace_id | Generated at request start; propagated | c-91f2; W3C traceparent |
| time (UTC, synchronised) | Every emitter | 2026-11-24T10:41:07.311Z |
| subject (person or autonomous agent) | Token `sub` | user-4821 |
| agent and blueprint or version | Token client or actor; registry | agt-refunds-prod v3 |
| actor chain | Token `act` (nested) | agt-refunds-prod via agt-orchestrator |
| token ID and audience | Token `jti`, `aud` | 7c1e..., refunds API |
| action, target, key arguments | Gateway or tool layer | refund.issue, order 99213, 340 GBP |
| decision, reason, policy version | PDP | permit with approval, over limit, v12 |
| approval reference and approver | Approval service | ap-5531, sponsor user-1177 |
| outcome | Resource | executed, refund ID R-88120 |
| model and tool names | Agent trace | model name and version; tool name |

How it works

1. **Agree the record.** Use the action record above as the common schema; map product logs to it.
2. **Propagate context.** Generate the correlation ID at the edge; pass trace context in headers on every hop, including MCP and agent-to-agent calls.
3. **Take identity from tokens.** Gateways and resources log subject, agent, actor chain and token ID from the validated token, never from text the agent sends.
4. **Log decisions with reasons.** PDP and approval records include reason codes and policy versions.
5. **Instrument agents.** Emit OpenTelemetry spans for agent runs and tool executions using the generative AI conventions, with content capture off by default.
6. **Protect and retain.** Send to an append-only store under separate administrative control; set retention per regulation and contract.
7. **Minimise.** Record arguments needed to understand the action; hash or redact personal data and secrets; keep full prompts only where a documented purpose needs them, with restricted access.

> **Rehearse an investigation:** Test your audit trail like a control: pick a random agent action each month and reconstruct its full story from the logs within an agreed time. If you cannot, fix the gap before an incident finds it for you.

## Design rules

1. **One record shape, many emitters.**
2. **One correlation ID end to end.**
3. **Identity from validated tokens, not agent claims.**
4. **Every decision has a reason and a policy version.**
5. **Logs are append-only and outside the operators' control.**
6. **Clocks are synchronised;** times are UTC.
7. **Minimise content;** never log secrets or tokens.
8. **Rehearse reconstruction regularly.**

## Anti-patterns

| Anti-pattern | What goes wrong |
| --- | --- |
| Each component logs with its own IDs | Records cannot be joined; investigations take days |
| Logging the agent's description of what it did | A manipulated agent writes a false story |
| Full prompts and responses kept indefinitely | A sensitive data store with no purpose limitation |
| Agent team can delete or edit logs | Evidence is not trustworthy |
| Logging access tokens | Logs become a credential store |
| Only the identity provider's sign-in logs | You know the agent signed in, not what it did |

## Benefits

- Fast, defensible investigations of agent incidents.
- Evidence of authorisation, approval and outcome for auditors and disputes.
- A foundation for monitoring and detection of agent misuse.
- Privacy-conscious logging that limits sensitive data.

## Costs and risks

- Instrumentation of gateways, PDP, approval service and agents.
- Central log storage with long retention.
- Schema mapping and maintenance as products change.
- Access control and review of who can read agent logs.

## Recipes

### Ping Identity

*Maturity: Documented; last verified 2026-11.*

Identity, gateway and decision records with correlation IDs. Written from Ping documentation and Trevonix lab practice.

Configure (Ping)

1. Export Advanced Identity Cloud or PingOne audit logs for agent token issuance and exchange to your SIEM.
2. Add PingGateway's MCP audit filter (or route audit) on agent-facing routes, and log the validated token's subject, client and act chain with the correlation ID.
3. Enable decision logging in PingOne Authorize or PingAuthorize with reason codes and policy versions.

### Okta

*Maturity: Documented; last verified 2026-11.*

Agent and token exchange events streamed to the SIEM and joined with gateway records. Written from Okta documentation.

Configure (Okta)

1. Use Okta's System Log for AI agent events, token exchanges and resource connection use, filtered by the agent's client ID.
2. Stream System Log events to your SIEM with Okta's log streaming.
3. Where agents call resources through Okta's Agent Gateway, include its audit of tool calls in the joined trail.

### Microsoft Entra

*Maturity: Documented; last verified 2026-11.*

Agent sign-ins filterable by agent type; agentType and blueprintId in audit logs; joined with gateway records in Sentinel. Written from Microsoft documentation.

Configure (Entra)

1. In **Entra ID > Monitoring & health > Sign-in logs**, filter **Is Agent** = Yes and by **Agent type** (agent identity, blueprint or agent user) to see agent sign-ins; the Reports Reader role is enough to view them.
2. In audit logs, identify agent activity by the `agentType` property on `initiatedBy`, `performedBy` and `targetResources`, and correlate agent identities to their blueprint with `blueprintId`.
3. Stream sign-in, audit and Microsoft Graph activity logs to Log Analytics or Microsoft Sentinel and join them with gateway and decision records on agent object ID, time and correlation ID.

### Saviynt

*Maturity: Documented; last verified 2026-11.*

Agent changes and blocked actions as audit events. Written from Saviynt's published material.

Saviynt records a timeline of each agent's changes and generates audit events when Agent Access Gateway blocks actions at runtime. Forward both to the central store and join them with gateway and identity provider records.

### OpenTelemetry generative AI conventions

*Maturity: Documented; last verified 2026-11.*

Vendor-neutral tracing of agent runs and tool calls.

Instrument agent frameworks with OpenTelemetry using the generative AI semantic conventions (`invoke_agent` and `execute_tool` spans, `gen_ai.*` attributes), keep message content capture off by default, and export to the same backend as gateway traces so spans share trace IDs.

## Verification tests

| Test | Expected result |
| --- | --- |
| Pick a recent agent action | Full story reconstructed from logs by correlation ID |
| Agent claims it acted for a different user in its own output | Logs show the token's subject, not the claim |
| Operator attempts to delete a log entry | Not permitted; attempt logged |
| Search logs for access tokens or secrets | None found |
| Clock skew between components | Within tolerance; alert if exceeded |
| Retention period | Records older than the minimum are present |

## Maturity and verification

**Documented.** Trevonix's lab builds log decisions, approvals and outcomes under shared correlation IDs (2026); this pattern generalises that approach from standards and vendor documentation and has not yet been tested end to end across products.

> **Conventions still evolving:** OpenTelemetry's generative AI conventions moved to a dedicated repository in June 2026 and remain in development status; attribute names may change. Pin the version your instrumentation emits.

## Frequently asked questions

**Should we log full prompts and responses?**

Not by default. Keep the action, decision and identity facts. Capture prompt and response content only for a documented purpose (for example quality review or a specific investigation), with restricted access and shorter retention.

**How long should agent logs be kept?**

At least as long as your regulators and contracts require. For high-risk AI systems under the EU AI Act, deployers must keep automatically generated logs for at least six months, unless other law requires longer; financial services rules often require several years.

**Are identity provider sign-in logs enough?**

They tell you an agent authenticated and when; they do not tell you what it did with the access. You need gateway, decision and resource records joined by correlation ID.

## References

- [Microsoft Learn: Sign-in and audit logs for agents](https://learn.microsoft.com/vi-vn/entra/agent-id/sign-in-audit-logs-agents)
- [OpenTelemetry: Semantic conventions for GenAI agent and framework spans](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-agent-spans/)
- [W3C Trace Context](https://www.w3.org/TR/trace-context/)
- [EU AI Act, Article 12: Record-keeping](https://artificialintelligenceact.eu/article/12/)
- [PingGateway: MCP security gateway](https://docs.pingidentity.com/pinggateway/latest/mcp/)

---

Source: https://exchange.trevonix.com/patterns/tie-agt-025-attributable-audit-trail-for-agent-actions. © Trevonix. Licensed CC BY 4.0. Provided as is, without warranty; see https://exchange.trevonix.com/about#disclaimer.
