Telling an agent not to open the folder is not a control

By the TECHWORKSLAB platform team

Here is a pattern we see often when teams first put an agent to work near regulated data. Someone writes into the prompt a line that reads, in effect, do not open this folder, or do not use this data. The intent is good. The problem is that the sentence is the only thing standing between the model and the data it is not supposed to touch. A control that depends on the model choosing to obey an instruction is not a control at all.

In a clinical or life sciences setting this matters more than it does almost anywhere else. The data in question is patient data, study data, or something else that carries a legal and ethical duty of care. When an auditor asks how you kept the agent away from it, the honest answer needs to be about the environment, not about a request you made to a language model.

Why the prompt is the weak spot

A language model reads instructions as text, weighs them against everything else in its context, and produces an output. That process is useful, but it is not a permission system. The instruction to avoid a folder can be misread. It can be outweighed by a later instruction that seems more urgent. It can be lost when the context grows long. And it can be talked out of the model entirely by a user who frames the next request the right way, whether they mean to or not.

None of that requires bad intent from anyone. It only requires that the boundary lives in words the model is free to interpret. Prompt-based access restriction is guidance. It helps shape ordinary behavior, and it is worth writing. But it will not hold up as a security control, and it should never be described as one.

Make the sensitive thing unavailable

The stronger pattern is simple to state. If the agent must not reach something, make it technically unable to reach it. Do not mount the folder into the environment where the agent runs. Do not expose the sensitive dataset to that process. Do not grant filesystem paths or network routes the workload has no reason to hold. Once the data is not present and the path does not exist, no instruction, clever or careless, can pull it in.

This changes what you can say to an auditor. Instead of the environment was configured to tell the agent not to access the data, you can say the environment made access impossible. The first is a claim about behavior you hope held. The second is a fact about how the system was built. Only one of those survives an inspection.

The right statement to an auditor is that the environment made access impossible, not that the agent was told not to.

Containerize the workload

Containers are the practical way to enforce this per run rather than per policy document. When each agent workload runs in its own container, the isolation boundary, the filesystem it can see, the dependencies available to it, and the access it holds are all set for that run and torn down after. Nothing leaks from one job into the next by accident.

There is a second benefit that matters at scale. A platform can recognize when a workload is agentic and place it in the correct restricted environment automatically, rather than relying on each team to remember to do the right thing. The safe default becomes the path of least resistance, which is the only kind of safe default that survives a busy week.

Route model calls through one gateway

The other common weak spot is wiring. When every team connects directly to a commercial model provider with its own keys and its own code, there is no single place to see or shape what happens. A central model gateway fixes that by putting one controlled point between your workloads and any provider.

With traffic flowing through a single gateway, you get one place to hold and rotate credentials, one place to inspect the inputs going out and the outputs coming back, and one place to apply data guardrails. A guardrail here might stop protected health information from leaving controlled infrastructure, block a known category of content, or flag something for review. The same chokepoint tracks cost and usage and keeps an audit trail, so the record of what the agents did lives in one system rather than scattered across teams.

Guardrails do not have to be elaborate to be useful. They can start as simple pattern matching for the kinds of identifiers you know must never leave. When that is too blunt, a small local model can classify content before it leaves, catching cases that a fixed pattern misses. The point is that the check runs inside your infrastructure, on the way out, every time.

Watch the traces too

There is a second-order trap worth naming. The traces and logs you collect to improve auditability are, by their nature, a record of the inputs and outputs the agent handled. For a regulated agent, that means the trace store can end up holding the very sensitive data you worked to protect everywhere else. More logging is not automatically safer.

Trace storage needs its own access controls and its own governance, on the same footing as any other store of sensitive data. Who can read the traces, how long they are kept, and where they live are all real decisions. Treating observability as harmless because it is only logs is how sensitive data quietly ends up somewhere no one is watching.

What the controls actually look like

Put together, the infrastructure-level controls for a regulated agent form a short and checkable list:

  • Sensitive data is never mounted or exposed to the agent's environment in the first place.
  • Each run happens in its own container, with isolation and dependencies set per run.
  • Access is least privilege, so the workload holds only the filesystem and network reach it genuinely needs.
  • Outbound traffic is filtered through a gateway that can inspect and block what should not leave.
  • Traces and logs are stored under their own access controls and governance, not left open because they are only logs.

Each item is something you can point to, test, and show. That is the difference between a control and a hope.

Isolation is a property of the platform

The through line is that isolation is an infrastructure property, not a behavioral one. You do not achieve it by asking the model nicely, and you cannot verify it by reading the prompt. You achieve it by building an environment where the wrong action is not available, and you verify it by inspecting how that environment is put together. If your only boundary is a sentence in a prompt, you do not have a boundary.

If you are putting agents to work near regulated clinical data and want the boundaries to hold up under inspection, talk to our team.

Back to Insights