Know a company with years of records? Refer it and earn up to $100K
Engineering checklist

PII Redaction for Agent Traces and LLM Logs: A Checklist

A step-by-step PII redaction checklist for agent traces and LLM logs: secrets, personal data, customer content and internal hosts, with a free CSV template.

Order
Secrets, personal data, customer content, infrastructure, instructions, regulated data
Downloads
Checklist and data card template (CSV)
Standards cited
NIST SP 800-122, 45 CFR 164.514(b)(2), GDPR, OpenTelemetry GenAI
A laptop showing a code diff with a sprint board behind
Short answer

PII redaction for agent traces works in a fixed order: find and revoke secrets first, then remove personal data, customer and third-party content, internal hostnames and paths, and confidential instructions, then regulated data such as health or card data. Use consistent pseudonyms so each run still reads, log every change, and have a person check a sample before any trace leaves the team.

  • Tool results, not prompts, hold most of the sensitive data in an agent trace.
  • A secret found in a log has to be revoked, not only deleted.
  • Pattern rules, entity recognition and model review each miss things; combine them and sample the result.
  • Pseudonymised data is still personal data under GDPR, so redaction lowers risk without ending the legal checks.

Where does sensitive data hide in an agent trace?

An agent copies whatever its tools return into the trace. Hugging Face's guidance puts it plainly: "Trace files can include prompts, tool inputs, command output, local paths, screenshots, secrets, private code, and personal data." (Hugging Face). The OpenTelemetry attribute registry warns that gen_ai.input.messages "is likely to contain sensitive information including user/PII data" and that gen_ai.tool.call.arguments "may contain sensitive information" (OTel registry).

WhereWhat turns upWhy it is missed
System prompt and instructionsInternal policies, escalation rules, confidential instructionsTreated as code, not data
Tool argumentsAccount numbers, email addresses, search terms with namesShort strings in JSON fields
Tool resultsCRM records, ticket threads, log lines, database rows, file contentsLong, nested and different for every tool
ReasoningThe model restating names and numbers it readFree text between steps
Environment and config dumpsAPI keys, tokens, connection stringsAppear once, deep inside a result
Paths, URLs and hostnamesInternal hosts, IP addresses, usernames in file pathsLook harmless one at a time
Screenshots and attachmentsFaces, names and numbers on screenText scanners skip images

What is the right order to redact an agent trace?

Work through the categories in this order on every run. The checklist (CSV) has the same steps with a column for who did each one.

  • 1. Secrets: API keys, tokens, passwords, private keys and connection strings. Then revoke or rotate each one. GitHub's guidance: "It is not sufficient to simply remove the secret from your codebase. The most important remediation step is revoking the secret with the secret's provider." (GitHub Docs)
  • 2. Personal data in prompts, messages, tool arguments, tool results and reasoning. NIST SP 800-122 defines PII to include "any information that can be used to distinguish or trace an individual's identity, such as name, social security number, date and place of birth, mother's maiden name, or biometric records" (NIST SP 800-122).
  • 3. Customer and third-party content: records about your customers' own clients, and data from enrichment or market-data vendors. Remove it, or replace it with consistent placeholders so the workflow still reads.
  • 4. Internal infrastructure: hostnames, IP addresses, internal URLs, file paths and usernames.
  • 5. Confidential instructions: system prompts or tool descriptions that hold policy, pricing logic or anything under an NDA. Replace with a one-line description of what the instruction did.
  • 6. Regulated data: health information to the HIPAA standard (see below), card data removed entirely, and privileged legal material excluded. Card verification codes are sensitive authentication data that "cannot be stored after authorization" (PCI SSC).

How do you pseudonymise traces and keep them readable?

Replace each person, account or customer with the same placeholder everywhere it appears in a run (Customer A, Engineer 2, ACCT-0007), so the agent's steps still make sense and joins between tool results still work. Keep the mapping table separate, access-controlled and out of anything shared.

Two rules from the standards. NIST: "The code, algorithm, or pseudonym should not be derived from other related information" (NIST SP 800-122), so no hashes of email addresses or initials. GDPR defines pseudonymisation as processing "in such a manner that the personal data can no longer be attributed to a specific data subject without the use of additional information, provided that such additional information is kept separately" (GDPR Article 4(5)), and data treated this way "should be considered to be information on an identifiable natural person" (GDPR Recital 26).

Pattern rules, NER or model review: which redaction method works?

None works alone. Each catches what the others miss, so run them in layers and sample the result.

MethodGood atFails onExamples
Pattern and entropy rulesKeys, tokens, emails, phone and card numbers, IP addressesNames, free text, new key formats, secrets split across linesgitleaks, "a tool for detecting secrets like passwords, API keys, and tokens" (gitleaks); TruffleHog, which "classifies over 800 secret types" (TruffleHog)
Named entity recognition (NER)Names, places, organisations in proseNames inside JSON or code, rare names, product names that look like peoplePresidio (Presidio)
Model-assisted reviewContext: confidential instructions, indirect identifiers, customer contentInconsistent across runs; can paraphrase instead of removing; must itself be allowed to see the dataA guardrail such as LiteLLM's PII masking, which can "mask PII (Personally Identifiable Information), PHI (Protected Health Information), and other sensitive data" (LiteLLM)
Human reviewJudgment on what a reader could inferSlow; fatigue on long runsA sampled check after the automated passes

Presidio's own documentation is candid: "because it is using automated detection mechanisms, there is no guarantee that Presidio will find all sensitive information. Consequently, additional systems and protections should be employed." (Presidio). The same holds for every tool in the table.

What goes in a redaction log?

A redaction log lets anyone check what was changed without seeing what was removed, and lets a run be re-processed when a rule improves. Record one row per run and entity type:

FieldExample
run_idrun-2026-10-14-0412
entity_typesecret, person name, email, customer record, hostname, instruction, PHI
locationtool_result step 17; system prompt
methodpattern rule, NER, model review, manual
actionremoved, replaced with placeholder, summarised, run excluded
count3
reviewer and dateEngineer 2, 2026-11-14
follow-upkey revoked at the provider; rule added

How many redacted traces should a person check?

No standard sets a sample size for trace review. A rule that works in practice, in Origin's view: a person reads every step of at least 20 runs or 5% of the set, whichever is larger, chosen at random, plus every run where any detector fired. Read tool results and reasoning, not only the prompts.

If the sample finds one missed secret or identifier, fix the rule, re-run the whole set and draw a new sample. Record the sample, the misses and the fix in the redaction log.

Worked example: one tool result before and after redaction

Fictional data. An accounts-payable agent looked up a vendor and the tool returned:

Before
{"tool": "erp.get_vendor", "result": {"vendor": "Northfield Supply LLC", "contact": "Dana Reyes", "email": "dana@northfield.example", "iban": "GB00 TEST 0000 0000 0000 00", "notes": "Pay before 15th, approved by J. Moss", "api_host": "erp-prod-02.internal.example", "token": "EXAMPLE-NOT-A-REAL-TOKEN"}}
After (same placeholders everywhere in the run)
{"tool": "erp.get_vendor", "result": {"vendor": "Vendor A", "contact": "Person 1", "email": "person1@vendor-a.invalid", "iban": "[BANK_ACCOUNT_REMOVED]", "notes": "Pay before 15th, approved by Approver 1", "api_host": "[INTERNAL_HOST]", "token": "[SECRET_REMOVED]"}}

Redaction log rows for this step: one secret (token, pattern rule, removed, key revoked), one bank account (pattern rule, removed), two person names (NER, replaced), one email (pattern rule, replaced), one hostname (pattern rule, replaced). The run still shows the agent finding the vendor, reading the payment note and moving on, which is what makes it usable.

Common mistakes when redacting LLM logs

Each of these has let sensitive data through or made a run unusable:

  • Scanning prompts and final answers but not tool results or reasoning.
  • Deleting a leaked key from the log without revoking it.
  • Replacing the same person with different placeholders in one run, so the steps no longer make sense.
  • Deriving pseudonyms from the real value (hashing an email address).
  • Redacting so much of each tool result that nobody can tell what the agent read.
  • Skipping screenshots and attachments.
  • Keeping no log, so nobody can show what was removed or re-run an improved rule.

Download the checklist and the data card template

Agent trace redaction checklist (CSV): each step in order, where to look, the method, how to verify it and columns for owner, date and notes. Agent trace data card template (CSV): one row per field, including the redaction log and reasoning visibility, with two fictional example runs. Both open in Excel or Google Sheets.

To pull the traces out of your tracing tool first, see how to export agent traces.

Redacted traces are also a record of how work gets done

A redacted, logged set of complete runs is useful well beyond one review: for evaluation, for fine-tuning your own models and, where the contracts allow, for licensing.

Thinking of licensing your traces? The guide to licensing agent traces covers what AI developers ask for, the provider terms and who can sign, and you can describe your agent traces without sending files.

Common questions

Is pseudonymised trace data still personal data under GDPR?

Generally yes. Recital 26 says personal data that has undergone pseudonymisation and could be attributed to a person with additional information should be considered information on an identifiable person. Consistent placeholders reduce risk but do not take the data outside GDPR.

Do I need to rotate API keys found in agent logs?

Yes. Removing a key from the log does not stop anyone who already copied it. Revoke or rotate it with the provider that issued it, then record that in the redaction log.

Can an LLM do the redaction on its own?

Not reliably on its own. Model review is good at context, such as confidential instructions, but it can be inconsistent across runs and may paraphrase instead of removing. Use it as one layer with pattern rules and entity recognition, then have a person check a sample.

Which parts of an agent trace hold the most personal data?

Tool results, because they copy in whatever the agent read: CRM records, tickets, emails and database rows. Reasoning often repeats names and numbers too.

What does HIPAA Safe Harbor require before health data in traces is shared?

Removing the 18 kinds of identifiers listed in 45 CFR 164.514(b)(2), from names and small geographic areas to any other unique identifying number, and having no actual knowledge that what remains could identify a person. Expert determination is the alternative method in the same section.

Should card numbers be masked or removed from LLM logs?

Removed. Card verification codes are sensitive authentication data that cannot be stored after authorization, and full card numbers belong only in systems built to hold them. Treat a trace that holds either as an incident before anything else.

How do I keep redacted traces useful?

Use the same placeholder for the same entity throughout a run, keep the structure of tool results, summarise rather than delete confidential instructions, and keep a redaction log.

Sources and further reading

Origin Data Partners is an independent data partner. We work with buyers, and a buyer may pay us when a deal closes.

What is your company’s data worth?

AI companies pay $20K to $5M for company records. Six questions, no files.