agent-panel.md

  1# Agent Panel
  2
  3The Agent Panel is where you interact with AI agents that can read, write, and run code in your project. Use it for code generation, refactoring, debugging, documentation, and general questions.
  4
  5Open it with `agent: new thread` from [the Command Palette](../getting-started.md#command-palette) or click the ✨ icon in the status bar.
  6
  7## Getting Started {#getting-started}
  8
  9If you're using the Agent Panel for the first time, you need to have at least one LLM provider or external agent configured.
 10You can do that by:
 11
 121. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
 132. [using your own API keys](./llm-providers.md#use-your-own-keys), either from model providers like Anthropic or model gateways like OpenRouter.
 143. using an [external agent](./external-agents.md) like [Gemini CLI](./external-agents.md#gemini-cli) or [Claude Code](./external-agents.md#claude-code)
 15
 16## Overview {#overview}
 17
 18With an LLM provider or external agent configured, type in the message editor and press `enter` to submit. Expand the editor with {#kb agent::ExpandMessageEditor} if you need more room.
 19
 20Responses stream in with indicators showing [which tools](./tools.md) the model is using. The sections below cover what you can do from here.
 21
 22> Note that for external agents, like [Gemini CLI](./external-agents.md#gemini-cli) or [Claude Code](./external-agents.md#claude-code), some of the features outlined below may _not_ be supported—for example, _restoring threads from history_, _checkpoints_, _token usage display_, and others. Their availability varies depending on the agent.
 23
 24### Creating New Threads {#new-thread}
 25
 26By default, the Agent Panel uses Zed's first-party agent.
 27
 28To choose another agent, go to the plus button in the top-right of the Agent Panel and pick either one of the [external agents](./external-agents.md) installed out of the box or a new [Text Thread](./text-threads.md).
 29
 30### Editing Messages {#editing-messages}
 31
 32Any message that you send to the model is editable.
 33You can click on the card that contains your message and re-submit it with an adjusted prompt and/or new pieces of context.
 34
 35### Queueing Messages
 36
 37Messages sent while the agent is in the generating state get, by default, queued.
 38
 39For the Zed agent, queued messages get sent at the next turn boundary, which is usually between a tool call and a response, whereas for external agents, the message gets sent at the end of the generation.
 40
 41You can edit or remove (an individual or all) queued messages.
 42You can also still interrupt the agent immediately if you want by either clicking on the stop button or by clicking the "Send Now" (double-enter) on a queued message.
 43
 44### Checkpoints {#checkpoints}
 45
 46Every time the model performs an edit, you should see a "Restore Checkpoint" button at the top of your message, allowing you to return your code base to the state it was in prior to that message.
 47
 48The checkpoint button appears even if you interrupt the thread midway through an edit, as this is likely a moment when you've identified that the agent is not heading in the right direction and you want to revert back.
 49
 50### Context Menu {#context-menu}
 51
 52Right-click on any agent response in the thread view to access a context menu with the following actions:
 53
 54- **Copy Selection**: Copies the currently selected text as Markdown (available when text is selected).
 55- **Copy This Agent Response**: Copies the full text of the agent response you right-clicked on.
 56- **Scroll to Top / Scroll to Bottom**: Scrolls to the beginning or end of the thread, depending on your current position.
 57- **Open Thread as Markdown**: Opens the entire thread as a Markdown file in a new tab.
 58
 59### Navigating the Thread {#navigating-the-thread}
 60
 61In long conversations, use the scroll button at the bottom of the panel to jump to your most recent prompt.
 62
 63### Navigating History {#navigating-history}
 64
 65To quickly navigate through recently updated threads, use the {#kb agent::ToggleNavigationMenu} binding when focused on the panel's editor, or click the menu icon button at the top right of the panel.
 66Doing that will open a dropdown that shows you your six most recently updated threads.
 67
 68To view all historical conversations, reach for the `View All` option from within the same menu or via the {#kb agent::OpenHistory} binding.
 69
 70Thread titles are auto-generated based on the conversation content. To regenerate a title, open the ellipsis menu in the top right of the panel and select "Regenerate Thread Title".
 71
 72### Following the Agent {#following-the-agent}
 73
 74Follow the agent as it reads and edits files by clicking the crosshair icon at the bottom left of the panel. Your editor will jump to each file the agent touches.
 75
 76You can also hold `cmd`/`ctrl` when submitting a message to automatically follow.
 77
 78### Get Notified {#get-notified}
 79
 80If you send a prompt to the Agent and then put Zed in the background, you can choose to be notified when its generation wraps up via:
 81
 82- a visual notification that appears in the top right of your screen
 83- a sound notification
 84
 85These notifications can be used together or individually, and you can use the `agent.notify_when_agent_waiting` and `agent.play_sound_when_agent_done` settings keys to customize that, including turning both off entirely.
 86
 87### Reviewing Changes {#reviewing-changes}
 88
 89Once the agent has made changes to your project, the panel will surface which files, how many of them, and how many lines have been edited.
 90
 91To see which files specifically have been edited, expand the accordion bar that shows up right above the message editor or click the `Review Changes` button ({#kb agent::OpenAgentDiff}), which opens a special multi-buffer tab with all changes.
 92
 93You can accept or reject each individual change hunk, or the whole set of changes made by the agent.
 94
 95Edit diffs also appear in singleton buffers.
 96If your active tab had edits made by the AI, you'll see diffs with the same accept/reject controls as in the multi-buffer.
 97You can turn this off, though, through the `agent.single_file_review` setting.
 98
 99## Adding Context {#adding-context}
100
101The agent can search your codebase to find relevant context, but providing it explicitly improves response quality and reduces latency.
102
103Add context by typing `@` in the message editor. You can mention files, directories, symbols, previous threads, rules files, and diagnostics.
104
105Copying images and pasting them in the panel's message editor is also supported.
106
107When you paste multi-line code selections copied from a buffer, Zed automatically formats them as @-mentions with the file context.
108To paste content without this automatic formatting, use {#kb agent::PasteRaw} to paste raw text directly.
109
110### Selection as Context
111
112Additionally, you can also select text in a buffer and add it as context by using the {#kb agent::AddSelectionToThread} keybinding, running the {#action agent::AddSelectionToThread} action, or choosing the "Selection" item in the `@` menu.
113
114## Token Usage {#token-usage}
115
116Zed surfaces how many tokens you are consuming for your currently active thread near the profile selector in the panel's message editor.
117
118Once you approach the model's context window, a banner appears above the message editor suggesting to start a new thread with the current one summarized and added as context.
119You can also do this at any time with an ongoing thread via the "Agent Options" menu on the top right, where you'll see a "New from Summary" button, as well as simply @-mentioning a past thread in a new one..
120
121## Changing Models {#changing-models}
122
123After you've configured your LLM providers—either via [a custom API key](./llm-providers.md) or through [Zed's hosted models](./models.md)—you can switch between their models by clicking on the model selector on the message editor or by using the {#kb agent::ToggleModelSelector} keybinding.
124
125> The same model can be offered via multiple providers - for example, Claude Sonnet 4 is available via Zed Pro, OpenRouter, Anthropic directly, and more.
126> Make sure you've selected the correct model **_provider_** for the model you'd like to use, delineated by the logo to the left of the model in the model selector.
127
128### Favoriting Models
129
130You can mark specific models as favorites either through the model selector, by clicking on the star icon button that appears as you hover the model, or through your settings via the `agent.favorite_models` settings key.
131
132Cycle through your favorites with {#kb agent::CycleFavoriteModels} without opening the model selector.
133
134## Using Tools {#using-tools}
135
136The Agent Panel supports tool calling, which enables agentic editing.
137Zed includes [built-in tools](./tools.md) for searching your codebase, editing files, running terminal commands, and fetching web content.
138
139You can also extend the set of available tools via [MCP Servers](./mcp.md).
140
141### Profiles {#profiles}
142
143Profiles act as a way to group tools.
144Zed offers three built-in profiles and you can create as many custom ones as you want.
145
146#### Built-in Profiles {#built-in-profiles}
147
148- `Write`: A profile with tools to allow the LLM to write to your files and run terminal commands. This one essentially has all built-in tools turned on.
149- `Ask`: A profile with read-only tools. Best for asking questions about your code base without the concern of the agent making changes.
150- `Minimal`: A profile with no tools. Best for general conversations with the LLM where no knowledge of your code base is necessary.
151
152You can explore the exact tools enabled in each profile by clicking on the profile selector button > `Configure` button > the one you want to check out.
153
154Alternatively, you can also use either the command palette, by running {#action agent::ManageProfiles}, or the keybinding directly, {#kb agent::ManageProfiles}, to have access to the profile management modal.
155
156Use {#kb agent::CycleModeSelector} to switch between profiles without opening the modal.
157
158#### Custom Profiles {#custom-profiles}
159
160You can also create a custom profile through the Agent Profile modal.
161From there, you can choose to `Add New Profile` or fork an existing one with a custom name and your preferred set of tools.
162
163It's also possible to override built-in profiles.
164In the Agent Profile modal, select a built-in profile, navigate to `Configure Tools`, and rearrange the tools you'd like to keep or remove.
165
166Zed will store this profile in your settings using the same profile name as the default you overrode.
167
168All custom profiles can be edited via the UI or by hand under the `agent.profiles` key in your `settings.json` file.
169
170To delete a custom profile, open the Agent Profile modal, select the profile you want to remove, and click the delete button.
171
172### Tool Approval
173
174> **Note:** In Zed v0.224.0 and above, tool approval is controlled by `agent.tool_permissions.default`.
175
176Zed's Agent Panel provides the `agent.tool_permissions.default` setting to control tool approval behavior:
177
178- `"confirm"` (default) — Prompts for approval before running any tool action
179- `"allow"` — Auto-approves tool actions without prompting
180- `"deny"` — Blocks all tool actions
181
182You can change this in either your `settings.json` or via the Agent Panel's settings view.
183
184Even with `"default": "allow"`, per-tool `always_deny` and `always_confirm` patterns are still respected — so you can auto-approve most actions while blocking or gating specific ones. For the `copy_path` and `move_path` tools, patterns are matched independently against both the source and destination paths. See [Per-tool Permission Rules](./agent-settings.md#per-tool-permission-rules) for details.
185
186When the agent requests permission for an action, the confirmation dialog includes options to allow or deny once, plus "Always for <tool>" choices that set a tool-level default. When Zed can extract a safe pattern from the input, it also offers pattern-based "Always for ..." choices that add `always_allow`/`always_deny` rules. MCP tools only support tool-level defaults.
187
188> **Note:** Before Zed v0.224.0, tool approval was controlled by the `agent.always_allow_tool_actions` boolean (default `false`). Set it to `true` to auto-approve tool actions, or leave it `false` to require confirmation for edits and tool calls (including MCP tools).
189
190### Model Support {#model-support}
191
192Tool calling needs to be individually supported by each model and model provider.
193Therefore, despite the presence of tools, some models may not have the ability to pick them up yet in Zed.
194You should see a "No tools" label if you select a model that falls into this case.
195
196All [Zed's hosted models](./models.md) support tool calling out-of-the-box.
197
198### MCP Servers {#mcp-servers}
199
200Similarly to the built-in tools, some models may not support all tools included in a given MCP Server.
201Zed's UI will inform you about this via a warning icon that appears close to the model selector.
202
203## Text Threads {#text-threads}
204
205["Text Threads"](./text-threads.md) present your conversation with the LLM in a different format—as raw text.
206With text threads, you have full control over the conversation data.
207You can remove and edit responses from the LLM, swap roles, and include more context earlier in the conversation.
208
209Text threads are Zed's original assistant panel format, preserved for users who want direct control over conversation data.
210Autonomous code editing (where the agent writes to files) is only available in the default thread format, not text threads.
211
212## Errors and Debugging {#errors-and-debugging}
213
214In case of any error or strange LLM response behavior, the best way to help the Zed team debug is by reaching for the `agent: open thread as markdown` action and attaching that data as part of your issue on GitHub.
215
216You can also open threads as Markdown by clicking on the file icon button, to the right of the thumbs down button, when focused on the panel's editor.
217
218## Feedback {#feedback}
219
220You can rate agent responses to help improve Zed's system prompt and tools.
221
222> Note that rating responses will send your data related to that response to Zed's servers.
223> See [AI Improvement](./ai-improvement.md) and [Privacy and Security](./privacy-and-security.md) for more information about Zed's approach to AI improvement, privacy, and security.
224> **_If you don't want data persisted on Zed's servers, don't rate_**. We will not collect data for improving our Agentic offering without you explicitly rating responses.
225
226The best way you can help influence the next change to Zed's system prompt and tools is by rating the LLM's response via the thumbs up/down buttons at the end of every response. In case of a thumbs down, a new text area will show up where you can add more specifics about what happened.
227
228You can provide feedback on the thread at any point after the agent responds, and multiple times within the same thread.