Skip to content
latentSource

Masking before the agent handoff

A database transfer workflow that masks customer fields before rows reach an agent or its mailbox.

Pi agents · TypeScript · PostgreSQL

Masking before the agent handoff

How the pieces connect

Engineering brief

Problem
Transfer database records between agents without exposing selected raw customer fields in tool results.
My contribution
Built the masking tool, restricted producer workflow, PostgreSQL mailbox, and consumer loading path using synthetic banking data.
Key decision
Mask inside the producer’s data tool before rows are returned to the model or mailbox.
Result & evidence
Published code and a captured Pi-producer run with an emulated consumer, saved messages, and checks.
Limitations
A proof of concept with synthetic records and an emulated consumer. Masking selected fields does not remove all identifying information.

What it does

The producer queries synthetic banking data through a restricted tool. That tool masks sensitive fields before returning rows; the consumer loads the masked records into a separate database.

The replay shows a captured run with a Pi producer and an emulated consumer. You can follow the messages and inspect the saved checks alongside the code.

How it is built

The technical post covers the masking boundary, tool permissions, mailbox delivery, incremental loading, and the limits of the captured checks.

Mask before the handoff