VS Code 1.140 Agent Host Guide: Manage Copilot, Codex, and Remote Sessions
Visual Studio Code 1.140 moves AI coding beyond a chat panel and toward an environment for managing long-running work. The central change is the Agent Host, a dedicated process that owns agent sessions while the editor and Agents window act as clients that display and control them. This architecture gives Copilot, Claude, and Codex sessions a more consistent management surface and lets you choose where each task runs: a local folder, a Git worktree, a Dev Container, or a connected remote host.
The new architecture does not make every task safe automatically. A worktree separates code changes but is not a security sandbox. Remote delegation does not copy your repository to another machine. Scheduled automations still need the relevant machine and Agent Host or VS Code process to remain available. This guide explains the setup, practical workflows, limits, and checks that matter before you delegate unattended work.
The key decisions at a glance
| Control | What it decides | A sensible starting point |
|---|---|---|
| Session Target | Which harness runs the session, such as Copilot, Claude, Codex, or Local | Copilot for general coding; Claude or Codex for provider-specific workflows |
| Workspace | Where commands and file changes happen | Folder for a small guided task; New Worktree for isolated changes |
| Execution environment | Whether tools run locally, in a container, or on an SSH/tunnel host | Dev Container when the project has complex dependencies |
| Permissions | Which commands, edits, and other actions require approval | Manual permissions for the first run |

What the Agent Host changes
The Agent Host is separate from the VS Code extension host. It owns state for sessions, chats, terminals, and changesets, then synchronizes that state with connected clients. A supported session can therefore appear in multiple VS Code windows, and you can close one window and later reconnect from another while the Agent Host remains running.
On a remote system, the Agent Host runs near the source code and development tools. Your local Agents window remains the user interface. Communication uses the Agent Host Protocol, or AHP. Local connections use a message port, while remote connections use AHP JSON-RPC over WebSocket.
It is important to separate the agent harness from the execution environment. A harness coordinates the model, tool calls, context, and code changes. The execution environment is where commands and edits actually happen. You might use the Codex harness against a local folder, or the Copilot harness inside a Dev Container on a remote machine. A Dev Container changes the environment, not the harness.
VS Code’s official guidance is to start with Copilot for a general coding task, use Local when you need built-in or extension-provided VS Code tools, choose Claude or Codex for their provider-specific capabilities, and use Cloud for a well-scoped GitHub task that can return a pull request independently.
Set up your first Agent Host session
1. Update to VS Code 1.140
This guide is based on Stable 1.140, released September 30, 2026. Run Check for Updates and verify the installed version. Organizations can require a minimum VS Code version for AI features; when they do, Chat and the Agents window can show both the installed and required versions.
2. Open the Agents window
Use the Open in Agents title-bar button, run Chat: Open Agents window from the Command Palette, or enter code --agents in a terminal. The Agents window is designed for assigning work and tracking sessions across projects. The editor Chat view is often better when you need to inspect the current code while conversing.
3. Choose the harness and workspace separately
Select a Session Target, then choose the workspace. Use Folder when the task must see current uncommitted changes or when you want manual approval prompts. Choose New Worktree to keep an implementation separate from your active checkout. However, the official documentation notes that worktree sessions use Allow all, and a worktree is not a security boundary. It isolates Git changes, not credentials, networks, or every host file.
4. Use a Dev Container for project-specific tooling
If the project depends on a particular Node.js, Python, database, or system-tool setup, select Use Dev Container from the folder menu. The Agent Host and workspace commands then run inside the container. Remote Dev Containers are supported on SSH, Tunnel, and WSL hosts when Docker is running and the repository has a Dev Container configuration.
5. Start with a verifiable request
A request should define the scope, prohibited actions, evidence, and expected output. For example:
Review the authentication flow and identify likely failure points.
Do not modify files.
Locate the relevant tests and logs, and report only evidence-backed findings.
Finish with candidate files to change and commands that would verify a fix.
A read-only investigation before an implementation session reduces unnecessary edits and makes later approvals easier to evaluate.

Workflow 1: coordinate a change across two repositories
Use the experimental multi-folder sessions feature when a frontend and API repository must change together. The main chat can update an API schema, while a peer chat updates client types and the interface in another folder. Each chat uses its own folder for the terminal, tasks, changes, pull request, and Agent merge state, reducing the risk of mixing separate checkouts.
The settings are not displayed in the Settings editor. Enable the appropriate key in user-scoped settings.json:
- Copilot:
chat.agentHost.copilotAgent.multiRootEnabled - Claude:
chat.agentHost.claudeAgent.multiRootEnabled - Codex:
chat.agentHost.codexAgent.multiRootEnabled
New sessions pick up the setting without an Agent Host restart. There is currently no UI for choosing the folder of a peer chat, so state the repository or worktree explicitly in the prompt. For example, ask the main chat to create a peer chat in a new worktree for the second repository and limit it to client-type changes.
Completion check: inspect the folder, branch, and pull request shown for each chat. Run each repository’s tests independently, then review the cross-repository contract before merging.
Workflow 2: delegate a heavy check to a remote Linux host
A connected SSH machine or authenticated dev tunnel is useful when a laptop is slow, the task needs another operating system, or a project depends on remote resources. The remote machine must be powered on and reachable. The Agents window installs and starts the VS Code CLI on that host automatically, and commands execute where the remote Agent Host and workspace live.
VS Code 1.140’s experimental remote delegation requires chat.remoteAgentHostsEnabled and chat.remoteSessions.tools.enabled. The coordinating agent can then use list_agent_hosts to inspect hosts and resource capacity, create_remote_session to select a host by operating system, memory, CPU, and optional model, get_remote_session to check progress, and send_remote_message to report back.
Remote delegation does not clone or copy the coordinating workspace. Repository work needs an existing trusted folder on the target host, optionally in a new Git worktree. The coordinating Agents window must remain open and connected for inter-session messages. A remote session’s final answer is not forwarded automatically, so instruct it to use send_remote_message.
Completion check: verify the selected host, folder, and worktree in the approval request. Compare reported versions and test results with the underlying logs. Never expose an anonymous dev tunnel, especially when an automatic approval mode is active.
Workflow 3: schedule a daily repository summary
Automations run a saved prompt with a session configuration and schedule. On Stable, the feature is rolling out gradually and chat.automations.enabled may be off by default. Create the automation with a Manual schedule first, run it on demand, review its History entry, and only then change it to Daily or Weekly.
A low-risk example is a read-only prompt that summarizes commits from the last 24 hours, groups them into features, fixes, and maintenance, and flags changes that may need documentation. Configure the name, prompt, workspace or No workspace, harness, model, permissions, and isolation. Because an automation can read files, run commands, and potentially edit files according to its permission level, review that level before enabling unattended execution.
Local automations are not equivalent to a cloud scheduler. Agent Host-backed schedules need a running Agent Host process, while other schedules require an open VS Code window. The machine must stay awake. A missed time can result in a catch-up run after an interruption, but you should not assume that every missed occurrence will replay. One automation runs only one session at a time.
Permission, cost, and security boundaries
- A worktree is not a sandbox. It separates the working directory and branch but does not automatically restrict credentials, network access, or unrelated host files.
- A Dev Container is only as isolated as its configuration. Mounting host sockets, home directories, or broad secret stores can weaken the boundary.
- Dev tunnels must require authentication. An anonymous tunnel combined with permissive approvals can let an unauthorized person trigger AI-assisted command execution.
- Authentication and billing differ by harness. GitHub Copilot plans, a ChatGPT-backed Codex sign-in, Claude API credentials, and organization policies are separate. Confirm the provider and model before starting.
- Extension tools are context-dependent. Some tools supplied by extensions are available only in an editor-window chat where the extension is running.
- MCP configuration locations matter. Agent Host reads workspace
.mcp.jsonand user-level~/.copilot/mcp-config.json. VS Code can forward servers from.vscode/mcp.json, but servers that require interactive input variables may not be forwarded.
If you also need to restrict what the standalone GitHub Copilot app can access locally, see Stackfinch’s GitHub Copilot App local sandboxing guide. Agent Host session architecture and local sandbox policies protect different layers.
Troubleshooting
The harness you want is missing
Check the relevant GitHub, ChatGPT, or provider authentication. The experimental signed-out Codex path requires its setting to be enabled and a ChatGPT sign-in from the Agents window account menu. If multiple providers expose a model with the same name, verify the provider label in the model picker.
Multi-folder sessions do not work in an existing session
The setting applies to new sessions. Create a new session and explicitly name the folder or worktree that a peer chat should use.
A remote host does not appear
Verify SSH access or the dev tunnel’s running and authentication state. A powered-on machine still must be reachable over the network. In the browser Agents window, check whether the host is marked Online or Offline.
A scheduled automation did not run
Check chat.automations.enabled, the automation’s Enabled state, the local time zone, whether Agent Host or VS Code was running, and whether the machine was asleep. Open History and inspect failures or pending approvals before retrying.
Parallel work produces broad or conflicting changes
Separate related work from independent deliverables. Use a peer chat for research or review that supports the same outcome. Use an independent session for a separate deliverable. When parallel attempts edit files, place each in a new worktree and compare diffs, tests, diagnostics, and build output before choosing a result.
Bottom line
VS Code 1.140’s most important improvement is not a single model feature. It is the ability to decide separately which harness runs a task, where it runs, how its code changes are isolated, and which actions need approval. A practical progression is to begin with a small Folder task and Manual permissions, move to New Worktree when changes need separation, use a Dev Container for controlled dependencies, and connect an authenticated remote host only when you need its resources.
Experimental multi-folder sessions and remote delegation are powerful, but they do not automatically choose folders, copy repositories, or forward every result. Automations should also pass a manual test run before you enable a schedule. The Agent Host is best understood as infrastructure for making responsibility boundaries visible, not as a way to remove human review.
Official sources
- Visual Studio Code 1.140 Release Notes
- VS Code Agent Host Architecture
- Choose an Agent Harness
- Remote Agent Sessions
- Create and Manage Agent Automations
Sources checked October 2, 2026. Preview and experimental features can change or roll out gradually, so confirm the documentation for your installed VS Code version.
Comments
Post a Comment