slideshare quotation-marks triangle book file-text2 file-picture file-music file-play file-video location calendar search wrench cogs stats-dots hammer2 menu download2 question cross enter google-plus facebook mastodon instagram twitter medium linkedin drupal GitHub quotes-close
A corridor with many doors

Giving an AI agent a terminal is now easy. Ask it to tidy up a project and within seconds it’s reading files, running commands and editing code. The harder question comes next: what else can it see?

For most setups, the honest answer is everything its user can see. SSH keys, cloud credentials, other clients’ folders, browser sessions and API tokens all sit in the same home directory the agent works from.

We wanted to solve that for our own team before encouraging anyone else to put agents near real work. This article explains what we’ve built, how it works and what we’ve learned along the way.

Agents inherit your permissions, not your judgement

People carry context about what they shouldn’t touch. They know one client’s folder isn’t for another client, and that the .env file holds production secrets. An agent knows none of that. It can reach whatever its user can reach.

Organisations tend to respond in one of three ways:

  • Keep agents away from anything real. Safe, but little useful work gets done.
  • Write a strong system prompt telling the agent what not to do. That’s a request, not a control.
  • Trust the agent. Fine until the first prompt injection, a confused tool call or an agent that goes looking around.

We wanted a fourth option: the agent sees only what its job needs, and the operating system enforces it.

Rooms, not rules

A typical agent setup is like handing a contractor the master key to your office, along with a note asking them to stay in Meeting Room 3. Our approach replaces the master key with one that opens Meeting Room 3, plus read-only access to the library. From the contractor’s point of view, the other doors aren’t locked. They don’t exist.

The usual approachOur approach
The agent can see everything and is told to behaveThe agent can only see what it has been given
Safety lives in the promptSafety lives in the operating system
You audit afterwards and hopeAccess is decided up front and recorded
One agent context for everythingA separate profile for each kind of work


 

We call each of those separate worlds a profile. A client profile, a finance profile and an HR profile each get their own workspace and home directory. None can see into the others, or into the main assistant’s session history, memories and logs.

What a profile can’t reach

Inside its sandbox, an agent gets a synthetic home directory and its own workspace. It can’t see other profiles or your SSH keys. There’s no SSH agent socket to borrow keys from, no desktop message bus to reach other applications, and no access to the display, input devices or GPU.

Environment variables are filtered against an allowlist, so API keys, cloud credentials and anything that looks like a token, secret or password stay out unless they’re explicitly granted. And the agent has no network access beyond its own internal loopback.

How it works

The core is built from open-source components, in three layers that each do one job.

The policy

Each profile has a plain policy setting out which folders it can write to, which it can only read, what it must never see and which outside services it may contact. The policy describes intent rather than Linux mechanics, so the same rules could later be enforced with containers, separate user accounts or virtual machines without being rewritten.

The broker

A small, trusted program on the host reads the policy and launches the agent inside its sandbox. It refuses anything that doesn’t match the approved policy, strips secrets from the environment and writes an audit record of what was launched and with what access. It sits outside the sandbox deliberately: nothing inside the box can grant access to doors it can’t see.

The sandbox

We use Bubblewrap, a lightweight open-source Linux sandboxing tool that also underpins Flatpak. It uses kernel namespaces to give a process its own private view of the filesystem and network, which the broker builds folder by folder. There’s no virtual machine, no Docker daemon and no root access, so the sandbox starts in milliseconds and runs at native speed. (It does rely on unprivileged user namespaces, which some Linux distributions restrict by default.)

Network control that can’t be bypassed

The common way to restrict an agent’s internet access is a proxy setting. But a proxy setting is a convention, not a wall: any program can ignore it and open its own connection.

So our sandbox has no network interface at all beyond loopback. On the host, a gateway listens on a single local socket, which is passed into the sandbox. A small bridge inside forwards ordinary web requests through it. The gateway checks every request against an exact allowlist of hostnames and ports, with no wildcards or raw IP addresses, and handles DNS lookups itself.

The agent’s tools still work normally, because they see what looks like a local proxy. But there’s no other route out. API keys can also stay on the host side of the gateway rather than being handed to the agent.

Proving the negative

Our working rule was simple: a profile isn’t isolated until a test proves the agent can’t get out. At each stage we wrote a plan, had it challenged by an independent reviewer, fixed what they found and only then ran the real thing.

The live smoke test ran 25 probes from inside the sandbox. 

  • Can the agent see the SSH keys? 
  • Another client’s folder? 
  • The session history? 
  • The display? 
  • The network? 

All 25 passed, and each result was confirmed from inside the sandbox rather than assumed from outside. We also tested the network gateway against a simulated internet service, so no real credentials were ever at risk.

The isolation core, broker and network gateway are built and tested. Running the full assistant day to day in a network-enabled sandbox is the next stage, and it’s going through the same review process. For security boundaries, we think that’s the right pace.

What this means for your organisation

  • Prompt injection can’t be solved with prompts. An agent that reads a malicious web page, email or document can be turned against you. What you can control is what a hijacked agent finds when it looks around.
  • Client and departmental data needs real separation. “The agent was told not to look” won’t satisfy a contract or an auditor. “The folder didn’t exist inside the sandbox” will.
  • Least privilege applies to agents too. It’s already the standard for staff, servers and applications.
  • Auditability builds trust. When access comes from a written policy and every launch is logged, you can show clients, regulators and leadership exactly what an agent could and couldn’t touch.
  • Security that gets in the way gets bypassed. If people start pasting sensitive content into an unrestricted assistant to avoid friction, fix the workflow before adding more locks.

Let’s talk about AI you control

If your teams are starting to use AI agents near real systems, client data or production infrastructure, we’d be happy to talk through how to do it safely. Get in touch to start the conversation.