Text of code.visualstudio.com › docs › agents › run › agent-sandboxing as Styx crawled it on Oct 10, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Sandbox Copilot Agent Host sessions

AI agents: See llms.txt for documentation discovery and navigation. Documentation articles are also available as Markdown by appending .md to the article URL. 🎬 Watch The Story of VS Code! VS Code is now on Instagram, follow @vscode.ig for updates, tips, and more. Rewatch GitHub Copilot Day. Sandbox Copilot Agent Host sessions View as Markdown Ask in VS Code Ask in VS Code Insiders Copilot Agent Host sessions can run terminal commands and start language or tool servers on your local machine or a connected remote host.

Agent sandboxing confines these processes to the file system and network access that you configure on the execution host. Use this article to understand the security boundary, turn on sandboxing, grant the minimum required access, and inspect the effective policy for a session. The settings and behavior below apply to the Agent Host's default Copilot SDK tool implementation, not the Local chat harness or the custom terminal tool override.

Understand the sandbox boundary Sandboxing and approvals provide separate layers of protection: Protection Purpose Approvals Determine whether an action runs automatically or requires your confirmation. Sandboxing Restricts the file system and network resources that supported agent operations can access. Sandboxing applies to terminal commands and their child processes. When configured, it also applies to MCP and language servers that the Agent Host launches or manages.

Built-in tools that don't start operating system processes use their own permission checks. Sandboxing is not a virtual machine or user-account boundary, and it does not replace endpoint security. A sandboxed process still runs on the execution host under your account. Network access, extra paths, credentials, developer tool access, and permission to run outside the sandbox all weaken isolation. Grant only the access that a task requires.

Depending on the operation and platform, restrictions use operating system protections or checks within the agent host process. Sandboxing does not replace the isolation provided by cloud sessions or Dev Containers. MCP server sandboxing outside the Agent Host is a separate feature with its own configuration and platform support. For the security model and threats that sandboxing helps mitigate, see Trust and safety .

Important Turning on sandboxing does not block outbound network access by default. chat.agent.sandbox.network.allowNetwork Open in VS Code Open in VS Code Insiders defaults to true . Configured allowed and denied network domains still restrict destinations. Configure network access separately if you need to restrict outbound connections. Check platform availability Agent Host sandboxing has the following platform prerequisites.

Check the operating system where the agent runs. For a remote Agent Host, install dependencies and operating system updates on the remote host, not the client machine. Platform Prerequisite macOS None. Linux and WSL2 Install bubblewrap and socat . Windows Install the applicable September 8, 2026 Windows security update. On Debian and Ubuntu, install the Linux dependencies: sudo apt-get install bubblewrap socat On Fedora, install the Linux dependencies: sudo dnf install bubblewrap socat WSL version 1 is not supported because it does not provide the Linux kernel features that bubblewrap requires.

On Windows, install the update that applies to your Windows version: Windows 11 24H2 or 25H2: KB5124008 . Windows 11 26H1: KB5124012 . Note Windows support is Experimental. The separate MCP server sandboxing feature outside the Agent Host is not available on Windows. Turn on sandboxing on the execution host The chat.agent.sandbox.enabled Open in VS Code Open in VS Code Insiders setting controls Agent Host sandboxing on all platforms.

It accepts off or on and defaults to off . For a local Agent Host, the execution host is your local machine. For a connected remote Agent Host, its platform determines the sandbox implementation and prerequisites. Settings are resolved on that host, and all configured paths refer to its file system, not the client machine. Note Legacy sandbox device policies are deprecated for Agent Host enforcement. Administrators should use Copilot managed settings to require sandboxing.

Meet the platform prerequisites on the execution host. Set chat.agent.sandbox.enabled Open in VS Code Open in VS Code Insiders to on in the settings for that host. Start a new Agent Host session. Inspect the effective sandbox policy to verify the session's restrictions. To enable sandboxing in your settings JSON: { "chat.agent.sandbox.enabled" : "on" } If an operating system dependency is unavailable, the Agent Host does not silently run the command without the sandbox.

Follow the notification to install the missing dependency. Control sandboxing for the current session In an Agent Host session, open Permissions and select Sandboxing for terminal to change sandboxing for that session. This control does not update User or Workspace settings, change other sessions, or set the default for new sessions. A new session inherits the effective configuration of its execution host. An explicit session selection persists when you restore the session unless an organization-managed restriction overrides it.

Sandboxing is independent of the selected permission level . For example, the sandbox continues to restrict processes when you select Allow all . Configure sandboxing for an Agent Host session Copilot Agent Host sessions are available in both the Agents window and an editor window. They use the Copilot SDK built-in shell by default. You do not need to change terminal implementations to use sandboxing. For a remote Agent Host, use the session toggle to change the current session's sandbox state.

Defaults for new sessions come from the connected host's sandbox configuration, not from the client machine's settings. Agent Host sandbox settings The following settings configure the Agent Host sandbox. Shared setting names do not imply that other chat harnesses use the same behavior. Setting Default Purpose chat.agent.sandbox.enabled Open in VS Code Open in VS Code Insiders off Enable sandboxing on all supported platforms. chat.agent.sandbox.network.allowNetwork Open in VS Code Open in VS Code Insiders true Permit outbound network access, subject to configured hostname restrictions. chat.agent.sandbox.network.allowLocalNetwork Open in VS Code Open in VS Code Insiders false Permit access to hosts on the local network. chat.agent.sandbox.network.allowedDomains Open in VS Code Open in VS Code Insiders [] Configure allowed network destinations. chat.agent.sandbox.network.deniedDomains Open in VS Code Open in VS Code Insiders [] Configure blocked network destinations. chat.agent.sandbox.fileSystem.userConfiguredPaths Open in VS Code Open in VS Code Insiders Empty path lists Customize read and write, read-only, and denied paths. chat.agent.sandbox.fileSystem.allowDevToolAccess Open in VS Code Open in VS Code Insiders true Grant access to common developer tools, configuration, and caches. chat.agent.sandbox.mcpServers Open in VS Code Open in VS Code Insiders true Run locally launched MCP servers in the sandbox when sandboxing is enabled. chat.agent.sandbox.lspServers Open in VS Code Open in VS Code Insiders true Run language servers in the sandbox when sandboxing is enabled. chat.agent.sandbox.credentials.authenticategit Open in VS Code Open in VS Code Insiders true Use your credentials for HTTPS Git operations inside the sandbox. chat.agent.sandbox.credentials.authenticategh Open in VS Code Open in VS Code Insiders true Use your GitHub account for gh commands inside the sandbox. chat.agent.sandbox.allowUnsandboxedCommands Open in VS Code Open in VS Code Insiders true Permit requests to run outside the sandbox after confirmation.

Inspect the effective sandbox policy The /sandbox policy slash command is available only in Agent Host sessions. Run it to verify whether sandboxing is active or invest

The rest of this page is on the live site.