AI agents need tools, APIs, and autonomy to become useful. However, granting AI agents privileges and unmonitored execution environments creates a massive liability.
If an autonomous agent has system access, a prompt injection hidden in an incoming email or a standard LLM hallucination can cause the agent to wipe a production database or leak AWS credentials to a public server.
The challenge for engineering teams is deploying AI agents without compromising internal systems.
Semantic guardrails, like system prompt instructions, can be circumvented. True security requires defense-in-depth across three distinct planes:
- Infrastructure layer: Host-level sandboxing that prevents a compromised agent from leaking data from the host operating system.
- Architecture and runtime layer: Single-purpose, ephemeral containers running vulnerability-free software instead of massive, unauditable codebases.
- The network layer: A zero-trust boundary that intercepts, inspects, and evaluates every outbound API call.
The security threats of AI agents
The paradox of AI agents is that the more capable you make them, the more dangerous they become. And securing them often comes at the cost of usefulness.
Instruction-based boundaries fail because agents given tools are bound by their context windows and execution environments, not their initial instructions.
This structural failure became clear during an incident at Meta. An OpenClaw agent, deployed by Meta's own alignment director, went rogue and mass-deleted over 200 emails from her primary inbox.
Another devastating infrastructure failure occurred when a developer used Claude Code to manage a cloud migration. The agent autonomously wiped a production database and 2.5 years of work.
Similarly, a coding agent using Claude Opus recently caused a major outage while cleaning up staging data.
In all instances, the agents executed exactly what they determined was the correct action. The underlying systems allowed those destructive actions to proceed.
The three layers of agent defense
There is no silver bullet for agent security. The industry is moving toward a defense-in-depth model. Just like other areas, agentic workflows require guardrails across different layers.
NemoClaw: securing the infrastructure layer
When running heavy, highly capable agents like OpenClaw or Hermes, you must assume the agent process itself cannot be fully trusted and can be hijacked by a malicious input.
NemoClaw addresses this threat vector with an OS-level safety sandbox that separates the control plane from the execution environment. The agent runs inside a Docker-driven sandbox heavily restricted by Linux kernel security features.
It uses Landlock for filesystem confinement, restricting read and write access strictly to specific directories, blocking access to sensitive host files like SSH keys or credentials.
At the same time, it uses Linux seccomp (Secure Computing Mode) to prevent operations like privilege escalation or kernel module loading to prevent sandbox escapes.
Network namespaces (netns) enforce strict egress control, blocking unapproved internet sockets and raw network interface visibility.
There are no API credentials inside the agent's environment. The agent makes requests using placeholder credentials. An OpenShell Layer 7 gateway proxy intercepts the egress traffic and injects the real API keys only if the traffic is approved.
For example, an agent attempts to connect to a new endpoint. The OpenShell gateway intercepts the request. NemoClaw prompts a human operator to approve the endpoint with credentials. The API key remains safely on the host machine, invisible to the sandboxed agent.
NanoClaw: securing the architecture and runtime layer
NanoClaw tackles security through simplicity. It is a minimalist version of OpenClaw, reducing the codebase from more than a million lines of code to a few thousand lines, easily auditable by human developers.
It relies on a single-process architecture where every AI agent session spawns inside its own ephemeral, isolated Linux container.
NanoClaw recently partnered with Echo to address the software environment. A modern prompt injection often acts like a social engineering attack, luring the agent to a malicious page where a known hole in the browser turns the visit into a system compromise.
Echo solves this by providing NanoClaw with a hardened runtime. Echo's own AI continuously rebuilds the software inside the agent's environment, stripping out thousands of known CVEs.
Consider an agent tasked with opening a PDF invoice that contains a malicious payload designed to exploit a known vulnerability in standard PDF parsers. With the Echo-hardened NanoClaw runtime, the parser has already been rebuilt without the vulnerability.
CrabTrap: securing the network layer
Because agents constantly generate their own code, static code analysis inside the container becomes impossible. You must assume the container is compromised and shift the security perimeter entirely to the network boundary.
CrabTrap, built by Brex, operates at the transport layer as a framework-agnostic HTTP/HTTPS proxy that controls the outbound traffic.
To avoid latency, CrabTrap uses a bifurcated architecture. Routine, low-risk requests (e.g., GET requests for LinkedIn profiles) pass through static rules instantly. High-risk requests, such as POSTing data or sending emails, are intercepted and evaluated by an LLM-as-a-judge.
If the LLM judge blocks a request, CrabTrap initiates a human-in-the-loop workflow by pinging a manager with the agent's intent. The manager can approve to dynamically update the policy or deny to keep the block in place.
Consider an AI agent that processes inbound documents. It encounters a prompt injection inside a document that instructs the agent to email sensitive internal data to an external address.
A standard agent blindly executes the email-sending script because it trusts its corrupted context window, leaking the salary data instantly.
With CrabTrap, when the agent executes the HTTP POST request to the email provider API, the proxy intercepts the payload. The LLM judge evaluates the payload, flags the outbound salary data as a severe policy violation, and blocks the request. CrabTrap then notifies a human manager.
The agent security blueprint for engineers
Engineers must make a core mindset shift. Instead of trying to control agents with prompts and instructions, ask what system boundaries will stop the model from causing harm when it eventually makes an unapproved decision or gets compromised.
When threat modeling autonomous agents, evaluate your stack against three questions:
- Where does execution happen? Assume the process will be compromised. Set perimeter guardrails to prevent sensitive data from entering or leaving the process that runs the agent.
- What software is running inside the loop? Audit the attack surface. Remove excess components and ensure the tools the agent uses don't contain unpatched vulnerabilities.
- What leaves the boundary? The agent has to have external connections. Set static and AI-based rules to catch potentially malicious requests.
Treat AI agents like virtual employees. They require defined permissions, restricted network access, and direct escalation paths to human managers when they hit a policy wall.