Before AI

An agent can expose data through a tool, not just a prompt

A practical guide to redact before ai agents: what leaves the document, what to mask, and how to verify the result.

Redact Before AI Agents: Keep Client Data Out of the Prompt

An agent can expose data through a tool, not just a prompt. An agent does more than answer. It plans, calls tools, reads files, writes to systems and keeps memory. Masking the first prompt is not enough if the agent later retrieves an unmasked record or passes a value to a tool.

What leaves the document

Map the tools, the memory and the traces. Put the redaction step before every model call that carries document text, keep the token mapping outside the agent, and scope every tool to the minimum it needs. An agent with broad tool access is a data path, not a feature.

Where the data hides

The prompt is only one layer. Check:

The redaction flow

  1. List the agent's tools and the data each one can read or write.
  2. Mark the point where document text enters the model.
  3. Mask before that point and keep the mapping outside the agent.
  4. Review the trace for values that bypassed the mask.
  5. Revoke tool scopes that are not needed for the task.

Controls to verify

  • A redaction step on every model call, not only the first.
  • Tool scopes with least privilege and a named owner.
  • Memory and trace retention limits.
  • A test that seeds a unique value and searches the traces.
  • A human approval for write actions.

Retention and evidence

Agent traces often outlive the task and are the most overlooked copy. Ask where the trace is stored, who can read it and how long it is kept. If the agent writes to a CRM or a ticket, that system keeps another copy with its own retention.

Limits

Masking the prompt does not mask a tool result that arrives later. An agent can infer a value from context, and a tool can return an unmasked record. No gateway fixes a tool permission that is too broad.

Why agents multiply exposure

A chatbot answers one prompt; an agent acts on one and plans the next. The pasted file becomes ten tool calls — a search, a spreadsheet write, an email, a calendar invite — and each call is a new disclosure to a new surface. Agents also accumulate memory: summaries of past work, cached preferences, profiles of the people mentioned. The exposure is not the prompt but the graph the prompt grows into.

The controls that keep agents usable

Three controls carry most of the safety. Scope the tools: an agent that can read the drive and send mail is one bad prompt from a leak; grant the minimum tool set per task. Human gates on irreversible actions: the agent drafts, the person sends. And an identity for the agent's calls: its API key should authenticate as the agent, so the logs show which machine acted. Mask before the agent starts, and the multiplication happens on masked values.

The audit question

When the agent does something surprising, the investigation needs its trace: which tools it called, with what arguments, in what order. Platforms that expose this trace are the only ones suitable for sensitive work; the ones that answer 'the model decided' are telling you the governance is outside the building. Ask for the trace before the first deployment, not after the first incident.

How Veilbrook fits

Veilbrook can mask document text before a model call and restore values on your side where the flow supports a gateway. Agent tools, memory and traces need separate controls; the gateway is not a substitute for scoped access.

Questions for the vendor

Before you send

Classify the document, mask the identifiers, attach only what the task needs, and keep the mapping outside the tool. After the answer, restore the values on your side and check that the output did not reintroduce one. If the tool keeps the conversation, decide the retention before you start. A receipt is not a substitute for a review.

Questions

Is masking the first prompt enough?

No. A later tool result or a retrieved document can bring the value back. Mask at every model boundary.

Do agents need their own policy?

Yes. Tool scopes, memory and write actions are part of the data path.

Can we test it?

Seed a unique value in a test document and search the prompts, traces and tool outputs for it.