cd /news/ai-safety/my-clinical-ai-agents-debug-logs-wer… · home topics ai-safety article
[ARTICLE · art-67696] src=pub.towardsai.net ↗ pub= topic=ai-safety verified=true sentiment=↓ negative

My Clinical AI Agent’s Debug Logs Were a PHI Database. Here’s How I (Mostly) Fixed It.

A developer who added observability to a local clinical AI agent found that debug logs contained patients' full names, dates of birth, and phone numbers in plain text. After wiring in Microsoft's Presidio PII detection library and testing on 752 PHI entities across 40 synthetic notes, the masking pipeline never failed but detection failed 135 times, later reduced to 17. The developer warns that redacting a note does not redact the trace, as patient names reappear in extractions, tool calls, and reasoning steps.

read1 min views1 publishedJul 21, 2026
My Clinical AI Agent’s Debug Logs Were a PHI Database. Here’s How I (Mostly) Fixed It.
Image: Pub (auto-discovered)

Member-only story

Every trace restates the patient’s note — in extractions, tool calls, and reasoning. #

I added observability to my local clinical AI agent, opened the trace viewer, and stared at a patient’s full name, date of birth, and phone number sitting in plain text in a database I’d just spun up.

With synthetic patients, that’s a shrug. Wire this into a real clinical pipeline and your observability backend quietly becomes a PHI database nobody threat-modeled. The standard fix is “redact your traces before export.” So I did: I wired in Presidio, Microsoft’s open-source PII detection library, built a ground-truth set of 752 PHI entities across 40 synthetic notes, and measured what actually leaked.

The masking pipeline never failed once. The detection underneath it failed 135 times. Refining the PHI detection got it down to 17 but that was not the most interesting finding of the experiment.

During the detection evaluation, I realized that redacting the note is not redacting the trace. The same patient name gets…

── more in #ai-safety 4 stories · sorted by recency
── more on @microsoft 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-clinical-ai-agent…] indexed:0 read:1min 2026-07-21 ·