AI-Designers
When the agent suddenly runs code
An AI agent that only returns text is harmless. An AI agent that pulls invoices from a database, writes a Python script and runs it to compute a revenue forecast is something else. It acts. And with action comes risk: what happens when the model produces a script that recursively walks your filesystem, floods an internal API with requests, or writes a secret token into a log entry?
In 2026, agentic systems are leaving the demo phase behind. They call tools, execute generated code, move through filesystems and talk to internal services. That is exactly what makes them useful — and dangerous. The question is no longer whether a company hands its agents tools, but how it stops those tools from causing harm. Sandboxing is the answer too few people talk about.

Why guardrails at the model aren’t enough
Many teams believe they have the problem under control because they filter inputs and inspect outputs. That is protection at the model. It catches the prompt that sounds like a delete command and blocks obviously malicious replies. But it cannot see what happens after the agent calls a tool.
Here is the crucial point: an agent doesn’t have to be malicious to do damage. A model asked to clean up a file can accidentally hit the wrong folder. A script meant to read a CSV can spin into an infinite loop and consume all available memory. Prompt injection sharpens the whole thing: a tampered PDF in the inbox can instruct the agent to send data to an external address — and the agent follows the instruction, because it sits in the document it is dutifully processing.
Security at the model and security at execution are two different layers. The first checks intent, the second limits consequences. Build only the first, and you are betting that the model never makes a mistake. That isn’t a strategy. That is hope.
What sandboxing actually means
A sandbox is a walled-off environment where the agent runs its code without touching the host system. If something breaks, only the sandbox breaks. It gets discarded, a fresh one starts. The host stays untouched.
In practice, the methods stack up by degree of isolation. Containers like Docker separate processes and filesystems and are enough for many internal cases — though they share the kernel with the host, which leaves a residual risk. MicroVMs like Firecracker or gVisor draw a harder line: they give each execution run its own minimal virtual machine that boots in milliseconds. WebAssembly runtimes go one step further and lock the code into an environment that knows neither files nor network on its own, unless you explicitly allow it.
The choice depends on your threat model. An agent that only computes over trusted internal data needs less hardening than one that processes content from the open web or from customer uploads. The rule of thumb: the less you trust the input, the stronger the isolation has to be.
Network, filesystem, resources — the three dials
Three things decide whether a sandbox really protects. First, the network: by default a sandbox should have no outbound access. If the agent needs a specific API, you open exactly that address and nothing else. That keeps siphoned data from leaving the building.
Second, the filesystem. The agent gets its own empty directory and sees nothing of the rest of the machine. No SSH keys, no configuration files, no credentials for other services. What it needs to work gets copied in; what it produces gets pulled out in a controlled way.
Third, resources. Without limits, a single misguided run can bring a whole machine down. So fixed ceilings for CPU, memory and runtime belong in the mix. A script that isn’t done after thirty seconds gets killed. A process that demands too much memory gets stopped. These limits aren’t only security — they are cost control too.

Grant rights like you would to a new hire
A useful picture: treat the agent like an intern on day one. You don’t hand them admin access to everything just because they might need some of it eventually. You give them exactly the rights their task requires — and expand them once trust has built up.
For agents that means fine-grained permissions per tool. The agent that reads invoices may read, but not write. The agent that drops a report into a directory may write there, but nowhere else. Each tool gets its own minimal access. This principle of least privilege sounds like extra work, but it pays off at the first incident — because the damage then stays limited to what that one tool was allowed to do.
Tools that write, delete or move money are especially sensitive. Here a human approval in the loop is worth it: the agent prepares the transfer, a human confirms it. For agents running in production with real consequences, that intermediate step is not an obstacle but an insurance policy.
Self-hosted means you control the sandbox
This is where owning your infrastructure pays off twice. Run agents through an external service and you have to trust that its sandbox holds and that sensitive data never lands permanently on the foreign server. Self-host, and you define the isolation layer yourself, log every tool call in-house, and decide which internal systems are reachable at all.
That fits a topic occupying many companies in 2026: data sovereignty. An agent that touches patient records, engineering data or contract documents should not route that data through a sandbox someone else operates. The tools for this are mature and available as open source — from gVisor through Firecracker to WebAssembly runtimes, you can build a solid execution layer on your own hardware.
Logging stays essential. Every tool call, every executed script, every network access belongs on record. Not only for debugging, but also to reconstruct, after an incident, what the agent did. An agent without an audit trail is a black box — and black boxes don’t belong in regulated processes.
The pragmatic starting point
Nobody has to build a perfect microVM architecture on day one. The sensible path starts smaller: isolate code execution in containers, cut network access down to the bare minimum, set hard resource limits, and grant tool permissions sparingly. That covers the bulk of everyday risk.
Once you let agents loose on less trusted input — customer documents, web content, foreign files — you harden the isolation further and add human approvals for critical actions. That way security grows with your usage instead of slowing it down. Agentic AI will win out because it takes work off people’s plates. But only the companies that build their agents a safe stage will run them in production with a clear conscience.
Want to set up agentic AI on your own infrastructure safely — with clean isolation, fine-grained permissions and full control over your data? At AI-Designers we guide companies from the first architecture to productive operation. Get in touch.
Images: AI-Designed
Deutsch

