VeilNet
Blog

Sandboxing AI agents by what they can reach

An AI agent is only as dangerous as what it can reach. Containers share the host's kernel and its networks, and a VM per agent is strong but heavy. Here's a third way: give every agent its own compartment on VeilNet, so it reaches its own tools, and the internet only through an exit you run.

AGENTSTHEIR TOOLSSUPPORTSupport agentLIGHT CONTAINERCRMMCP SERVERFINANCEFinance agentLIGHT CONTAINERLedgerMCP SERVERRESEARCHResearch agentLIGHT CONTAINERSearch indexMCP SERVERONE COMPARTMENT PER AGENT · NO VM EACH

AI agents don't just answer questions any more. They call tools, query databases, open tickets and browse the web on our behalf. More and more of that runs over MCP, the Model Context Protocol, which connects an agent to the tools it may use.

That reach is exactly what attackers go after. In February 2026, researchers found tens of thousands of OpenClaw agents exposed to the internet, and as The Register put it, compromising one meant “gaining access to everything the agent can access”. The same month, Pluto Security reported that mcp-atlassian, an MCP server with more than four million downloads, listened on every network interface with no authentication by default when run as a web service. Its security advisory warned that one flaw could let an attacker steal cloud credentials from the instance metadata service.

This post looks at the two usual ways to sandbox an agent, a container or a virtual machine, and at a third: sandboxing what the agent can reach.

An agent's reach is the risk

Most of what goes wrong with an agent goes wrong over the network. A prompt injection hidden in an email, a web page or a support ticket can talk an agent into calling a tool it shouldn't, or sending data somewhere it shouldn't. The UK's NCSC has warned that it's very possible prompt injection attacks “may never be totally mitigated”. If an agent can be talked into almost anything, what matters most is what it can reach.

The agencies agree. At the start of May, six national cyber agencies, among them CISA, the NSA and the UK's NCSC, published joint guidance on adopting agentic AI. It says “strict adherence to the principle of least privilege is critical”, and asks organisations to “implement isolation and segmentation to limit blast radius of agent failure scenarios”. OWASP's Top 10 for agentic applications puts it more bluntly: “deny all non-approved network destinations”.

The two usual sandboxes

Today, an agent and the code it runs usually live in one of two kinds of sandbox:

  • A container. Light, quick to start and the default for most teams. But containers share the host's kernel, so a flaw in the kernel or the container runtime can let code break out. In November 2025, three flaws in runc, the runtime underneath most Docker and Kubernetes setups, allowed “full container breakouts”. And on its own, a container can reach whatever its host can, unless someone writes and maintains network rules for every agent.
  • A virtual machine. A VM has a kernel of its own, so breaking out is much harder. But every agent then carries a whole operating system that has to boot, be patched and be paid for, and a full VM typically takes seconds to start. Lightweight microVMs have narrowed the gap, with Firecracker booting in under 125 milliseconds, but each one still runs a guest kernel for every agent.
Fig. 01 — Three ways to sandbox agents
CONTAINERSFULL VMSON VEILNETREACHESVIAAGENTSRUNS ONHOST'S NETWORKSAGENTAGENTSHARED KERNELVIRTUAL NETWORKAGENTOSKERNELAGENTOSKERNELHYPERVISORTOOLVIRTUALKERNELAGENTTOOLVIRTUALKERNELAGENTSHARED KERNELEACH AGENTLIGHTA WHOLE OSLIGHT

In containers, every agent sits on the host's shared kernel and can reach whatever the host's networks reach. Full VMs give each agent its own kernel, at the cost of a whole operating system each. On VeilNet, the agents stay in light containers on the shared kernel, but each one's traffic goes through its own VeilNet micro virtual kernel, in a compartment of its own, so it reaches only its own tools, and the internet through an exit you run.

Either way, the sandbox is about where the agent's code runs. Neither one, by itself, decides what the agent can reach once it's running.

A third way: sandbox what the agent can reach

VeilNet starts from the other end. Instead of asking how thick the walls around an agent should be, it decides which doors exist at all.

  • Each agent gets a compartment of its own. When an agent starts, it joins VeilNet with an identity issued for it, which its container holds only in memory. The identity carries the agent's compartment as labels: one that all your agents share, one for its team, and one of its own.
  • Its tools join through the micro virtual kernel. Each MCP server, API or database publishes into VeilNet through VeilNet's micro virtual kernel, its own network stack inside VeilNet's process. The host kernel gets no network interface or route for VeilNet, and peers reach only the port you publish. We described the micro virtual kernel in our post on Tailworm.
  • The agent reaches those tools, not the rest. Compartments follow one rule: two machines can talk only if one carries every label the other does. So a tool labelled for the support team is reachable by every support agent, support agents can't reach finance's tools, and no agent can reach another agent over VeilNet.
  • The internet only through a door you choose. If an agent needs the web, VeilNet can send its internet traffic to an exit node you run, so it leaves from one place where you can log and filter it with your own tools.
Fig. 02 — How an agent reaches a tool
THE AGENT'S CONTAINERTHE TOOL'S MACHINELOOPBACKPOST-QUANTUMITS COMPARTMENT ONLYAgentAN ORDINARY USERVeilNetIDENTITY IN MEMORYMCP serverON 127.0.0.1 ONLYVeilNetMICRO VIRTUAL KERNELAN INTERFACE, TO CONNECT OUTNO HOST INTERFACE OR ROUTETHE TOOL LISTENS ON LOOPBACK · VEILNET CARRIES THE REST

The agent's container runs VeilNet with an identity held only in memory, and gets an ordinary network interface, because it connects out. On the tool's machine, VeilNet's micro virtual kernel carries the overlay inside its own process, so the host gets no interface or route for it, and the tool listens only on loopback. Only machines in the agent's compartment get through.

Once each machine has an identity from your own VeilNet control plane, the guardian, it's one command on each side. On the tool's machine, publish the tool. In the agent's container, start VeilNet with the identity issued for that agent. Here, a stand-in called fetch-credential hands it over; today, you issue each identity in the guardian's console.

the tool's machine, then the agent's container
$ sudo conflux proxy 8080=127.0.0.1:3000
$ fetch-credential | sudo conflux up --ephemeral --manifest - \
    --use-exit --observe --export guardian.example.gov:4317

The agent's side uses an ordinary network interface in its container, because it connects out. Creating it takes root, the CAP_NET_ADMIN capability and the TUN device. The agent itself runs as an ordinary user and needs no special rights.

What a hijacked agent could do

Now suppose the worst: a prompt injection takes over an agent halfway through a task. With the setup described below, here's what it could still reach:

  • Its own tools, yes. That's the reach you gave it, so keep each tool's rights as narrow as the job allows.
  • Other agents, no. Over VeilNet, agents in other compartments don't even appear on its network.
  • Another team's tools, no. They're labelled for compartments it isn't in.
  • Your internal network, no. VeilNet carries it only to what its compartment may reach, so unless you share a network with that compartment, there's no route to it.
  • Strangers' servers, only through your exit. Anything it sends to the internet leaves through the exit node you run, where you can log and filter it.
  • And it can be stopped from outside, as the next section shows. Start the agent with traffic observation on, as in the command above, and the guardian also keeps a record of which tools it reached for 90 days.
Fig. 03 — A hijacked agent's reach
ITS COMPARTMENTCRMSTILL REACHESTicketsSTILL REACHESAnother agentNO REPLYAnother team's toolsNO REPLYYour office networkNO ROUTEEXITThe internetONLY VIA YOUR EXITAgentHIJACKEDITS COMPARTMENT IS ITS SANDBOX

A hijacked agent keeps only the reach you gave it: the tools in its own compartment, and the internet through the exit you run. Other agents, other teams' tools and your office network are outside its compartment, provided its container lets out only VeilNet's own traffic.

Stopping a hijacked agent

Spotting a hijacked agent is only half the job. You also have to stop it, and the machine you'd normally ask to stop is the one that's been taken over. VeilNet doesn't need its cooperation. A VeilNet network runs itself with gossip controls: signed instructions that its members pass to one another, with no central server in the path.

  • Block it. From the guardian's console, an admin blocks the agent, and the block takes effect within minutes. It passes from member to member through the network, and from then on every member refuses the agent: its tools, other agents and the exit node alike. And it only goes one way. The block is never sent to the agent itself, and the agent's own credential carries no power to block or unblock anything, so a hijacked agent has nothing to ignore and no way to lift it. Only an admin can. A member that was away gets the block as soon as it's heard from again, and members that keep their state hold it across restarts. A block can carry a reason and an end date.
  • Or quarantine it. For an agent that keeps its VeilNet settings on disk, an admin can instead move it into a quarantine compartment of its own, cut off from its tools but still on the network to be looked at. That's one way too. No machine can move another or put itself in a compartment, so the agent can't move itself back, and every member treats it as quarantined from then on. Even rebuilt from its original identity, it moves itself back into quarantine as soon as the record of the move reaches it. An agent whose identity is held only in memory can't be moved, so for those, block.
Fig. 04 — A block everyone enforces
Admin nodeISSUES THE BLOCKCRMREFUSES ITTicketsREFUSES ITExit nodeREFUSES ITOther agentREFUSES ITSearchREFUSES ITAgentHIJACKEDCAN'T LIFT ITONE WAY · IT NEVER REACHES THE AGENT, WHICH CAN'T LIFT IT

The guardian's admin node issues a block. It travels one way, from member to member, and from then on every member refuses the hijacked agent. Nothing is ever sent to the agent itself, and only an admin can lift a block: the agent holds no power to. A member that was away gets the block as soon as it's heard from again.

Fig. 05 — A move with no way back
BEFOREAFTERSUPPORTCRMTicketsAgentHIJACKEDQUARANTINEAgentHIJACKEDCUT OFF FROMCRM AND TICKETSADMINMOVES ITCAN'T MOVE ITSELF BACKEVERY MEMBER NOW TREATS IT AS QUARANTINED

An admin moves the hijacked agent from its own compartment into quarantine, and every member treats it as quarantined from then on, so it's cut off from its tools. It's one way: no machine can move itself or another, so the agent can't move back. Even rebuilt from its original identity, it returns to quarantine once the record of the move reaches it. An agent whose identity is held only in memory can't be moved, so block those instead.

Lighter than a VM per agent

None of this needs a virtual machine for every agent. The agent runs in an ordinary, light container, and VeilNet runs as a small service beside it: no guest operating system to boot, patch or pay for, and nothing of its identity stays in the container when the run ends. You keep the container's quick start and low cost, and the agent's network is as tightly drawn as you like.

Getting the details right

A compartment is only as tight as the container around it. These are the details that make the difference:

  • One container per agent. Several agents can share a host, as long as each runs in its own container, with its own network and its own copy of VeilNet. Turn off traffic between containers, so agents on one host can't reach each other directly.
  • Lock the container's own network down. VeilNet travels over the container's network and adds its routes on top. Let only VeilNet's own traffic leave the container, and block everything else, the cloud's metadata service included. Run the agent as an ordinary user, never root, and stop it if VeilNet stops.
  • Labels no other machine carries. A machine with only the shared label can reach every agent, so guard shared tools and the exit node closely. The guardian starts every machine's compartments with the realm's name, so clear it for agents, or give your agents and their tools a sub-realm of their own.
  • Tools on loopback, with their own sign-in. Set each tool to listen only on its machine's loopback, and keep its own sign-in on. Through VeilNet, every call arrives from loopback, so the tool can't tell one allowed agent from another.
  • Identities that end with the job. The agencies advise “ephemeral credentials that expire when the job is complete”. The agent's container never stores its identity, but the identity stays valid until its credential runs out, which your deployment sets, up to 90 days. Block and revoke each agent's identity when its job ends.

Side by side

A containerA full VMA light container on VeilNet
The agent's codeShares the host's kernelRuns on a kernel of its ownShares the host's kernel, in a light container
What it can reachWhatever the host can, unless you add rulesWhatever its virtual network allowsIts compartment's tools, and the internet through your exit
Cost per agentLightA whole operating systemLight, plus VeilNet's small service
Its identity on the networkAn IP addressAn IP addressIts own, issued for it. The container keeps no copy
The internetDirect, unless blockedDirect, unless blockedThrough an exit node you run, with the container locked down
Stopping a hijacked agentFind and kill it on its hostFind and stop it on its hostA one-way block every other member enforces
A record of what it reachedOnly if you build oneOnly if you build oneKept for 90 days, with traffic observation on

Try it

You can try compartments and an ephemeral run on the free network VeilNet hosts, with one tool and one agent. Issued identities, blocking and traffic records need a guardian of your own. The docs cover ephemeral runs, publishing a service, compartments and exit nodes.

If you're putting agents into production, we'd be glad to help you plan their compartments. Book a demo or write to sovereign@veilnet.net.