October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Sandbox AI Agents So They Can’t Access Sensitive Files or Systems

A practical guide to sandboxing AI agents with enforceable filesystem, network, credential, and tool-access controls.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To keep an AI agent away from sensitive files and systems, enforce restrictions outside the model: isolate the code it runs, expose only the files and network destinations its task requires, keep broad credentials out of its environment, and authorize each tool action independently. Prompts and human review can help, but they are not access controls.

What a sandbox must protect

A sandbox is a restricted execution environment in which software can access only authorized resources. The NIST CSRC glossary gives this definition and attributes it to CNSSI 4009-2022. For an AI agent, the boundary needs to account for more than the model’s text output: it includes any code the agent runs, files and processes it can reach, network connections it can make, and external tools it can invoke.

As an Amazon Associate I earn from qualifying purchases.

Start by defining the threat and task. Identify which data is sensitive, which actions could cause harm, what the agent genuinely needs to do, and whether users or workloads must be isolated from one another. Include untrusted content in the threat model: a web page, email, repository file, document, or tool response can contain instructions intended to manipulate the agent. OpenAI’s prompt-injection guidance and the OWASP AI Agent Security Cheat Sheet both address this risk.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not treat any particular container, VM, hosted service, or vendor sandbox as an absolute guarantee. Evaluate what its controls enforce, where the boundary lies, and what remains reachable through other tools or services.

#1 Best Overall
Yubico - Security Key C NFC - Basic Compatibility - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key C NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key C NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key C NFC via USB-C and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.

Separate trusted orchestration from agent execution

Where practical, keep the trusted harness—the service that runs the agent loop, calls the model, routes tools, handles credentials, records approvals, and supports recovery—outside the compute where model-directed commands run. The execution environment should receive only the task-specific inputs, mounts, and runtime configuration it needs. OpenAI’s Sandbox Agents documentation describes this separation and notes that putting the harness inside the sandbox places orchestration and model-directed execution in the same compute boundary. That can simplify a prototype, but it is a security trade-off.

Use separate environments when data from different users or workloads must not mix. Decide how the environment is created, what persists between tasks, and how it is cleaned up or recovered. Keep approvals, audit records, and trusted authentication in the control plane where possible, rather than relying on files or state the agent can change.

Expose only the files and network access the task needs

Make filesystem access narrow

Mount or expose only the working files required for the task. Keep unrelated repositories, sensitive host paths, configuration, deployment material, and credentials outside the agent’s accessible workspace. Restrict writes as carefully as reads; if a task only needs inspection, make its data read-only. Review outputs before transferring them into trusted systems.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A workspace boundary is not a guarantee that every other path is inaccessible. Check the actual runtime’s behavior for mounts, host access, subprocesses, and temporary files. Product-specific manifests and controls vary, so apply these as design requirements rather than assuming one configuration syntax works everywhere. OpenAI’s sandbox guidance and sandbox security documentation describe relevant environment and security considerations.

Rank #2
Yubico - YubiKey 5 NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-A or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5 NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5 NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5 NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Control outbound connections separately

Filesystem restrictions limit which data the agent can read or alter; network restrictions limit where it can send accessible data and what it can retrieve. Use both. A path boundary without egress control can leave a route for data exfiltration, while egress restrictions alone still leave unnecessary local data exposed. Anthropic makes this distinction in its engineering article, “Making Claude Code more secure and autonomous with sandboxing”.

Where the task permits, begin with no outbound access and allow only required destinations through a proxy, firewall, or provider network policy. Work out where connections originate: a local executor and a remote tool provider may need different allowlists. A host allowlist is not a substitute for API authorization; the service or tool must still check identity, resource, and operation scope.

Keep broad credentials outside the sandbox

Do not put secrets in prompts, repositories, generated scripts, images, or logs. Prefer a trusted proxy or vault-backed mechanism that supplies access only for an approved destination and operation. Use narrowly scoped, short-lived credentials where possible, and have a plan to revoke or rotate them after suspected exposure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If a secret is injected into the sandbox—for example, as an environment variable—assume code running there can read it. OpenAI states in its sandbox security documentation that “Agent-generated code can access the files, credentials, and network available to its environment.” Keep application-level keys in the trusted control plane even when the executor needs a restricted credential to perform a specific task.

Rank #3
Yubico - YubiKey 5C NFC - Multi-Factor authentication (MFA) Security Key and passkey, Connect via USB-C or NFC, FIDO Certified - Protect Your Online Accounts
  • POWERFUL SECURITY KEY: The YubiKey 5C NFC is the most versatile physical passkey, protecting your digital life from phishing attacks. It ensures only you can access your accounts
  • WORKS WITH 1000+ ACCOUNTS: Compatible with popular accounts like Google, Microsoft, and Apple. A single YubiKey 5C NFC secures 100+ of your favorite accounts, including email, password managers, and more
  • FAST & CONVENIENT LOGIN: Plug in your YubiKey 5C NFC via USB and tap it, or tap it against your phone (NFC), to authenticate. No batteries, no internet connection, and no extra fees required
  • MOST SECURE PASSKEY: Supports FIDO2/WebAuthn, FIDO U2F, Yubico OTP, OATH-TOTP/HOTP, Smart card (PIV), and OpenPGP. That means it’s versatile, working almost anywhere you need it
  • PRIMARY & SPARE KEYS: Just like having a spare house key, we recommend buying two YubiKeys - one for daily use and one as a spare. That way you’ll never get locked out of your accounts

Authorize tools and consequential actions independently

A contained shell does not restrict an agent that can separately call an unrestricted database, email, file, deployment, or administrative tool. Give each task only the tools it needs, and enforce resource- and operation-level permissions in the tool or service itself.

  • Prefer read-only access when it is sufficient; separate read operations from writes.
  • Avoid wildcard access to commands, resources, or accounts. Scope each tool to the specific data and actions required.
  • Put high-impact actions—such as production changes, deployments, payments, administrative operations, or externally visible messages—behind deterministic policy checks and human approval where appropriate.
  • Show reviewers the actual proposed action and relevant data flow, not just a vague request to approve an intention.

OWASP’s AI Agent Security Cheat Sheet covers tool abuse, privilege escalation, and least-privilege practices. OpenAI’s prompt-injection guidance also recommends confirmation for sensitive actions. Approval is a layer of protection, not a replacement for narrow permissions.

Assume content may try to manipulate the agent

Prompt injection is an attempt to mislead an agent through content included in its context. It may arrive in a page, email, document, repository, or tool response. Treat retrieved content as data, not as authority to widen access or change policy. Keep tasks specific, limit what the agent can access, validate requested tool actions outside the model, and require review for sensitive operations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Clear instructions can help the agent distinguish task requirements from untrusted content, but they cannot make broad filesystem, network, or tool access safe by themselves. The security boundary must be enforced by the runtime and the services that authorize tools.

Rank #4
Yubico - Security Key NFC - Basic Compatibility - Multi-Factor Authentication (MFA) Key, Connect via USB-A or NFC, FIDO Certified
  • POWERFUL SECURITY KEY: The Security Key NFC is the essential physical passkey for protecting your digital life from phishing attacks. It ensures only you can access your accounts.
  • WORKS WITH 1000+ ACCOUNTS: Compatible with Google, Microsoft, and Apple. A single Security Key NFC secures 100 of your favorite accounts, including email, password managers, and more.
  • FAST & CONVENIENT LOGIN: Plug in your Security Key NFC via USB-A and tap it, or tap it against your phone (NFC) to authenticate. No batteries, no internet connection, and no extra fees required.
  • TRUSTED PASSKEY TECHNOLOGY: Uses the latest passkey standards (FIDO2/WebAuthn & FIDO U2F) but does not support One-Time Passwords. For complex needs, check out the YubiKey 5 Series.
  • BUILT TO LAST: Made from tough, waterproof, and crush-resistant materials. Manufactured in Sweden and programmed in the USA with the highest security standards.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the boundaries and record decisions

Test whether controls deny access at the runtime or service boundary; do not count a model’s refusal as proof that access is blocked. Adapt tests to the chosen runtime and threat model. Include attempts to:

  • Read a path outside the task workspace or access another user’s data.
  • Write outside the permitted output location.
  • Contact an unapproved destination or retrieve an unapproved resource.
  • Invoke a tool, resource, or operation the task has not been granted.
  • Use a subprocess to reach resources that the main process is meant to lack.

Verify the expected denial and check whether the attempt leaves side effects. Log authorization decisions and relevant actions so incidents can be investigated, while avoiding sensitive content in logs. OWASP’s guidance and OpenAI’s sandbox security documentation support layered controls and authorization checks; they do not establish one universal test suite or a general sandbox escape rate.

Choose an architecture for the workload

Different execution patterns trade local capability, isolation, and operating effort. These examples describe vendor-reported implementations, not guarantees that all hosted or local agents behave the same way.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Pattern What it can provide Trade-off to assess
Ephemeral hosted workspace A separate, temporary execution environment for bounded tasks. Anthropic describes its claude.ai code-execution environment as server-side and ephemeral, without access to the user’s filesystem, in “How we contain Claude across products”. Less continuity and access to local workspace capabilities; verify the behavior and isolation of the specific service you use.
Local coding-agent sandbox Access to a local project while restricting paths and network destinations through operating-system controls and a proxy. Anthropic describes this approach for Claude Code in its sandboxing article. The project files you grant remain available to the agent, and activity outside the boundary may require user approval.
Hosted container or VM execution A distinct execution plane that may support explicit environment configuration, mounts, packages, ports, and snapshots; see OpenAI’s Sandbox Agents and Sandbox security documentation. Isolation depends on configuration and provider behavior. Keep the trusted harness and broad credentials separate where practical.
Human review A chance to catch consequential actions before they take effect. Reviewers need enough context and authority to make a meaningful decision; review does not correct indiscriminately broad access.

Compare designs on host and tenant isolation, path-level read/write rules, outbound network behavior, tool authorization granularity, credential exposure, persistence and cleanup, subprocess coverage, auditability, recovery, and operational effort. No single architecture fits every workload.

Implementation checklist

  1. Define the task and threat: name sensitive data, prohibited actions, required capabilities, and whether workloads must be isolated from one another.
  2. Choose an execution boundary: keep trusted orchestration and broad credentials outside model-directed execution where practical.
  3. Grant the working set: expose only task-specific files and make unnecessary paths inaccessible; use read-only access when writes are not needed.
  4. Restrict egress: deny outbound access by default when feasible, then permit the destinations required by the task at a boundary the agent cannot rewrite.
  5. Broker credentials: keep secrets out of prompts and files; issue only narrowly scoped credentials or proxy access, and plan revocation.
  6. Scope tools and approval: authorize specific resources and operations, and require informed review for actions with significant or irreversible effects.
  7. Exercise denials: test out-of-scope reads and writes, unapproved network access, cross-user access, subprocess behavior, and unauthorized tool calls.
  8. Observe and recover: record relevant authorization decisions, limit sensitive log content, and define cleanup and recovery procedures.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.