Into the Expanse: A Security Leader’s Guide to the Agent Frontier
Read more
Get a demo
Demo Request
Take a personalized product tour with a member of our team to see how we can help make your existing security teams and tools more effective within minutes.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Home
Blog

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

Tal Shapira
Updated
December 4, 2026
December 4, 2026
11 min read
Ready to Close the SaaS Security Gap?
Chat with us

Key Takeaways

  • A sandbox limits where agent code runs, not what its identity can do: Credentials, inherited permissions, and connected apps stay usable outside it, so an agent can misuse access it already has without touching the sandbox.
  • Sandboxing only works where you control the runtime: Isolate self-hosted frameworks and developer machines. For agents inside business apps and hosted builders, scope OAuth grants, give each agent its own identity, and keep tokens short-lived.
  • Deny egress by default and inject short-lived tokens at runtime: Open egress turns anything the agent can read into something it can send, and any secret it can reach can be used or leaked.
  • Inventory agents beyond SSO and rank them by reach: Build the list from OAuth grants and audit logs, then flag toxic combinations like read access in one system plus send access in another.

‍

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.

‍

Isolation Option What It Isolates Tradeoff
Containers Processes, file view and resources, through namespaces, cgroups and seccomp Fast, but shares the host kernel, so a kernel flaw can enable an escape
gVisor System calls, handled by a user-space application kernel instead of the host Smaller host attack surface, but slower for syscall-heavy work and some syscalls aren't supported
MicroVMs (such as Firecracker) Each workload in a lightweight VM with its own guest kernel Strong isolation with fast startup, but needs KVM and more orchestration
Full virtual machines An entire operating system with its own kernel and virtual hardware Mature separation, but heavier and slower to start
WebAssembly runtimes Module code with no file or network access unless the host grants it Lightweight, but requires Wasm-compatible code, and native tools need host support

‍

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.

‍

Gap Why the Sandbox Misses It What Covers It
Tokens and Keys That Work Outside the Sandbox A bearer token or API key stays usable outside the sandbox unless the receiving service binds or restricts it Short-lived, narrowly scoped tokens and monitoring of how each one is used
Permissions Inherited From the Person Who Connected It The agent acts with that person's scopes, a risk the OWASP Top 10 for Agentic Applications lists as identity and privilege abuse Least-privilege scopes, a named owner and access removal when that person leaves or changes roles
Toxic Combinations Across Connected Apps Each connection looks safe alone, but read access in one system plus send access in another creates an exfiltration path nobody approved Mapping everything each agent can reach and flagging risky pairings
Actions That Look Legitimate to Every App Each action uses valid credentials and permitted APIs, and each system sees only its own piece of the sequence Correlating agent activity across systems and flagging breaks from its usual pattern, like the bulk CRM export in the opening example

‍

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.

‍

Insight by
Gal Nakash
Cofounder & CPO at Reco

Gal is the Cofounder & CPO of Reco. Gal is a former Lieutenant Colonel in the Israeli Prime Minister's Office. He is a tech enthusiast, with a background of Security Researcher and Hacker. Gal has led teams in multiple cybersecurity areas with an expertise in the human element.

Expert Tip: Running Agent Sandboxes in Production


In my experience, these tips keep agent sandboxing honest.

  • Run a Canary Egress Check: Before each session, have a script inside the sandbox call a host that policy should block, and fail the run if it connects or no denial is logged.
  • Block Silent Credential Fallback: Cloud SDKs search environment variables, config files and metadata services for credentials, so pin the provider you intend and confirm a missing task token makes authentication fail.
  • Diff Reach, Not Headcount: A new scope on an existing agent often matters more than a new agent, so review permission changes weekly.
  • Re-Review MCP Tool Descriptions on Update: A changed description can redirect agent behavior, so treat server updates like dependency upgrades.
  • Time Your Kill Switch: Revoke a test agent's access and measure how long its API calls keep succeeding, since existing tokens can stay valid until expiry.


Schedule these checks, since untested sandboxes drift quietly.

‍

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.

Technical Review by:
Gal Nakash
Technical Review by:
Tal Shapira

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.

Table of Contents
Let’s Talk About Your Non-Human Users
Chat with us
Get the Latest SaaS Security Insights
Subscribe to receive updates on the latest cyber security attacks and trends in SaaS Security.

Be the team that enabled agents without losing control.

Want to look around first? Take a platform tour →