AI Agent Sandboxing: What It Contains, What It Misses and How to Close the Gap


On paper, the company's coding agents are locked down. The CISO approved a sandbox that isolates every run, with no network access except approved endpoints. Weeks later, an agent inside the CRM, switched on by the vendor and connected by a sales manager, exports a customer list to a shared drive. It never touched the sandbox. It used the access it already had.
Most agent risk is inherited, not built in-house, and an agent is only as safe as everything it can reach. AI agent sandboxing restricts what your agent code can access and execute. The agents you don't run need a different control, one that follows their access instead of their code.
What Is AI Agent Sandboxing?
AI agent sandboxing runs an agent's code and local tools in an isolated environment, with explicit limits on file system access, network connections and resource use. It restricts the agent's access to the host, the corporate network and production data, based on the policy you set. These controls limit the damage from a bug, bad instruction or prompt injection, but an agent can still misuse the files, connections and credentials it's allowed to use.
How a Sandbox Isolates Agent Code and Tools
A sandbox enforces its limits below the agent, where the agent can't negotiate them. On Linux, namespaces, cgroups and seccomp filters control what a process can see, how much it can consume, and which system calls it can make. Options such as user-space kernels and microVMs add isolation between untrusted code and the host kernel. Tool processes running inside the sandbox inherit those limits, so a file read, shell command or outbound request succeeds only if policy allows it.
Why Agents Raise the Stakes for Sandboxing
An agent picks its next step at runtime, often from content it just read, so a poisoned page or document can steer it toward actions nobody approved. Reco's State of Agent Security 2026 found that 50% of 500 published MCP servers can run shell commands on the host, and 62% can both read local data and reach the internet. A sandbox is built to break that combination for the agents you run.
Agent Sandboxing Isolation Options Compared
Each isolation option draws the boundary at a different layer, from a shared kernel to dedicated virtual hardware. Stronger isolation usually costs speed, compatibility or operating effort, so match the option to how much you trust the code an agent runs.
What Agent Sandboxing Controls Should Cover
Isolation sets the boundary, and controls decide what's allowed inside it. These 6 controls cover the main paths an agent uses to reach data, consume resources or cover its tracks.
- File System Access: Mount only the directories a task needs, keep the root file system read-only and give the agent a scratch space for output. Keep home directories, SSH keys and cloud config files out of reach.
- Network Egress: Deny outbound traffic by default and send approved destinations through a proxy that enforces a domain allowlist. Open egress turns anything the agent can read into something it can send.
- Credentials and Secrets Inside the Sandbox: Inject short-lived, narrowly scoped tokens at runtime instead of baking long-lived keys into images or environment files. Assume any secret the agent or its tools can reach can be used or leaked.
- Tool and Command Allowlists: Expose only the tools and commands a task needs, and pin MCP servers to reviewed versions. For MCP security, review what each server can do, not only whether someone approved it.
- Time and Resource Limits: Cap run time, CPU, memory and process counts, so a looping or hijacked agent can't run indefinitely or starve the host.
- Session Logging for Investigations: Record prompts, tool calls, commands and outbound requests with timestamps, redacting secrets and sensitive content. Collect logs outside the sandbox in storage the agent can't modify or delete.
Where Agent Sandboxing Works and Where It Can't
Most sandboxing guidance assumes your team runs the agent. In large enterprises, agents live in 4 places, and you control the runtime in only some of them.
Agents Inside Business Apps
Agents built into CRM, ticketing and productivity platforms run on the vendor's infrastructure, sometimes enabled by the vendor itself. There's no runtime for you to sandbox. The agent acts through the platform's permissions and the access of whoever connected it, so control comes from admin settings, OAuth scopes and monitoring what the agent does with that access.
Low-Code Agent Builders
Low-code builders let business users create agents by linking connectors, usually on the builder's hosted platform. You control which connectors are allowed and whose credentials each agent uses, but usually not the runtime. An agent using its maker's credentials can let other users act with permissions they don't personally hold.
Cloud AI Frameworks
With self-hosted frameworks, your team owns the deployment and can pick the option from the comparison table above that fits the agent's code and tools. Managed cloud platforms often provide a separate code-execution sandbox without giving you control over the agent's own runtime. The gap is the agent's cloud role or service account, which decides what it can reach once a call leaves the sandbox.
Agents on Developer Machines
Coding agents, IDE assistants and local MCP servers run on endpoints you manage, so sandboxing is possible. Some coding agents ship with built-in sandbox modes, and dev containers give teams a standard isolated setup. The risk is enforcement, since developers install these tools themselves, and an unsandboxed agent inherits the developer's SSH keys, cloud credentials and tokens.
What a Sandbox Can't Contain: The Access an Agent Already Has
A sandbox limits where agent code runs, but it doesn't limit what the agent's identity can do everywhere else. These 4 gaps explain why agent security has to follow access, not just execution.
How Security Teams Build an Agent Sandboxing Program
A sandboxing program covers more than the sandbox itself. These 6 steps move from discovery to compliance, so isolation lands where it helps and identity controls cover the rest.
- Find Every Agent, Including the Ones That Never Touch SSO: Many agents connect through OAuth grants between services, API keys or personal access tokens, so they never show up in your SSO logs. Build the inventory from OAuth grants, API integrations, platform admin settings and audit logs, alongside endpoint data, so shadow agent discovery catches vendor-enabled features, low-code builds and local coding agents, not only the agents IT approved.
- Rank Agents by What They Can Reach: Score each agent by the data, systems and actions its permissions unlock, not by how often it runs. An agent that can read customer records and post to outside channels outranks a busier one confined to a single internal workspace.
- Sandbox Code Execution Where You Control the Runtime: Apply the controls above to self-hosted frameworks, managed code-execution sandboxes and developer machines. Make isolation the default through dev containers or centrally managed agent settings, so it doesn't depend on each developer's setup.
- Scope Identities and Tokens Where You Don't: For agents inside business apps and hosted builders, identity is the control surface. Give each agent its own identity where the platform allows it, trim OAuth scopes to the task, prefer user-delegated credentials over the maker's and keep tokens short-lived.
- Inspect Tool Calls While Agents Run: Watch which tools agents call, with what arguments and against which data, while the session is live. Where a gateway, app-native hook or endpoint control sits in the path, agent runtime policies can block, warn on or redact a risky call, such as a bulk export to an outside destination.
- Map Controls to ISO 42001, the EU AI Act and NIST AI RMF: Tie each control to the requirement it supports, such as risk and impact assessments under ISO 42001, logging and human oversight for high-risk systems under the EU AI Act, and the Govern, Map, Measure and Manage functions of the NIST AI RMF. Ongoing agent governance keeps that mapping current as agents and permissions change.
How Reco Extends Agent Security Beyond the Sandbox
Reco is an agent security platform that covers the agents and access a sandbox never sees, across 290+ integrations and 22 agent platforms. One shared view of every agent drives discovery, risk mapping and runtime control.
- Discovering Agents Your Sandbox Never Sees: Reco finds agents nobody registered, including those switched on inside a sanctioned platform or connected through an integration, and surfaces them within 24 hours. Reco's agent security layer covers platforms such as Copilot, ChatGPT, Claude, and Agentforce, inventories every MCP server and connection, and gives each agent an owner, a scope and a risk score.
- Mapping What Each Agent Can Reach With Reco Graph: The Reco Graph maps identities, permissions, connections and activity across your third-party ecosystem, so every agent appears with everything it can reach. That map shows when an agent pairs read access in one system with send access in another - the toxic combination behind the CRM export in the opening example - so teams can fix the riskiest agents first.
- Inspecting and Blocking Tool Calls at Runtime: Reco's agent runtime layer checks prompts, actions and events live and applies policies that block, warn, redact, allow or log each agent, tool and action. Enforcement runs through app-native hooks and endpoint controls, using your gateway or Reco's, and a kill switch stops any agent in real time without touching the surrounding network.
Conclusion
AI agent sandboxing answers one question well, which is where an agent's code runs and what that code can touch. Every agent also raises a second question the sandbox can't answer, about what its identity could do if its instructions turned hostile. For agents inside business platforms, that second question is the only one of the two you can act on, so track both for every agent and treat a missing answer as a finding. Reco's complimentary Agent360 assessment is a read-only way to start, showing which agents run in your environment, what they can reach and which fixes to prioritize.
FAQs
Can you sandbox agents that run inside third-party business apps?
Not their runtime, since the vendor hosts and runs the agent. You can still constrain it from the outside by limiting its tools and actions in the platform's settings, requiring human approval for sensitive actions where supported, and connecting it with a dedicated identity scoped to the task. When the agent calls systems you own, a gateway with per-agent credentials lets you throttle or cut it off on your side. Reco's agent runtime policies also apply through app-native hooks, which reach agents your sandbox can't.
How do you stop a sandboxed agent from misusing its tokens?
Keep raw tokens out of the agent's reach where you can, and limit what a token is worth if it leaks.
- Credential-Injecting Proxy: A proxy outside the sandbox attaches credentials to approved requests, so the agent never holds the raw token.
- Request Validation: Have the proxy check the action, target resource and arguments before attaching credentials, and require approval for sensitive operations, since a hidden token can still carry out a harmful request.
- Sender-Constrained Tokens: Where the service supports DPoP or mutual TLS, bind tokens to the proxy's key, so a copied token fails anywhere else.
- Per-Task Scope and Lifetime: Issue a fresh token for each task, scoped to it and expiring when the task ends.
- Usage Monitoring: Alert when a token is used from an unexpected source, at unusual volume or against resources outside its task.
How does Reco find agents that run outside our sandbox?
Reco discovers agents through the systems they connect to, not the runtime they run in.
- Inputs: Identity providers, app APIs, OAuth grants and non-human identities, network and endpoint telemetry, and a browser layer.
- What Reco Does: Correlates those signals in the Reco Graph to identify agents nobody registered, including MCP servers and agents enabled inside sanctioned platforms.
- Output: An inventory where each agent has an owner, a scope and a risk score, with remediation tasks that can be sent to your existing ticketing system.
Reco's shadow agent discovery capability then helps turn unauthorized usage into managed, governed implementations.
How does Reco decide which agents to fix first?
Reco ranks agents by what they can do, using the Reco Graph.
- Reach: Maps what each agent can touch, from OAuth scopes, roles and API keys to the systems, databases and external services it connects to.
- Toxic Combinations: Surfaces high-risk paths, such as read access to customer data in one system paired with outbound access in another.
- Least Privilege and Behavior: Scores permissions against least privilege and compares activity to a behavioral baseline.
- Output: A risk score and blast radius for each agent, so the ones that could do the most damage get fixed first.

Tal Shapira
ABOUT THE AUTHOR
Tal is the Cofounder & CTO of Reco. Tal has a Ph.D. from the school of Electrical Engineering at Tel Aviv University, where his research focused on deep learning, computer networks, and cybersecurity. Tal is a graduate of the Talpiot Excellence Program, and a former head of a cybersecurity R&D group within the Israeli Prime Minister's Office. In addition to serving as the CTO, Tal is a member of the AI Controls Security Working Group with the Cloud Security Alliance.
Tal is the Cofounder & CTO of Reco. Tal has a Ph.D. from the school of Electrical Engineering at Tel Aviv University, where his research focused on deep learning, computer networks, and cybersecurity. Tal is a graduate of the Talpiot Excellence Program, and a former head of a cybersecurity R&D group within the Israeli Prime Minister's Office. In addition to serving as the CTO, Tal is a member of the AI Controls Security Working Group with the Cloud Security Alliance.



