> AI agents: For documentation discovery and navigation, see [llms.txt](/llms.txt).

# Use chat in VS Code

Chat in Visual Studio Code lets you use natural language for interacting with AI agents. Ask questions about your code, get help understanding complex logic, generate new features, fix bugs, and more, all through a conversational interface.

This article describes interaction mechanics shared by chat surfaces in VS Code, including how to send and steer requests, add context, navigate a conversation, and personalize the chat display. For an introduction to AI workflows, agents, and the available interfaces, see [Build with AI in VS Code](/docs/agents/overview.md).

<div class="docs-action" data-show-in-doc="false" data-show-in-sidebar="true" title="Get started with agents">
Follow a hands-on tutorial to build an app with AI agents in VS Code.

* [Start agentic coding tutorial](/docs/agents/agents-tutorial.md)

</div>

## Choose where to chat

The interaction mechanics in this article apply to the Chat view, chat editor tabs, and the Agents window. To compare these interfaces with browser and terminal options, see [Ways to work with agents](/docs/agents/overview.md#ways-to-work-with-agents).

For lightweight interactions, use [inline chat](/docs/chat/inline-chat.md) to edit code or get terminal suggestions in place, or open [Quick Chat](/docs/chat/inline-chat.md#use-quick-chat) for a temporary conversation.

## Send a chat request

Type your message in the chat input box and press `kbstyle(Enter)` or select the **Send** button. The agent can answer questions, analyze your code, run tools, make changes, and respond with a summary. You can then continue the conversation with follow-up messages. For example, you might ask an agent to make this change:

```prompt
Add input validation to the signup form
```

For a hands-free conversation, start [Voice Mode](/docs/configure/accessibility/voice.md#use-voice-mode) from the chat input. Voice Mode listens for follow-up requests and reads the agent's responses aloud. `feature(voice-mode)`

To give extra project-specific context, you can [add context to your prompt](#add-context-to-your-prompts) by referencing files, symbols, or other information with `#`-mentions.

For common tasks, you can use slash commands as shortcuts for frequently used prompts or to invoke [agent skills](/docs/agent-customization/agent-skills.md). Type `/` in the chat input to see all available commands.

You can run multiple sessions in parallel and switch between them without losing context. Learn more in [Manage agent sessions](/docs/agents/run/sessions/manage-sessions.md).

Each session has controls that shape how the agent responds: **Session Target**, **Agent**, **Language model**, and **Permissions**. Learn how to [configure an agent session](/docs/agents/run/agent-harnesses.md#understand-the-session-controls).

> [!TIP]
> To get the best results, be specific about what you want, provide relevant context, and write clear instructions. For more information, see [Get better responses](#get-better-responses).

## Run terminal commands from chat

Start a message with `!` to run a terminal command directly from the Chat view or Agents window. The `!` must be the first character and must be followed by a command.

For example, enter the following message to run your tests:

```shell
!npm test
```

The command runs immediately in the session's default shell, without sending the message to the agent or asking for approval. It uses the session folder or worktree as the working directory. The command output and exit status appear in the chat transcript.

> [!NOTE]
> The `!` command is only available in [Agent Host](/docs/agents/concepts/agent-host.md) sessions.

## Send messages while a request is running

You don't have to wait for a response to finish before sending your next message. While a request is in progress, the **Send** button changes to a dropdown that gives you three options for how to handle the new message.

![Screenshot of the Send button dropdown menu showing options to queue, steer, or stop and send a new message.](images/chat-sessions/send-dropdown.png)

* **Add to Queue**: your message waits and sends automatically after the current response completes. The current response finishes uninterrupted.
* **Steer with Message**: signals the current request to yield after finishing the current tool execution. The current response stops and your new message processes immediately. Use this to redirect the agent when it's heading in the wrong direction.
* **Stop and Send**: cancels the current request entirely and sends your new message right away.

Stopping a request doesn't undo file edits, terminal commands, or other actions that already completed. To restore affected workspace files and chat history, [restore a checkpoint](/docs/agents/run/review-code-edits.md#restore-a-checkpoint). Checkpoints don't reverse changes to external services.

For examples of when to steer or stop a request and how to write a focused correction, see [Get an agent back on track](/docs/agents/guides/get-agent-back-on-track.md#redirect-a-running-request).

The default action for the **Send** button is configurable. Use `setting(chat.requestQueuing.defaultAction)` to set it to `steer` (default) or `queue`.

### Reorder pending messages

When you have multiple pending messages (queued or steering), you can drag and drop them to change the order in which they are processed. A drag handle appears on hover when more than one message of the same type is pending.

![Screenshot of pending messages in the chat input box with drag handles to reorder them.](images/chat-sessions/pending-messages.png)

## Add context to your prompts

Providing the right context helps the AI generate more relevant and accurate responses.

* **Implicit context**: VS Code automatically includes the active file, your current selection, and the file name as context. When you use agents, the agent decides autonomously if additional context is needed.

* **`#`-mentions**: type `#` in the chat input to explicitly reference files (`#file`), folders, symbols, your codebase (`#codebase`), terminal output (`#terminalSelection`), or tools like `#fetch`.

* **Vision**: attach images, such as screenshots or UI mockups, as context for your prompt.

* **Browser elements**: select elements from the [integrated browser](/docs/debugtest/integrated-browser.md) to add HTML, CSS, and screenshot context to your prompt.

Learn more about [managing context for AI](/docs/chat/copilot-chat-context.md).

## Image carousel

You can select images or videos in chat responses to open a dedicated carousel view. Media files from tool results (such as the integrated browser, Playwright, or other MCP servers) and inlined in assistant messages are all accessible from the carousel.

![Screenshot showing the image carousel view with multiple images.](images/chat-sessions/image-carousel.png)

To disable the image carousel, set `setting(imageCarousel.chat.enabled)` to `false`.

## Review and manage changes

After the AI changes files, review and validate the result before you commit or integrate it. In the Chat view, select a changed file in the response to open its diff. In the Agents window, use the **Changes** panel.

For keyboard and screen reader access to a diff, use the [Accessible Diff Viewer](/docs/configure/accessibility/accessibility.md#diff-editor-accessibility).

For instructions about requesting revisions, restoring checkpoints, and integrating folder or worktree changes, see [Review AI-generated code edits](/docs/agents/run/review-code-edits.md).

## Get notified about chat responses

When you're working in another window or application, VS Code can send you OS notifications to let you know about important chat events, so you don't have to keep checking back.

Use `setting(chat.notifyWindowOnResponseReceived)` to configure when you receive an OS notification when a chat response is received. The notification includes a preview of the response, and selecting it brings focus to the chat session.

Use `setting(chat.notifyWindowOnConfirmation)` to configure when you receive an OS notification when the agent needs your input or confirmation to continue.

Both settings have three possible values:

* `off`: never show notifications
* `windowNotFocused` (default): show notifications only when the VS Code window is not focused
* `always`: show notifications even when the VS Code window is in focus

> [!TIP]
> Set the value to `always` if you want to stay aware of chat activity while working in other parts of VS Code, such as when running long agent tasks in the background.

## Find text in a chat session

Press `kb(workbench.action.chat.find)` to search the entire conversation. Find is available in the Chat view, chat editor tabs, and the Agents window. It searches prompts and responses, including off-screen content and code blocks.

Use `kb(workbench.action.chat.findNext)` and `kb(workbench.action.chat.findPrevious)` to navigate between matches. When a match is inside a collapsed **Completed N steps** section, navigating to the match expands the section. Use the **Match Case**, **Whole Word**, and **Regular Expression** options to refine the results.

> [!NOTE]
> Find is not available in Quick Chat or inline chat. It does not search text inside tool pills or collapsed reasoning.

## Navigate between prompts in a chat session

Use the following keyboard shortcuts to navigate between prompts in a chat session:

* `kb(workbench.action.chat.previousUserPrompt)`: Go to the previous prompt in the chat session.
* `kb(workbench.action.chat.nextUserPrompt)`: Go to the next prompt in the chat session.
* `kb(workbench.action.chat.previousCodeBlock)`: Go to the previous code block in the chat session.
* `kb(workbench.action.chat.nextCodeBlock)`: Go to the next code block in the chat session.

To inspect a chat response character by character or line by line with a keyboard or screen reader, run **Open Accessible View** (`kb(editor.action.accessibleView)`). Learn more about the [Accessible View](/docs/configure/accessibility/accessibility.md#accessible-view).

## Personalize chat

Adjust how chat content appears, add an interactive pet, or set a decorative background in the Agents window.

### Customize the chat display

Use these settings to adjust the chat transcript:

| Display option | Settings |
|----------------|----------|
| Markdown font | Set the font family with `setting(chat.fontFamily)` and the font size with `setting(chat.fontSize)`. |
| Code block font and layout | Set the font family, size, weight, and line height with `setting(chat.editor.fontFamily)`, `setting(chat.editor.fontSize)`, `setting(chat.editor.fontWeight)`, and `setting(chat.editor.lineHeight)`. Control line wrapping with `setting(chat.editor.wordWrap)`. |
| Sticky prompts | Use `setting(chat.stickyScroll.enabled)` to pin the current prompt to the top of the transcript while you scroll. |
| Request timestamps | Use `setting(chat.verbose)` to show or hide request and completion timestamps. Hover over a completion timestamp to view the elapsed response time. |
| Persistent progress (Experimental) | Use `setting(chat.experimental.persistentProgress)` to keep a progress indicator visible until an agent response finishes. Choose a colored or monochrome **Draw** animation, or turn the indicator off. |

With persistent progress, reasoning appears in separate collapsible previews and tool calls remain visible while they run. `setting(chat.experimental.persistentProgressVerbosity)` controls completed tool-call details. **Compact** replaces completed groups with expandable summaries when response text resumes or the response finishes. **Verbose** keeps the full details visible.

Persistent progress defaults to **Draw** in Insiders and **Off** in Stable. Experiments can change either default during rollout, but an explicit setting always takes precedence.

For more chat preferences, see the [AI settings reference](/docs/agents/reference/ai-settings.md#chat-experience).

### Use the VS Code pet

`feature(chat-pet)`

The interactive VS Code pet sits above the chat input box and reacts to chat activity and your interactions. Type `/vscode-pet` in the chat input to show or hide it. In the new-session view of the Agents window, you can also right-click outside the input box and select the **Pet (/vscode-pet)** item.

Interact with the pet in the following ways:

* Select the pet to trigger a reaction. With the keyboard, press `kbstyle(Tab)` to focus it, and then press `kbstyle(Enter)` or `kbstyle(Space)`.
* Drag the pet around chat and release it to drop it. You can also flick it to throw it.
* When the pet has keyboard focus, press `kbstyle(Left)` or `kbstyle(Right)` to make it hop. Hold `kbstyle(Shift)` with an arrow key to throw it toward a wall.
* Right-click the pet to open its context menu and view achievements, send it on the run, resize it, or switch between Stable and Insiders colors. With the keyboard, focus the pet and press `kbstyle(Shift+F10)`.

Only one pet appears at a time in the active chat surface. Its position and size are shared across chats and windows and persist after you restart VS Code.

For a complete list of behaviors, see the [VS Code pet interactions and reactions reference](/docs/agents/reference/chat-pet.md).

### Customize the Agents window chat background

`feature(agents-window-chat-backgrounds)`

Add a decorative background to the chat area of the Agents window without changing chat in the main VS Code window.

To set a background, run the **Chat: Set Background...** command from the Command Palette (`kb(workbench.action.showCommands)`) or right-click an empty area of the chat. Then, choose one of these options:

* **No Background**: remove the background for the current color theme.
* **Codicons**: use a theme-aware pattern of built-in VS Code icons.
* **Image...**: select an image from your machine.
* **Recently used**: reuse one of your five most recent background images.

For an image background, run **Chat: Change Background Layout...** to repeat, stretch, center, or position the image along an edge or in a corner for the current color theme. Moving through the layout options previews each one. Select an option to save it, or dismiss the picker to restore the previous layout.

> [!NOTE]
> Light and dark color themes have separate backgrounds and image layouts. These choices are stored on the current machine and don't sync across devices.

Backgrounds are hidden in high contrast themes to preserve chat readability. The background commands are also unavailable while a high contrast theme is active.

## Get better responses

Chat provides several ways to improve the quality and relevance of AI responses:

* **Write effective prompts**: be specific about what you want, reference relevant files and symbols, and use `/` commands for common tasks. Get inspired by [prompt examples](/docs/agents/guides/prompt-examples.md) or review the full [prompt engineering guide](/docs/agents/best-practices.md).

* **Customize the AI**: tailor the AI's behavior to your project by adding [custom instructions](/docs/agent-customization/custom-instructions.md), creating reusable [prompt files](/docs/agent-customization/prompt-files.md), or building [custom agents](/docs/agent-customization/custom-agents.md) for specialized workflows. For example, create a "Code Reviewer" agent that provides feedback on code quality and adherence to your team's coding standards.

* **Extend with tools**: connect [MCP servers](/docs/agent-customization/mcp-servers.md) or install extensions that contribute tools to give the agent access to external services, databases, or APIs.

For more information, see [Customize agent behavior in VS Code](/docs/agent-customization/overview.md).

## Troubleshoot chat interactions

Use [Agent Logs and the Chat Debug view](/docs/agents/agent-troubleshooting/chat-debug-view.md) to inspect what happens when you send a prompt. Agent Logs shows a chronological event log of tool calls, LLM requests, and prompt file discovery. The Chat Debug view shows the raw system prompt, user prompt, context, and tool payloads for each interaction. These tools are useful for understanding why the AI responded in a certain way or for troubleshooting unexpected results.

## Support

Support for GitHub Copilot Chat is provided by GitHub and can be reached at <https://support.github.com>.

To learn more about Copilot's security, privacy, compliance, and transparency, see the [GitHub Copilot Trust Center FAQ](https://copilot.github.trust.page/faq).

## Related resources

* [Create and manage agent sessions](/docs/agents/run/sessions/manage-sessions.md)

* [Choose a session target and configure permissions](/docs/agents/run/agent-harnesses.md)

* [Prompt examples](/docs/agents/guides/prompt-examples.md)
