Use the Agents window

The Agents window provides an agent-first interface in Visual Studio Code for delegating and coordinating tasks across projects. Run independent tasks in parallel, monitor their progress, and review results in one place. Use chat in the editor when you want to collaborate with an agent alongside the code you're editing or debugging.

This guide follows the workflow from choosing where an agent makes changes to monitoring, validating, and integrating its work. Start with one task, then add independent tasks as needed. If you're new to agent-assisted coding, first complete the agents quickstart.

Open the Agents window

Select Open in Agents in the VS Code title bar, or run Chat: Open Agents window from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)). The window opens alongside your main editor window.

If you're already signed in to GitHub in VS Code, you'll also be signed in when the Agents window opens. From the command line, use code --agents.

Agents window interface overview

The Agents window separates managing work across projects from working on an individual task. Use the Primary Side Bar to organize sessions and access automations and customizations, the central session area to collaborate with agents, and the Secondary Side Bar to inspect and validate the active session's work.

Area What you use it for
Primary Side Bar Start and switch between sessions across projects. Open Automations to manage automated tasks, or Customizations to configure your agents and workflows.
Session area Send prompts, answer questions, review responses, and direct the agent. Arrange multiple sessions side by side to monitor parallel work.
Secondary Side Bar Use Files to browse the workspace, Changes to review edits, Search to find code, and Browser to inspect an application. Canvases, when available, provide interactive content from the agent.

The available tools depend on the session and enabled features.

Screenshot showing the Agents window interface, with the sessions list, customizations action, chat area, changes panel, and files panel numbered.

Understand the active session

Selecting a session makes it the active session and determines which project and conversation the session tools apply to. When several session panes are visible, select a pane to make it active. The active session is highlighted in the sessions list.

Before you send feedback or run a command, confirm which session is active. Terminal commands and tasks run in that session's folder or worktree, and browser tabs belong to the session where you open them.

Quick chats have no project workspace, so they don't show workspace-specific files and changes.

Start an agent session

Choose a task with a clear outcome and checks you can run to verify it. The following steps start a session in a local project. For other environments or tasks without a project, see Other ways to start a session.

Screenshot showing the new session input with environment, workspace, and context controls.

  1. Select New Session at the top of the sidebar or press ⌘N (Windows, Linux Ctrl+N). To start directly in a specific workspace, hover over the workspace in the sessions list and select + (New Session).

  2. Select This Computer from the environment picker above the input. In the workspace picker, select a recent folder or Open Folder.

    If the workspace isn't trusted, review the Workspace Trust prompt before you continue.

  3. For a Git repository, choose Branch to work in your current folder or New Worktree to keep changes separate. Review the isolation choices and requirements before you send the prompt.

  4. Review the permission level in the input toolbar. It controls which actions need your approval and is separate from file isolation. Learn about permission levels.

  5. Describe the outcome you want, any constraints, and how the agent should check its work. Press Enter to submit the prompt.

    For additional context, select Add Context (+). If prompted, select a repository first. Pasting an issue or pull request URL into the prompt also adds it as a context attachment.

    You can optionally change the agent harness, agent, or model.

Tip

To start a session in the background without navigating into it, press Alt+Enter or hold Alt and select Send. Focus stays in the composer so you can start another task. Select Open Session in the confirmation to open the sent conversation. With Inbox grouping selected, you can also press Ctrl+Enter (Cmd+Enter on macOS).

Choose where an agent makes changes

For a Git workspace, use the isolation dropdown above the input to choose where the agent edits files:

  • Branch: Work directly in the selected folder. If you choose another local branch, switching branches requires a clean working tree.
  • New Worktree: Work in a separate directory and branch. Use the branch picker to choose the base branch before sending the prompt. Choosing a base branch doesn't switch the branch in your active workspace.

Screenshot showing the isolation dropdown with Branch and New Worktree options above the input.

For the folder-versus-worktree comparison, Git requirements, and dependency setup, see Work with agents in worktrees. To change the initial choice, configure isolation defaults.

Dev Container sessions work directly in the container workspace and don't support New Worktree. See Work with agents in Dev Containers.

Important

Worktrees isolate working files, not the agent's access to your machine or external services. Review the permission and sandboxing considerations before starting a task.

Save and resume drafts

Prepare requests for several tasks and return to them when you're ready to send them. In the Agents window, drafts save unsent New Session requests without starting an agent session.

  1. Open Settings (⌘, (Windows, Linux Ctrl+,)) and enable sessions.drafts.enabled Open in VS Code Open in VS Code Insiders . The setting is off by default.

  2. Select New Session and compose a request, including any context attachments and session options.

  3. Navigate to another conversation. When the new-session input is no longer visible, the request is saved in Drafts in the sidebar.

  4. Select Resume Draft beside a saved draft, or Open Draft in the notification. Review or edit the request, then send it when you're ready.

Each draft keeps its text, attachments, inline references, workspace, agent, model, and configuration. Saved drafts remain available after restarting the window. To save a new draft, navigate away from the input first. Restarting alone doesn't add it to Drafts.

The draft is removed from the list after the request is accepted. To discard one without sending it, select Delete Draft.

Turning off sessions.drafts.enabled Open in VS Code Open in VS Code Insiders hides saved drafts and stops saving new ones, but doesn't delete them. Turn it back on to access them again.

To schedule a one-time request for a later time instead of sending it immediately, see Send a request later Send Later in the Agents window is experimental and might change or be removed. .

Work with multiple sessions

You can run multiple agent sessions in parallel, either in the same project or across different projects. Each session has its own conversation and task context, so you can delegate independent work and review one result while another session continues. For example, one session can implement a feature in one project while another investigates a bug in a different project.

Use separate sessions for independent tasks you want to track and review separately. For related conversations you want to keep together, work with multiple chats in a session.

To add another task, select New Session, choose its project, and submit a prompt. You don't need to wait for the other sessions to finish. Switch between them in the sessions list to check progress, answer questions, or give feedback. Sessions can run in parallel without being displayed side by side. To keep several conversations visible together or move a chat to another display, arrange sessions in a grid or open chats in separate windows.

For parallel changes in the same repository, use separate worktrees to keep edits apart. Separate sessions or chats don't automatically isolate files: those using the same folder can edit the same files. Choose tasks that can proceed independently. If one depends on another's result, complete that prerequisite first. For a walkthrough, follow Delegate two tasks without mixing their changes.

Use the sessions list to check status and change statistics. Select a session to inspect its conversation:

  • If it needs input, answer its question or review the approval request.
  • While it works, check that its changes stay within the task's scope. Send corrections to that session, not another task's conversation.
  • When it finishes, review and validate the result. A completed response isn't proof that the task is correct.

Confirm the active session before sending feedback or running commands. For steering and stopping requests, see Use chat. To group, pin, or prioritize sessions that need attention, see Organize and triage sessions.

Review and finish an agent session

When an agent finishes a task, use the Agents window to review its changes, request revisions, and validate the result. Once the work meets your requirements, commit the changes and integrate them into your project, either locally or through a pull request.

Select the session you want to review to make its files, changes, and tools active.

For more in-depth coding or debugging, select Open in Editor to continue a supported project session in the main editor window, with the editor, debugger, and other development tools alongside the conversation.

Inspect workspace files and changes

In the Secondary Side Bar, use Files to browse the workspace or worktree and Changes to review edits. In Changes, choose Branch for the branch diff, Uncommitted for pending changes, Session for the session's edits, or Last Turn for its latest turn. Review the full relevant change, not only the latest response.

Screenshot showing the Changes panel in the Agents window, with the Files and Changes views visible.

Check that the result meets your requested outcome, preserves required behavior, and contains no unrelated edits.

To provide immediate feedback, open a file's diff, select a range, and use the feedback controls to leave range-based feedback for the agent. For detailed review and recovery controls, see Review AI-generated code edits.

Validate changes

Run the project's tests, build, and any manual checks needed to verify the requested behavior. Check the output for failures or skipped checks rather than relying only on the agent's summary.

  • Select Terminal in the session activity bar to run commands in that session's folder or worktree.

  • Use the tasks control in the application title bar to run a configured task, or define a new one.

  • For a web app, select a localhost link or open an HTML file in the integrated browser. You can also ask the agent to use browser tools, then verify the result yourself.

If a check fails, send the evidence to the same session, request a correction, and repeat the affected checks.

Commit changes

For uncommitted changes, open Changes, select Uncommitted from the changeset dropdown, and then select Commit. VS Code generates a commit message and commits all current changes in the session's Git repository, so review them first. The available Git actions depend on the session type.

Generating the commit message requires signing in to GitHub Copilot, even when the session uses another provider's credentials.

Important

The Commit action uses git commit --no-verify, which skips pre-commit and commit-msg hooks. Commits made by Create PR also skip these hooks. Run your project's required checks before using either action.

Integrate the result

Committing records the changes but doesn't necessarily put them in the branch where you need them:

  • With Branch isolation, edits are already in the selected folder. Follow your normal branch and pull request workflow.
  • With New Worktree, edits remain in the separate worktree. Integrate the reviewed branch into your target branch locally, or create a pull request. For a parallel-work example, follow Integrate and retest.

After combining changes from multiple sessions, rerun the relevant checks on the combined result. Keep the sessions available until that validation is complete, then mark finished sessions as done.

To reclaim disk space from inactive or leftover worktrees, run Chat: Open Worktree Cleanup. The shared cleanup procedure covers both windows, local and remote worktrees, and what is preserved.

Work with pull requests

Create pull requests directly from finished sessions, start sessions from existing pull requests, or monitor blockers with agent merge.

Create a pull request

If the session doesn't already have a pull request:

  1. Select Create PR in the title bar. Review the repository, source and base branches, and generated title and description. You can edit the text while generation finishes.

  2. Select Create as Draft if the changes aren't ready for review.

  3. Under After creation, choose Merge Manually to retain control of merging, or Auto-Merge to let GitHub merge when required checks and approvals pass. For auto-merge, select the merge method. Auto-merge isn't available for drafts and doesn't fix failed checks or review feedback.

    The optional Agent merge choice (Experimental) can ask the agent to address blockers. Review its configuration and safeguards before selecting it.

  4. Select Create PR. Any uncommitted changes are committed and the branch is pushed before the pull request is created.

To have the agent create the pull request instead, select Pull Request Actions > Send Create PR Message in the form. This asks the agent to generate its own title and description, rather than use the form's text, with your selected draft status and merge options.

Start a session from a pull request

For a local GitHub-backed workspace, start from an existing pull request to ask questions or continue its changes. The session includes the pull request details, changes, and comments, and uses an isolated worktree that tracks its branch.

  1. Group the sessions list by workspace.

  2. Hover over the workspace, expand the + (New Session) action, and select New Session from Pull Request.

    Screenshot showing the New Session from Pull Request action in the workspace menu.

  3. Select a pull request. The session opens with its title and shows its changes in Changes.

  4. Ask questions or request revisions. Review, validate, and commit any new changes, then select Sync Changes in the title bar to update the existing pull request branch.

Note

Pull requests from forks aren't supported and don't appear in the picker.

Finish a pull request with agent merge

Agent merge monitors a session's pull request and asks the agent to address blockers. It can address reviews, fix failed required checks, resolve conflicts or update a branch, and optionally merge the result. It requires chat.agentMerge.enabled Open in VS Code Open in VS Code Insiders and a supported session.

Note

Agent merge is unavailable while chat.artifactIntegrations.enabled Open in VS Code Open in VS Code Insiders is enabled (on by default in Insiders), regardless of chat.agentMerge.enabled Open in VS Code Open in VS Code Insiders . Saved choices are preserved if you switch back.

Caution

Agent merge starts agent turns, changes and syncs the pull request branch, and consumes model requests. Enabling it changes the session to Autopilot with Assisted permissions. Review its options before enabling automatic merging.

  1. Enable chat.agentMerge.enabled Open in VS Code Open in VS Code Insiders and open a session associated with a pull request.

  2. Select Agent merge in the title bar, and then select Enable agent merge.

  3. Review the options in its menu. You can also run Configure agent merge for Active Session from the Command Palette.

    • Blockers: select Address Reviews, Fix CI Failures, or Resolve Conflicts and Behind Branches.
    • Merge Pull Request: choose Off to leave merging to you, Only if Agent merge Made No Changes to merge only while agent merge has not changed the branch, or On to merge after the selected work and required checks and approvals.

These choices are also available when you select Agent merge in the Create PR form. For all options, see the agent merge settings.

For a draft pull request, use Mark Ready in Changes when it is ready for review. While blockers are being addressed, this action is in the action menu.

Agent merge waits for required checks and rechecks readiness before merging or adding the pull request to the merge queue. It turns off if the session starts tracking another branch or pull request.

To review the changes from the most recent agent merge repair cycle, open the Changes view and select Agent merge from the changeset dropdown. This changeset compares the latest completed agent merge repair turn with the preceding completed user turn. It remains empty after your latest message until agent merge completes another repair turn.

To stop monitoring the pull request, select Agent merge in the title bar, and then select Disable agent merge.

Remove a pull request from a session

To remove a pull request artifact without closing the pull request on GitHub, right-click its pill above the chat input and select Remove Pull Request Artifact from Session. If the pill contains multiple pull requests, open its dropdown and select the action for the relevant pull request.

A separate association, such as the one created when you start a session from a pull request, remains unchanged.

Other ways to start a session

Use these workflows when your task needs a different starting point or execution environment.

Start a quick chat

Quick chats aren't scoped to a project. Use one for a question or task that doesn't need a workspace. They appear in the Chats group at the top of the sessions list.

  1. Select + on the Chats header (⌘K ⌘N (Windows, Linux Ctrl+K Ctrl+N)) or run New Quick Chat from the Command Palette.

    Screenshot showing the quick chats group in the Agents window, with the + button highlighted.

  2. Choose an available harness, enter your prompt, and submit it.

Quick chats also support nested sessions, where available. With No Workspace selected, each nested session uses its own temporary folder.

Continue a quick chat in a workspace

If a quick chat becomes project-specific, continue it in a local workspace without losing its conversation history.

Note

This is supported for Copilot and Codex harness quick chats. For Codex, use Interactive mode. Worktree isolation requires a local Git repository with at least one commit.

  1. Ask the agent to continue in a specific local folder.
  2. Confirm the folder and choose whether to edit it directly or use a worktree.
  3. Review and approve the Set Workspace confirmation and any Workspace Trust prompt.

After setup, the chat moves to the workspace's group and the agent continues your request. For chats that already have a workspace, see Move a chat to another folder or worktree.

Run in another environment

  • Dev Containers: Run an agent inside a project's Dev Container or a standalone container on this computer or a connected host. See Work with agents in Dev Containers.
  • Remote hosts and browser access: Select SSH or Dev Tunnels from the environment picker, or connect from a browser. See Run and manage remote agent sessions.
  • Cloud compute: Start a cloud session Cloud sessions is experimental and might change or be removed. to run independently of your local machine, or select Work in Repository for a GitHub repository.
  • Provider credentials without GitHub sign-in: Configure Claude, Codex, or BYOK credentials in Manage AI providers and accounts.

Work with multiple chats in a session

For related conversations, select + (New Nested Session) on a supported session's row. Keep its folder, or choose another folder, New Worktree, or No Workspace, where supported. The nested session uses the parent's harness by default and stays on the same host.

For shared context, chat tabs, side chats, and moving conversations, see Run multiple chats in a session. To choose another harness, see mixed-harness chats Mixed-harness chats is experimental and might change or be removed. .

Compare model results

Run the same prompt with multiple models or harnesses to compare responses or isolated code changes. See Compare model results for setup, judging, and synthesis options.

Continue, automate, and configure

  • Continue in another interface: Select Open in Editor in the title bar to edit or debug alongside a supported project conversation, or select Open in Agents to return. For continuity across apps and devices, use GitHub environments GitHub environments is in preview and might change before it becomes generally available. or SSH and dev tunnels. See continue between the Chat view and Agents window for requirements.
  • Automate and schedule tasks: Enter /automate in a chat or select Automations in the sidebar to set up recurring or event-triggered tasks. For one-time deferred requests, use Send Later Send Later in the Agents window is experimental and might change or be removed. . See Create and manage agent automations.
  • Configure the window: Personalize chat, adjust grid or tab layouts, set isolation defaults, and manage extensions in Configure the Agents window. For other interaction modes, see Voice Mode Voice Mode is experimental and might change or be removed. and canvases Canvases is in preview and might change before it becomes generally available. .

Limitations

  • Sessions that use the experimental Codex integration can run in both the Agents window and the main VS Code window. Local harness sessions The Local harness is deprecated and will be removed in February 2027. Move your workflows to the Copilot harness before then. Learn more about Local harness deprecation. and Codex sessions from the OpenAI extension run only in the main VS Code window.

  • Copilot Cloud sessions are only supported for GitHub-backed repositories. For non-GitHub projects, you can still use Copilot in the Agents window.

  • The agents dropdown currently doesn't have the plan agent. You can use the /plan command in a Copilot or Claude agent session. In Copilot harness sessions, the plan agent is also automatically invoked when you ask it to create a plan.

  • Running multiple chats in a single session is currently supported for sessions that use the Copilot or Claude harness.

  • Multi-root sessions are not yet supported in the Agents window. You can ask the agent to work across projects in a single session.

Next steps