Build Your Own Local AI Agent (Part 4): The PII Scrubber 🧼

Published: (January 8, 2026 at 08:00 AM EST)
1 min read
Source: Dev.to

Source: Dev.to

Overview

Welcome to the finale of our Local Agent series. Processing sensitive user data (PII) is risky—you can’t send it to the cloud, and you don’t want to read it manually. The PII Scrubber Agent demonstrates a “Level 2” Agent capability: writing its own tools.

Goal

  • Analyze a CSV (users.csv).
  • Detect PII (emails, names).
  • Write a Python script to scrub the data safely.
  • Run the script to produce users_cleaned.csv.

Architecture: Plan, Code, Run

Instead of rewriting the CSV line‑by‑line (slow and expensive), the Agent writes code to do it efficiently.

The Architecture

The “Smarts” Requirement

Smaller models (e.g., llama3.2) crashed because they tried to run the script before writing it. Upgrading to gpt-oss:20b solved the issue:

  1. Paused to inspect the file.
  2. Wrote the complete Python script.
  3. Executed it successfully.

Output of PII Scrubber

Conclusion

We’ve built four agents:

  • Tidy‑Up – Simple actions.
  • Analyst – Database querying.
  • Archaeologist – File editing.
  • Scrubber – Code generation & execution.

All were built locally—no API keys, no data leaks. Just you, Goose, and Ollama.

The complete code is available on GitHub here.

Go build something cool! 🪿

Back to Blog

Related posts

Read more »

Hello, Newbie Here.

Hi! I'm falling back into the realm of S.T.E.M. I enjoy learning about energy systems, science, technology, engineering, and math as well. One of the projects I...