1# Agent Panel
2
3The Agent Panel provides you with a way to interact with LLMs.
4You can use it for various tasks, such as generating code, asking questions about your code base, and general inquiries such as emails and documentation.
5
6To open the Agent Panel, use the `agent: new thread` action in [the Command Palette](../getting-started.md#command-palette) or click the ✨ (sparkles) icon in the status bar.
7
8If you're using the Agent Panel for the first time, you'll need to [configure at least one LLM provider](./configuration.md).
9
10## Overview {#overview}
11
12After you've configured one or more LLM providers, type at the message editor and hit `enter` to submit your prompt.
13If you need extra room to type, you can expand the message editor with {#kb agent::ExpandMessageEditor}.
14
15You should start to see the responses stream in with indications of [which tools](./tools.md) the AI is using to fulfill your prompt.
16
17### Editing Messages {#editing-messages}
18
19Any message that you send to the AI is editable.
20You can click on the card that contains your message and re-submit it with an adjusted prompt and/or new pieces of context.
21
22### Checkpoints {#checkpoints}
23
24Every time the AI performs an edit, you should see a "Restore Checkpoint" button to the top of your message.
25This allows you to return your codebase to the state it was in prior to that message.
26This is usually valuable if the AI's edit doesn't go in the right direction.
27
28### Navigating History {#navigating-history}
29
30To quickly navigate through recently opened threads, use the {#kb agent::ToggleNavigationMenu} binding, when focused on the panel's editor, or click the hamburger icon button at the top left of the panel to open the dropdown that shows you the six most recent threads.
31
32The 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.
33
34You can also view all historical conversations with the `View All` option from within the same menu or by reaching for the {#kb agent::OpenHistory} binding.
35
36### Following the Agent {#following-the-agent}
37
38Zed is built with collaboration natively integrated.
39This approach extends to collaboration with AI as well.
40To follow the agent navigating across your codebase and performing edits, click on the "crosshair" icon button at the bottom left of the panel.
41
42### Get Notified {#get-notified}
43
44If you send a prompt to the Agent and then move elsewhere, thus putting Zed in the background, a notification will pop up at the top right of your monitor indicating that the Agent has completed its work.
45
46You can customize the notification behavior or turn it off entirely by using the `agent.notify_when_agent_waiting` settings key.
47
48### Reviewing Changes {#reviewing-changes}
49
50If you are using a profile that includes write tools, and the agent has made changes to your project, you'll notice the Agent Panel surfaces the fact that edits (and how many of them) have been applied.
51
52To see which files 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.
53
54Reviewing includes the option to accept or reject each or all edits.
55
56Edit diffs also appear in individual buffers.
57So, 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.
58
59## Adding Context {#adding-context}
60
61Although Zed's agent is very efficient at reading through your codebase 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.
62
63If you have a tab open when opening the Agent Panel, that tab appears as a suggested context in form of a dashed button.
64You can also add other forms of context by either mentioning them with `@` or hitting the `+` icon button.
65
66You can even add previous threads as context by mentioning them with `@thread`, or by selecting the "Start New From Summary" option from the top-right menu to continue a longer conversation and keep it within the context window.
67
68Images are also supported, and pasting them over in the panel's editor works.
69
70### Token Usage {#token-usage}
71
72Zed surfaces how many tokens you are consuming for your currently active thread in the panel's toolbar.
73Depending on how many pieces of context you add, your token consumption can grow rapidly.
74
75With that in mind, once you get close to the model's context window, a banner appears on the bottom of the message editor suggesting to start a new thread with the current one summarized and added as context.
76You can also do this at any time with an ongoing thread via the "Agent Options" menu on the top right.
77
78## Changing Models {#changing-models}
79
80After you've configured your LLM providers—either via [a custom API key](./configuration.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.
81
82## Using Tools {#using-tools}
83
84The new Agent Panel supports tool calling, which enables agentic editing.
85Zed 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.
86
87You can also extend the set of available tools via [MCP Servers](./mcp.md).
88
89### Profiles {#profiles}
90
91Profiles act as a way to group tools.
92Zed offers three built-in profiles and you can create as many custom ones as you want.
93
94#### Built-in Profiles {#built-in-profiles}
95
96- `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.
97- `Ask`: A profile with read-only tools. Best for asking questions about your code base without the fear of the agent making changes.
98- `Minimal`: A profile with no tools. Best for general conversations with the LLM where no knowledge of your code is necessary.
99
100You 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.
101
102#### Custom Profiles {#custom-profiles}
103
104You can create a custom profile via the `Configure Profiles…` option in the profile selector.
105From here, you can choose to `Add New Profile` or fork an existing one with your choice of tools and a custom profile name.
106
107You can also override built-in profiles.
108With a built-in profile selected, in the profile selector, navigate to `Configure Tools`, and select the tools you'd like.
109
110Zed will store this profile in your settings using the same profile name as the default you overrode.
111
112All custom profiles can be edited via the UI or by hand under the `assistant.profiles` key in your `settings.json` file.
113
114### Model Support {#model-support}
115
116Tool calling needs to be individually supported by each model and model provider.
117Therefore, despite the presence of tools, some models may not have the ability to pick them up yet in Zed.
118You should see a "No tools" disabled button if you select a model that falls into this case.
119
120We want to support all of them, though!
121We may prioritize which ones to focus on based on popularity and user feedback, so feel free to help and contribute.
122
123All [Zed's hosted models](./models.md) support tool calling out-of-the-box.
124
125### MCP Servers {#mcp-servers}
126
127Similarly to the built-in tools, some models may not support all tools included in a given MCP Server.
128Zed's UI will inform about this via a warning icon that appears close to the model selector.
129
130## Text Threads {#text-threads}
131
132["Text threads"](./text-threads.md) present your conversation with the LLM in a different format—as raw text.
133With text threads, you have full control over the conversation data.
134You can remove and edit responses from the LLM, swap roles, and include more context earlier in the conversation.
135
136For 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.
137We 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".
138
139### Text Thread History {#text-thread-history}
140
141Content from text thread are saved to your file system.
142Visit [the dedicated docs](./text-threads.md#history) for more info.
143
144## Errors and Debugging {#errors-and-debugging}
145
146In 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.
147
148This action exposes the entire thread in the form of Markdown and allows for deeper understanding of what each tool call was doing.
149
150You 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.
151
152## Feedback {#feedback}
153
154Every change we make to Zed's system prompt and tool set, needs to be backed by an eval with good scores.
155
156Every time the LLM performs a weird change or investigates a certain topic in your codebase completely incorrectly, it's an indication that there's an improvement opportunity.
157
158> Note that rating responses will send your data related to that response to Zed's servers.
159> 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.
160> **_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.
161
162The 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.
163In case of a thumbs down, a new text area will show up where you can add more specifics about what happened.
164
165You can provide feedback on the thread at any point after the agent responds, and multiple times within the same thread.