Safeguard
AI Security•

Local or remote sandbox for an AI agent: a decision guide

Choose a local or remote sandbox for an AI agent by weighing data location, secrets, network reach, cost and control. A simple decision guide with a table.

Safeguard Security Team
6 min read

Choose a local sandbox when the work needs your files and tools and the data must stay on the device. Choose a remote sandbox when you want isolation from endpoints, central control and tasks that run while devices are off. Many teams use both, split by data sensitivity and task type.

The core trade

A local sandbox keeps work on a machine you manage. A remote sandbox moves it to the vendor's infrastructure. Both can be well or badly built. The decision comes down to where the data and the trust should sit.

Comparison

FactorLocal sandboxRemote sandbox
Data locationYour deviceVendor cloud
Access to local files and toolsDirectVia upload or connectors
Runs when device is offNoYes
Isolation qualityDepends on the endpoint and settingsDepends on vendor design
Central visibilityNeeds endpoint toolingUsually in a console
Secrets exposureOn the machineIn the vendor's environment
Scale for many tasksLimited by the deviceElastic
CleanupPer machineVendor controlled

Decide by task, not by product

Run each task type through four questions.

  1. How sensitive is the data the agent reads? Regulated or confidential data tilts toward the place you can already justify in your own risk assessment. Sometimes that is local. Sometimes a vendor environment with strong contracts is easier to defend than hundreds of laptops.
  2. Does the task handle untrusted input? Public issues, inbound email and third party documents are handled safest in a fresh, disposable, restricted environment, which a remote sandbox often provides more consistently.
  3. Does it need local context? Large local codebases, private tools, or hardware dependent tests favor local.
  4. Must it run unattended? Scheduled or long running work favors remote, since devices sleep.

Typical splits

TaskCommon choice
Interactive coding in a trusted repoLocal, with scoped folder
Reviewing untrusted pull requests or issuesRemote or isolated disposable environment
Nightly reportsRemote with alerting
Work on regulated dataPer your risk assessment, documented
Experiments with new toolsRemote throwaway

What does not change

Whichever you choose, apply the same access principles. OWASP recommends minimizing extensions, their functionality and permissions, avoiding open ended extensions, executing in the user's context and requiring approval for high impact actions. A sandbox boundary does not replace these. And in both cases, control the network: an agent that can reach anything can send anything anywhere.

Cost and effort

Local setups cost endpoint management effort. Remote setups cost usage and vendor management effort. Ask vendors how remote usage is metered and whether it can be capped, then set a budget alert once you know your volumes. For local setups, count the hours your platform team will spend on settings, updates and support.

Write the decision down

Record, per task type, the choice, the reason, the data class and the owner. When the vendor changes a default or you change a policy, you will have a baseline to revisit. See also local or hosted coding agents: where does your code run.

Safeguard's compliance and evidence automation can keep those decision records with your other control documentation.

A worked example: three tasks, three answers

A company runs three agent tasks and applies the four questions.

Task A: refactor a function in a trusted internal repository. Data is internal, input is trusted, it needs local tools and runs while the developer watches. Choice: local sandbox, with scoped folders and approval on commands.

Task B: triage new public issues on an open source project the company maintains. Input is untrusted, the content comes from strangers, and the task can run unattended. Choice: remote sandbox, fresh per task, restricted network, a token that can only comment.

Task C: summarize customer contracts for the legal team. Data is confidential and may contain personal data. The question is where it is easier to defend processing. Choice: decided by the legal and security teams after reviewing the vendor's terms and the endpoint controls, and documented either way.

The point is not that one answer wins. Each choice follows from data, input trust, context needs and timing, and each is written down with an owner.

Step by step: make the decision for a new task

  1. Name the task and its owner.
  2. Classify the data it reads and writes.
  3. Classify its input as trusted, mixed or untrusted.
  4. Decide whether it needs local files or tools.
  5. Decide whether it must run unattended.
  6. Pick local or remote using the table above.
  7. Write the controls: folders, commands, network, token scope, state.
  8. Set a review date.

Controls that apply to both

ControlLocalRemote
Narrow token scopeYesYes
Network allowlistVia endpoint toolingVendor setting
Approval for risky actionsApp settingPlatform setting
LogsEndpoint collectionVendor export
Wipe or teardownPer devicePer environment

Mixed setups

Some products let a local agent hand tasks to a remote one. Treat that handoff as a boundary: what data crosses it, under what identity, and with what approval. A mixed setup can combine the strengths of each, but it also doubles the questions.

Revisit on triggers

Review the decision when the vendor changes defaults, the data class changes, a near miss occurs, or a new regulation or contract term affects where data may be processed.

Try it yourself

Click through it at your own pace, or open it full screen. See how a gate stops a change until a rule passes, the same idea as an approval step around an agent.

Quick check

Can we use both local and remote sandboxes?

Yes, and many teams do. Split by data sensitivity, input trust and whether the task must run unattended.

Which is safer for untrusted input?

A fresh, restricted, disposable environment, which is often easier to guarantee remotely. Verify the vendor's isolation and network controls first.

Can we change the choice later?

Yes. Record the reason for each choice and the review triggers, so changing it is a documented decision rather than a surprise.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.