What happens when an AI agent can run commands on your machine but you have no idea what it just touched? That question drives every VS Code Copilot agent sandbox setup conversation in 2026. Developers want the productivity of an autonomous coding assistant without handing it the keys to their entire filesystem. Tooling has matured enough to make that trade-off manageable. But “sandbox” means at least three different things depending on who is talking, and mixing them up is the fastest way to a broken setup.
This guide walks through what isolation actually looks like in practice, where the terminology trips people up, and how to build a setup that keeps an agent useful without letting it wander. It sticks to what can be verified and flags the rest honestly.
Why “Sandbox” Is a Loaded Word in 2026
Before touching a single setting, it helps to understand that the word sandbox gets applied to very different isolation mechanisms. As of early 2025, GitHub Copilot in VS Code gained an agent mode that can plan multi-step tasks and run terminal commands. A separate coding agent runs inside GitHub Actions with its own ephemeral environment. Those are not the same thing, and neither is a dev container or VS Code’s workspace trust feature.
The confusion is not academic. A developer who assumes agent mode is fully sandboxed by default may be surprised to learn that it operates with the permissions of the VS Code process. Meanwhile, someone who sets up a dev container expecting it to govern the cloud-based coding agent will find the two do not talk to each other the way they hoped.
The honest position: whether VS Code itself exposes a dedicated, documented “sandbox” configuration surface, and what exactly it is called, cannot be confirmed from memory. Anyone claiming a specific setting name without pointing to the VS Code release notes or GitHub Docs is guessing. The reliable move is to treat the monthly, dated VS Code release notes as the source of truth for when a feature appeared, and the GitHub Docs pages on agent mode and the coding agent as the source of truth for what it does. (GitHub Copilot documentation)
The Three Isolation Layers You Need to Separate
Practical setups almost always combine layers. Understanding which layer does what prevents the most common mistakes.
| Layer | What it isolates | Where it runs | Best for |
|---|---|---|---|
| Agent mode (local) | Nothing by default; inherits editor process permissions | Your machine | Fast iteration with supervision |
| Dev container | Filesystem, dependencies, toolchain | Local container | Reproducible project environments |
| Coding agent | Full task execution | GitHub Actions (ephemeral) | Delegated, off-machine work |
| Workspace trust | Restricts automatic execution in untrusted folders | Your machine | Opening unfamiliar repos safely |
The takeaway from that table is simple: if you want a hard boundary around a locally running agent, the dev container is your workhorse. If you want the agent to work somewhere other than your laptop entirely, the coding agent on GitHub Actions is the answer. Agent mode on its own is a convenience, not a fence.
For teams already comfortable with container-based workflows, the discipline carries over cleanly. The same mindset that makes multiplayer backend provisioning predictable, as covered in this walkthrough on PlayFab multiplayer servers setup 2026, applies here: define the environment once, then let automation run inside it.
A Step-by-Step Setup That Holds Up
Here is a sequence that works in practice. It assumes VS Code is current and the Copilot extension is installed. Each step is deliberately small so problems surface early.
- Confirm your VS Code version. Open the release notes for the current month and check whether agent-related settings have changed. Settings names shift between releases, and building on stale documentation wastes hours.
- Enable workspace trust deliberately. Decide whether the folder you are working in is trusted. Untrusted folders restrict automatic execution, which is exactly what you want for code you did not write.
- Create a dev container for the project. A `.devcontainer` configuration pins the toolchain and gives the agent a filesystem boundary. This is the single highest-value step for anyone serious about isolation.
- Install and configure the Copilot extension inside the container. The agent should see the container’s tools, not your host’s.
- Limit what the container can reach. Mount only the project folder. Do not mount your home directory, SSH keys, or cloud credentials.
- Test with a harmless command first. Ask the agent to list files or print a version number. Watch what it does before trusting it with anything that writes.
- Review terminal command approvals. Agent mode asks for confirmation on commands depending on your settings. Keep those prompts on until you have a feel for the agent’s behavior.
- Document the setup for your team. A short README beats tribal knowledge every time.
That eighth step is the one people skip and later regret. A container configuration that lives only in one developer’s head is a future outage.
Common Mistakes People Make
The errors repeat across teams. Watch for these:
- Assuming agent mode is sandboxed. It is not, by default. It runs with your permissions.
- Mounting the whole home directory “just to be safe.” This defeats the purpose of the container entirely.
- Confusing the coding agent with agent mode. They run in different places and are configured differently.
- Skipping workspace trust. Opening a random repo with trust enabled hands the agent more reach than intended.
- Chasing setting names from blog posts. Release notes are dated and authoritative; screenshots in tutorials are not.
- Forgetting that credentials leak. Environment variables with API tokens inside a container are still tokens. Rotate them.
If you have configured other tooling recently, the pattern will feel familiar. The care you take with an Mistral large 4 API setup 2026 applies here too: secrets management is not optional, and defaults are rarely safe.
Where the Coding Agent Fits
The coding agent deserves its own section because it solves a different problem. It runs in GitHub Actions, which means it executes in an ephemeral environment that is discarded afterward. You are not sandboxing your laptop; you are handing the task to a machine that exists for a few minutes and then vanishes.
That is a genuinely different security posture, and it is worth understanding before you delegate. The trade-off is latency and control: you get isolation, but you give up the immediate back-and-forth of agent mode. Teams that delegate well tend to reserve the coding agent for well-scoped tasks with clear acceptance criteria, and keep agent mode for exploratory work where a human is watching.
The enterprise angle matters too. Organizations evaluating agent tooling increasingly weigh isolation and auditability as heavily as raw capability, a theme that runs through coverage of OpenAI, Dots, Meta Muse, and enterprise agent 2026 developments. The pattern is consistent: the agent that ships is the one whose blast radius is understood.
Practical Tips From the Field
A few habits separate setups that work from setups that generate tickets.
Start restrictive, loosen later. It is far easier to grant a permission the agent needs than to discover after the fact that it deleted something. Begin with the narrowest container mount and the strictest command approvals, then relax as trust builds.
Keep the container definition in version control. A `.devcontainer` file that lives in the repo is reviewable, diffable, and reproducible. One that lives on a laptop is not.
Watch the release notes monthly. VS Code ships on a predictable cadence, and agent-related changes land there first. Reading the dated notes takes ten minutes and prevents a week of confusion. Treat any undated tutorial with suspicion.
Test the boundary by trying what should fail. Ask the agent to do something it should not be able to do, like reading a file outside the mounted folder. If it succeeds, your boundary is not real.
Separate credentials from the agent’s reach. Use short-lived tokens. Rotate them. Never bake them into the container image. This is the same discipline that keeps emulator and tooling setups clean, as the careful sequencing in this RetroArch cheats PC setup 13 steps 2026 guide demonstrates: small, ordered, verifiable steps beat one big leap.
Pair the agent with a well-configured editor. Extensions that help the agent understand context also help you review its output. A tidy editor configuration, like the one described in this VS Code extensions Cursor setup 2026 guide, reduces the noise the agent has to sift through.
A Note on Verification
It is worth being blunt about one thing. Much of what circulates online about agent sandboxing is written with confidence and backed by nothing. The responsible approach is to check primary sources: the dated VS Code release notes and the GitHub Docs pages on agent mode and the coding agent. If a claim about a specific setting cannot be traced to one of those, treat it as unverified. That single habit will save more time than any configuration trick.
Conclusion
The VS Code Copilot agent sandbox setup challenge in 2026 is less about finding a magic toggle and more about layering the right isolation for the right job. Agent mode is a fast, local assistant that inherits your permissions. A dev container gives you a real filesystem boundary. The coding agent moves execution to an ephemeral GitHub Actions environment. Workspace trust guards the moment you open unfamiliar code.
Get those four straight, keep your container definition in version control, start restrictive, and read the dated release notes instead of undated tutorials. Do that, and the agent becomes a tool you control rather than a process you hope behaves. The developers who get the most out of these agents are not the ones with the cleverest settings. They are the ones who understood the blast radius before they pressed go.
Frequently Asked Questions
Is agent mode sandboxed by default in VS Code?
No. Agent mode runs with the permissions of the VS Code process, which generally means your user account. That is why a dev container or workspace trust matters. If you want a hard boundary around a locally running agent, you have to build it deliberately rather than assume it exists.
What is the difference between agent mode and the coding agent?
Agent mode runs locally inside VS Code and interacts with your files and terminal in real time. The coding agent runs in GitHub Actions in an ephemeral environment, so it executes elsewhere and reports back. They are configured differently and solve different problems. Confusing the two is one of the most common setup mistakes.
Does a dev container actually sandbox the Copilot agent?

It creates a meaningful filesystem and toolchain boundary, provided you mount only the project folder and avoid mounting your home directory or credentials. It is not a perfect security boundary against every possible attack, but it dramatically reduces the blast radius compared with running the agent on your host machine.
Where can I find authoritative information on sandbox-related settings?
The dated monthly VS Code release notes and the GitHub Docs pages on agent mode and the coding agent are the reliable sources. Settings names change between releases, so undated blog posts and screenshots are risky. Check the release notes for the month you are working in before trusting any configuration advice.
Should I keep command approval prompts turned on?
Yes, at least until you have watched the agent work and understand its behavior. Approval prompts are your chance to catch a command that would have done something unintended. Once you trust the setup and the container boundary is solid, you can relax them selectively.
How do I test whether my sandbox boundary is real?
Ask the agent to do something it should not be able to do, such as reading a file outside the mounted project folder or accessing a credential. If it succeeds, the boundary is not working. Testing the failure path is the only way to know your isolation holds; the happy path is not enough.


