agent-panel.md

  1# Agent Panel
  2
  3The Agent Panel allows you to interact with many LLMs and coding agents that can support you in various types of tasks, such as generating code, codebase understanding, and other general inquiries like writing emails, documentation, and more.
  4
  5To open it, use the `agent: new thread` action in [the Command Palette](../getting-started.md#command-palette) or click the ✨ (sparkles) icon in the status bar.
  6
  7If you're using the Agent Panel for the first time, you need to have at least one LLM or agent provider configured.
  8You can do that by:
  9
 101. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
 112. [bringing your own API keys](./llm-providers.md#use-your-own-keys) for your desired provider
 123. using an external agent like [Gemini CLI](./external-agents.md#gemini-cli)
 13
 14## Overview {#overview}
 15
 16After you've configured one or more LLM providers, type at the message editor and hit `enter` to submit your prompt.
 17If you need extra room to type, you can expand the message editor with {#kb agent::ExpandMessageEditor}.
 18
 19You should start to see the responses stream in with indications of [which tools](./tools.md) the model is using to fulfill your prompt.
 20
 21> Note that, at the moment, not all features outlined below work for external agents, like [Gemini CLI](./external-agents.md#gemini-cli)—features like _restoring threads from history_, _checkpoints_, _token usage display_, _model selection_, and others may be supported in the future.
 22
 23### Creating New Threads
 24
 25By default, the Agent Panel uses Zed's first-party agent.
 26
 27To change that, go to the plus button in the top-right of the Agent Panel and choose another option.
 28You choose to create a new [Text Thread](./text-threads.md) or, if you have [external agents](./external-agents.md) connected, you can create new threads with them.
 29
 30### Editing Messages {#editing-messages}
 31
 32Any message that you send to the AI 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### Checkpoints {#checkpoints}
 36
 37Every time the AI performs an edit, you should see a "Restore Checkpoint" button to the top of your message, allowing you to return your code base to the state it was in prior to that message.
 38
 39The checkpoint button appears even if you interrupt the thread midway through an edit attempt, 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.
 40
 41### Navigating History {#navigating-history}
 42
 43To quickly navigate through recently opened 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 to open the dropdown that shows you the six most recent threads.
 44
 45The items in this menu function similarly to tabs, and closing them doesn’t delete the thread; instead, it simply removes them from the recent list.
 46
 47To view all historical conversations, reach for the `View All` option from within the same menu or via the {#kb agent::OpenHistory} binding.
 48
 49### Following the Agent {#following-the-agent}
 50
 51Zed is built with collaboration natively integrated.
 52This approach extends to collaboration with AI as well.
 53To follow the agent reading through your codebase and performing edits, click on the "crosshair" icon button at the bottom left of the panel.
 54
 55You can also do that with the keyboard by pressing the `cmd`/`ctrl` modifier with `enter` when submitting a message.
 56
 57### Get Notified {#get-notified}
 58
 59If you send a prompt to the Agent and then move elsewhere, thus putting Zed in the background, you can be notified of whether its response is finished either via:
 60
 61- a visual notification that appears in the top right of your screen
 62- or a sound notification
 63
 64Both notification methods can be used together or individually according to your preference.
 65
 66You can customize their behavior, including turning them off entirely, by using the `agent.notify_when_agent_waiting` and `agent.play_sound_when_agent_done` settings keys.
 67
 68### Reviewing Changes {#reviewing-changes}
 69
 70Once the agent has made changes to your project, the panel will surface which files, and how many of them, have been edited.
 71
 72To 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 multi-buffer tab with all changes.
 73
 74You're able to reject or accept each individual change hunk, or the whole set of changes made by the agent.
 75
 76Edit diffs also appear in individual buffers.
 77So, if your active tab had edits made by the AI, you'll see diffs with the same accept/reject controls as in the multi-buffer.
 78
 79## Adding Context {#adding-context}
 80
 81Although Zed's agent is very efficient at reading through your code base to autonomously pick up relevant files, directories, and other context, manually adding context is still encouraged as a way to speed up and improve the AI's response quality.
 82
 83To add any file, directory, symbol, previous threads, rules files, or even web pages as context, type `@` to mention them in the editor.
 84
 85Pasting images as context is also supported by the Agent Panel.
 86
 87### Token Usage {#token-usage}
 88
 89Zed surfaces how many tokens you are consuming for your currently active thread nearby the profile selector in the panel's message editor.
 90Depending on how many pieces of context you add, your token consumption can grow rapidly.
 91
 92With that in mind, once you get close to the model's context window, a banner appears below the message editor suggesting to start a new thread with the current one summarized and added as context.
 93You can also do this at any time with an ongoing thread via the "Agent Options" menu on the top right.
 94
 95## Changing Models {#changing-models}
 96
 97After you've configured your LLM providers—either via [a custom API key](./llm-providers.md#use-your-own-keys) or through [Zed's hosted models](./models.md)—you can switch between them by clicking on the model selector on the message editor or by using the {#kb agent::ToggleModelSelector} keybinding.
 98
 99## Using Tools {#using-tools}
100
101The new Agent Panel supports tool calling, which enables agentic editing.
102Zed comes with [several built-in tools](./tools.md) that allow models to perform tasks such as searching through your codebase, editing files, running commands, and others.
103
104You can also extend the set of available tools via [MCP Servers](./mcp.md).
105
106### Profiles {#profiles}
107
108Profiles act as a way to group tools.
109Zed offers three built-in profiles and you can create as many custom ones as you want.
110
111#### Built-in Profiles {#built-in-profiles}
112
113- `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.
114- `Ask`: A profile with read-only tools. Best for asking questions about your code base without the concern of the agent making changes.
115- `Minimal`: A profile with no tools. Best for general conversations with the LLM where no knowledge of your code base is necessary.
116
117You can explore the exact tools enabled in each profile by clicking on the profile selector button > `Configure Profiles…` > the one you want to check out.
118
119#### Custom Profiles {#custom-profiles}
120
121You can create a custom profile via the `Configure Profiles…` option in the profile selector.
122From here, you can choose to `Add New Profile` or fork an existing one with a custom name and your preferred set of tools.
123
124You can also override built-in profiles.
125With a built-in profile selected, in the profile selector, navigate to `Configure Tools`, and select the tools you'd like.
126
127Zed will store this profile in your settings using the same profile name as the default you overrode.
128
129All custom profiles can be edited via the UI or by hand under the `assistant.profiles` key in your `settings.json` file.
130
131### Tool Approval
132
133Zed's Agent Panel surfaces the `agent.always_allow_tool_actions` setting that, if turned to `false`, will require you to give permission to any editing attempt as well as tool calls coming from MCP servers.
134
135You can change that by setting this key to `true` in either your `settings.json` or via the Agent Panel's settings view.
136
137### Model Support {#model-support}
138
139Tool calling needs to be individually supported by each model and model provider.
140Therefore, despite the presence of tools, some models may not have the ability to pick them up yet in Zed.
141You should see a "No tools" label if you select a model that falls into this case.
142
143We want to support all of them, though!
144We may prioritize which ones to focus on based on popularity and user feedback, so feel free to help and contribute to fast-track those that don't fit this bill.
145
146All [Zed's hosted models](./models.md) support tool calling out-of-the-box.
147
148### MCP Servers {#mcp-servers}
149
150Similarly to the built-in tools, some models may not support all tools included in a given MCP Server.
151Zed's UI will inform about this via a warning icon that appears close to the model selector.
152
153## Text Threads {#text-threads}
154
155["Text Threads"](./text-threads.md) present your conversation with the LLM in a different format—as raw text.
156With text threads, you have full control over the conversation data.
157You can remove and edit responses from the LLM, swap roles, and include more context earlier in the conversation.
158
159For users who have been with us for some time, you'll notice that text threads are our original assistant panel—users love it for the control it offers.
160We do not plan to deprecate text threads, but it should be noted that if you want the AI to write to your code base autonomously, that's only available in the newer, and now default, "Threads".
161
162## Errors and Debugging {#errors-and-debugging}
163
164In 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.
165
166You 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.
167
168## Feedback {#feedback}
169
170Every change we make to Zed's system prompt and tool set, needs to be backed by a thorough eval with good scores.
171
172Every time the LLM performs a weird change or investigates a certain topic in your code base incorrectly, it's an indication that there's an improvement opportunity.
173
174> Note that rating responses will send your data related to that response to Zed's servers.
175> 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.
176> **_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.
177
178The 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.
179In case of a thumbs down, a new text area will show up where you can add more specifics about what happened.
180
181You can provide feedback on the thread at any point after the agent responds, and multiple times within the same thread.