# How Long to Keep AI Agent Run Logs and Which Fields

Keep change records until the later of your next audit close and six months after the entry, the floor in Articles 19 and 26(6) of the EU AI Act. That floor binds only high-risk systems, and since the AI Omnibus only from 2 Dec 2027 (Annex III) or 2 Aug 2028 (Annex I). Keep tool arguments access-controlled and prompts briefly.

## What the law fixes, and when it applies

One regime gives a number. Article 12 of the EU AI Act says high-risk AI systems "shall technically allow for the automatic recording of events (logs) over the lifetime of the system". Article 19 tells providers to keep those logs for "a period appropriate to the intended purpose" of "at least six months", and Article 26(6) gives deployers the same floor for logs under their control. Both add "unless provided otherwise in applicable Union or national law, in particular in Union law on the protection of personal data". If a prompt holds personal data, data-protection law can therefore require a shorter period than six months.

The floor applies only to high-risk systems. The Annex III entry nearest to security operations is point 2, which covers AI systems "intended to be used as safety components in the management and operation of critical digital infrastructure, road traffic, or in the supply of water, gas, heating or electricity". An agent that comments on tickets or proposes a firewall setting for a person to approve is not described by that wording; an agent that operates safety functions of such infrastructure may be. Ask counsel if you are near that line.

The dates are set by the AI Omnibus Regulation, which the European Commission records as in force since 27 Jul 2026. It amended Article 113(c) so that Chapter III, which holds Articles 12, 19 and 26, applies from 2 Dec 2027 to high-risk systems under Annex III and from 2 Aug 2028 to those under Annex I. A log written before 2 Dec 2027 is therefore not yet covered by the six-month floor, even for an Annex III system.

## Which fields to keep, store elsewhere or drop

OpenTelemetry's [GenAI agent span conventions](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-agent-spans.md) (status Development) mark message and instruction fields as Opt-In and say of them: "This attribute is likely to contain sensitive information including user/PII data." Tool arguments and results carry the weaker warning "may contain sensitive information". The conventions also define `_ref` variants that hold an absolute URI to external storage and advise against embedding credentials such as signed URLs in that URI. That gives three places a field can go.

OpenTelemetry semantic-conventions-genai, agent spans and execute-tool pages, read 19 Nov 2026. The Where column is this site's recommendation, not the convention's.

| Field | OpenTelemetry level | Where it goes | Why |
|---|---|---|---|
| gen_ai.agent.name, id, version | Conditionally required or recommended | In the span, kept longest | Places the run on a specific build of the agent. The name must have low cardinality; do not put a run ID there |
| gen_ai.request.model | Conditionally required if available | In the span, kept longest | Ties a result to a model version; the convention says to populate it only when the agent uses a single model |
| gen_ai.tool.name, tool.call.id, operation.name | Required (name, operation); conditionally required (call ID) | In the span, kept longest | Order and identity of every action |
| gen_ai.tool.call.arguments and result | Opt-In | Evidence store with access control; the span keeps a reference | Often the evidence itself: the host named, the rule text. Can hold credentials |
| gen_ai.input.messages, output.messages, system_instructions | Opt-In, with _ref variants | External store, short period; or drop | Likely to contain PII. Needed for debugging and evals, rarely for audit |
| gen_ai.tool.definitions | Opt-In | Version control, not the trace | Large; the tool list belongs in the agent's versioned configuration |

A span does not prove an outcome. The [logging and evidence](/agent-harness/logging-and-evidence/) page covers the transcript-versus-outcome record and the full list of fields per action; this page covers how long each class lasts.

## A change record, filled in

SonicWall published advisory SNWLID-2026-0014 for CVE-2026-19868 (SSLVPN SAML bypass, CVSS 7.1, added to CISA's KEV catalog on 6 Nov 2026) and updated its workaround on 9 Nov 2026: where SAML is in use and the firewall cannot be upgraded, disable or delete every active LDAP, RADIUS and TACACS+ server. Suppose a patch-triage agent proposes the first step of that workaround, disabling one RADIUS server, a person approves, and the agent makes the change. This is the record the run leaves. Firewall name, run ID, agent name and times are constructed; the field names are OpenTelemetry's.

Record class: change record (one per write the agent made)
span name:                     execute_tool firewall_set_auth_server
gen_ai.operation.name:         execute_tool
gen_ai.agent.name:             patch-triage-agent
gen_ai.agent.version:          9 Nov 2026.2
gen_ai.request.model:          (the exact model ID string your provider reports)
gen_ai.tool.name:              firewall_set_auth_server
gen_ai.tool.call.id:           (identifier received from the model or provider)
gen_ai.tool.call.arguments:    stored in the evidence store, reference only here
gen_ai.tool.call.result:       stored in the evidence store, reference only here
run_id / parent_run_id:        run-20261109-0413 / none
finding:                       CVE-2026-19868, firewall fw-edge-02 (example name)
approval:                      requested 9 Nov 2026 10:12 UTC; approved by the named network owner 10:19 UTC
proposed change:               disable RADIUS server radius-corp (first of the three server types in SonicWall's workaround)
read-back after change:        9 Nov 2026 10:21 UTC, RADIUS server radius-corp shows disabled; SAML SSLVPN login tested by a person
cost of run:                   tokens in / out, total
retain_until:                  9 May 2027

The `retain_until` value is worked out, not guessed. Take a team that is audited once a year with fieldwork for 2026 closing on 31 Mar 2027 (an assumption for this example). The change was made on 9 Nov 2026, before the Act's floor applies, but the team's policy takes the later of audit close and six months so that one rule serves both before and after 2 Dec 2027. Six months from 9 Nov 2026 is 9 May 2027, later than 31 Mar 2027, so `retain_until` is 9 May 2027. A team with no six-month rule and the same audit would keep the record to 31 Mar 2027.

## Retention by record class

The periods are an example policy for one team. Only the six-month floor is from a source; the rest is a choice to be written into the [task spec](/guides/writing-a-task-spec-for-a-security-agent/).

| Record class | Example period | Basis |
|---|---|---|
| Change record: spans plus the reference to arguments and read-back | Later of next audit close and 6 months after the entry | Audit need; 6 months from Articles 19 and 26(6) once the system is high-risk and the dates above apply |
| Tool arguments and results in the evidence store | Same as the change record, then delete | They are the evidence the change record points to |
| Prompts, replies and system instructions | 90 days (a team choice, not a rule) | Long enough to investigate a failed run and refresh test sets; short because of PII |
| Run records with no write (read-only investigations) | Same as prompts | No change to defend later |
| Agent version and model ID table | As long as any retained record refers to it | A retired model must still be identifiable, see [choosing a model](/guides/choosing-a-model-for-a-security-agent/) |

Two cases where the usual answer is wrong. If a change record is later questioned in a dispute or an incident review, a legal hold overrides the table. And if the same logs feed [measuring an agent after it ships](/guides/measuring-an-agent-after-it-ships/), the acceptance and revert counts must outlive the prompts they were computed from, so store the counts, not the transcripts.

## Who owns the hold and the deletion job

A retention date does nothing until a named role deletes on it and another can stop that deletion. This split is this site's recommendation, not a requirement of the Act.

- The owner of the agent, usually the security operations lead, sets `retain_until` for each record class and signs the retention table.
- The owner of the log store runs the deletion job. It deletes only records past `retain_until` that carry no hold tag, and it writes one line per run (record class, count, date) that is itself kept.
- Legal or counsel is the only role that adds or lifts a hold. A hold is a tag on the record IDs, and the deletion job reads the tag before every run, so a hold placed at 17:00 stops a job that starts at 18:00.

## Sources

- [EU AI Act Article 12, Record-keeping (AI Act Explorer)](https://artificialintelligenceact.eu/article/12/), read 19 Nov 2026
- [EU AI Act Article 19, Automatically generated logs (AI Act Explorer)](https://artificialintelligenceact.eu/article/19/), read 19 Nov 2026
- [EU AI Act Article 26(6), Obligations of deployers of high-risk AI systems (AI Act Explorer)](https://artificialintelligenceact.eu/article/26/), read 19 Nov 2026
- [EU AI Act Annex III, point 2 (AI Act Explorer)](https://artificialintelligenceact.eu/annex/3/), read 19 Nov 2026
- [AI Act Explorer, Implementation timeline](https://artificialintelligenceact.eu/implementation-timeline/), read 19 Nov 2026
- [OpenTelemetry, GenAI agent and framework spans](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-agent-spans.md), read 19 Nov 2026
- [OpenTelemetry, Execute tool span](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/execute-tool.md), read 19 Nov 2026
- [OpenTelemetry, Execute tool span report](https://github.com/open-telemetry/semantic-conventions-genai/blob/main/reference/reports/execute-tool-span.md), read 19 Nov 2026
- [SonicWall PSIRT advisory SNWLID-2026-0014](https://psirt.global.sonicwall.com/vuln-detail/SNWLID-2026-0014), read 19 Nov 2026
- [CISA KEV catalog entry for CVE-2026-19868](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-19868), read 19 Nov 2026
- [European Commission, AI Omnibus enters into force (Annex III from 2 Dec 2027, Annex I from 2 Aug 2028)](https://digital-strategy.ec.europa.eu/en/news/ai-omnibus-enters-force), read 19 Nov 2026
- [AI Act Explorer, Article 113 as amended (Chapter III application dates)](https://artificialintelligenceact.eu/article/113/), read 19 Nov 2026

Last reviewed 19 Nov 2026

Canonical: https://agenticaiincybersecurity.com/guides/agent-run-logs-what-to-keep/
