Skip to content

Commit d99a17e

Browse files
danilo-lealConradIrwinbennetboas-ciimattermill
authored
docs: Add ACP-related content (#36966)
Release Notes: - N/A --------- Co-authored-by: Conrad Irwin <[email protected]> Co-authored-by: Bennet Bo Fenner <[email protected]> Co-authored-by: Antonio Scandurra <[email protected]> Co-authored-by: Matt Miller <[email protected]>
1 parent c72e594 commit d99a17e

File tree

4 files changed

+102
-10
lines changed

4 files changed

+102
-10
lines changed

docs/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
- [Overview](./ai/overview.md)
4848
- [Agent Panel](./ai/agent-panel.md)
4949
- [Tools](./ai/tools.md)
50+
- [External Agents](./ai/external-agents.md)
5051
- [Inline Assistant](./ai/inline-assistant.md)
5152
- [Edit Prediction](./ai/edit-prediction.md)
5253
- [Text Threads](./ai/text-threads.md)

docs/src/ai/agent-panel.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Agent Panel
22

3-
The Agent Panel provides you with a surface to interact with LLMs, enabling various types of tasks, such as generating code, asking questions about your codebase, and general inquiries like emails, documentation, and more.
3+
The 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.
44

55
To 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.
66

7-
If you're using the Agent Panel for the first time, you need to have at least one LLM provider configured.
7+
If you're using the Agent Panel for the first time, you need to have at least one LLM or agent provider configured.
88
You can do that by:
99

1010
1. [subscribing to our Pro plan](https://zed.dev/pricing), so you have access to our hosted models
11-
2. or by [bringing your own API keys](./llm-providers.md#use-your-own-keys) for your desired provider
11+
2. [bringing your own API keys](./llm-providers.md#use-your-own-keys) for your desired provider
12+
3. using an external agent like [Gemini CLI](./external-agents.md#gemini-cli)
1213

1314
## Overview {#overview}
1415

@@ -17,6 +18,15 @@ If you need extra room to type, you can expand the message editor with {#kb agen
1718

1819
You should start to see the responses stream in with indications of [which tools](./tools.md) the model is using to fulfill your prompt.
1920

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 _checkpoints_, _token usage display_, and _model selection_ may be supported in the future.
22+
23+
### Creating New Threads
24+
25+
By default, the Agent Panel uses Zed's first-party agent.
26+
27+
To change that, go to the plus button in the top-right of the Agent Panel and choose another option.
28+
You 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+
2030
### Editing Messages {#editing-messages}
2131

2232
Any message that you send to the AI is editable.
@@ -30,7 +40,7 @@ The checkpoint button appears even if you interrupt the thread midway through an
3040

3141
### Navigating History {#navigating-history}
3242

33-
To 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 left of the panel to open the dropdown that shows you the six most recent threads.
43+
To 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.
3444

3545
The 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.
3646

@@ -70,16 +80,13 @@ So, if your active tab had edits made by the AI, you'll see diffs with the same
7080

7181
Although 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.
7282

73-
If you have a tab open while using the Agent Panel, that tab appears as a suggested context in form of a dashed button.
74-
You can also add other forms of context by either mentioning them with `@` or hitting the `+` icon button.
75-
76-
You can even add previous threads as context by mentioning them with `@thread`, or by selecting the "New From Summary" option from the `+` menu to continue a longer conversation, keeping it within the context window.
83+
To add any file, directory, symbol, previous threads, rules files, or even web pages as context, type `@` to mention them in the editor.
7784

7885
Pasting images as context is also supported by the Agent Panel.
7986

8087
### Token Usage {#token-usage}
8188

82-
Zed surfaces how many tokens you are consuming for your currently active thread in the panel's toolbar.
89+
Zed surfaces how many tokens you are consuming for your currently active thread nearby the profile selector in the panel's message editor.
8390
Depending on how many pieces of context you add, your token consumption can grow rapidly.
8491

8592
With 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.
@@ -145,7 +152,7 @@ Zed's UI will inform about this via a warning icon that appears close to the mod
145152

146153
## Text Threads {#text-threads}
147154

148-
["Text threads"](./text-threads.md) present your conversation with the LLM in a different format—as raw text.
155+
["Text Threads"](./text-threads.md) present your conversation with the LLM in a different format—as raw text.
149156
With text threads, you have full control over the conversation data.
150157
You can remove and edit responses from the LLM, swap roles, and include more context earlier in the conversation.
151158

docs/src/ai/external-agents.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# External Agents
2+
3+
Zed supports terminal-based agentic coding tools through the [Agent Client Protocol (ACP)](https://agentclientprotocol.com).
4+
5+
Currently, [Gemini CLI](https://github.com/google-gemini/gemini-cli) serves as the reference implementation, and you can [add custom ACP-compatible agents](#add-custom-agents) as well.
6+
7+
## Gemini CLI {#gemini-cli}
8+
9+
Zed provides the ability to run [Gemini CLI](https://github.com/google-gemini/gemini-cli) directly in the [agent panel](./agent-panel.md).
10+
11+
Under the hood we run Gemini CLI in the background, and talk to it over ACP.
12+
This means that you're running the real Gemini CLI, with all of the advantages of that, but you can see and interact with files in your editor.
13+
14+
### Getting Started
15+
16+
As of Zed Stable v0.201.5 you should be able to use Gemini CLI directly from Zed. First open the agent panel with {#kb agent::ToggleFocus}, and then use the `+` button in the top right to start a New Gemini CLI thread.
17+
18+
If you'd like to bind this to a keyboard shortcut, you can do so by editing your keybindings file to include:
19+
20+
```json
21+
[
22+
{
23+
"bindings": {
24+
"cmd-alt-g": ["agent::NewExternalAgentThread", { "agent": "gemini" }]
25+
}
26+
}
27+
]
28+
```
29+
30+
#### Installation
31+
32+
If you don't yet have Gemini CLI installed, then Zed will install a version for you. If you do, then we will use the version of Gemini CLI on your path.
33+
34+
You need to be running at least Gemini version `0.2.0-preview`, and if your version of Gemini is too old you will see an
35+
error message.
36+
37+
The instructions to upgrade Gemini depend on how you originally installed it, but typically, running `npm install -g gemini-cli@preview` should work.
38+
39+
#### Authentication
40+
41+
After you have Gemini CLI running, you'll be prompted to choose your authentication method.
42+
43+
Most users should click the "Log in with Google". This will cause a browser window to pop-up and auth directly with Gemini CLI. Zed does not see your oauth or access tokens in this case.
44+
45+
You can also use the "Gemini API Key". If you select this, and have the `GEMINI_API_KEY` set, then we will use that. Otherwise Zed will prompt you for an API key which will be stored securely in your keychain, and used to start Gemini CLI from within Zed.
46+
47+
The "Vertex AI" option is for those who are using Vertex AI, and have already configured their environment correctly.
48+
49+
For more information, see the [Gemini CLI docs](https://github.com/google-gemini/gemini-cli/blob/main/docs/index.md).
50+
51+
### Usage
52+
53+
Similar to Zed's first-party agent, you can use Gemini CLI to do anything that you need.
54+
55+
You can @-mention files, recent threads, symbols, or fetch the web.
56+
57+
Note that some first-party agent features don't yet work with Gemini CLI: editing past messages, resuming threads from history, and checkpointing.
58+
We hope to add these features in the near future.
59+
60+
## Add Custom Agents {#add-custom-agents}
61+
62+
You can run any agent speaking ACP in Zed by changing your settings as follows:
63+
64+
```json
65+
{
66+
"agent_servers": {
67+
"Custom Agent": {
68+
"command": "node",
69+
"args": ["~/projects/agent/index.js", "--acp"],
70+
"env": {}
71+
}
72+
}
73+
}
74+
```
75+
76+
This can also be useful if you're in the middle of developing a new agent that speaks the protocol and you want to debug it.
77+
78+
## Debugging Agents
79+
80+
When using external agents in Zed, you can access the debug view via with `dev: open acp logs` from the Command Palette. This lets you see the messages being sent and received between Zed and the agent.
81+
82+
![The debug view for ACP logs.](https://zed.dev/img/acp/acp-logs.webp)

docs/src/ai/overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Learn how to get started using AI with Zed and all its capabilities.
66

77
- [Configuration](./configuration.md): Learn how to set up different language model providers like Anthropic, OpenAI, Ollama, Google AI, and more.
88

9+
- [External Agents](./external-agents.md): Learn how to plug in your favorite agent into Zed.
10+
911
- [Subscription](./subscription.md): Learn about Zed's hosted model service and other billing-related information.
1012

1113
- [Privacy and Security](./privacy-and-security.md): Understand how Zed handles privacy and security with AI features.

0 commit comments

Comments
 (0)