You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -5,214 +5,30 @@ description: "Overview of the Agent Client Protocol architecture"
5
5
6
6
The Agent Client Protocol defines a standard interface for communication between AI agents and client applications. The architecture is designed to be flexible, extensible, and platform-agnostic.
Error handling is localized to maintain system stability:
123
-
- Tool failures don't crash sessions
124
-
- MCP server errors are isolated
125
-
- Network failures are recoverable
126
-
127
-
### Performance Optimization
128
-
129
-
Key areas for optimization:
130
-
1.**Streaming Buffers**: Chunk size tuning for message streams
131
-
2.**Tool Parallelization**: Concurrent tool execution where safe
132
-
3.**Session Caching**: Reuse of MCP server connections
133
-
4.**Content Deduplication**: Efficient handling of repeated resources
134
-
135
-
## Integration Patterns
136
-
137
-
### 1. MCP Server Integration
138
-
139
-
```rust
140
-
pubstructMcpServerConfig {
141
-
pubcommand:PathBuf,
142
-
pubargs:Vec<String>,
143
-
pubenv:Option<HashMap<String, String>>,
144
-
pubenabled_tools:Option<Vec<String>>,
145
-
}
146
-
```
147
-
148
-
Supports:
149
-
- Dynamic server spawning
150
-
- Tool whitelisting
151
-
- Environment isolation
152
-
153
-
### 2. Client Tool Mapping
154
-
155
-
```rust
156
-
pubstructClientTools {
157
-
pubrequest_permission:Option<McpToolId>,
158
-
pubwrite_text_file:Option<McpToolId>,
159
-
pubread_text_file:Option<McpToolId>,
160
-
}
161
-
```
162
-
163
-
Enables:
164
-
- Flexible tool implementation
165
-
- Platform-specific capabilities
166
-
- Security boundaries
167
-
168
-
### 3. Permission Flow
169
-
170
-
The architecture enforces a clear permission flow:
171
-
1. Agent requests operation
172
-
2. Protocol checks permission cache
173
-
3. If needed, client prompts user
174
-
4. Decision cached based on kind (`allowAlways`, etc.)
175
-
5. Operation proceeds or fails
176
-
177
-
## Extensibility Points
178
-
179
-
The architecture provides several extension mechanisms:
12
+
1.**MCP-based**: The protocol is built on JSON-RPC, and re-uses MCP types where possible so that integrators don't need to build yet-another representation for common data types.
13
+
2.**UX-first**: It is designed to solve the UX challenges of interacting with AI agents; ensuring there's enough flexibility to render clearly the agents intent, but is no more abstract than it needs to be.
14
+
3.**Trusted**: ACP works when you're using a code editor to talk to a model you trust. You still have controls over the agent's tool calls, but the code editor gives the agent access to local files and MCP servers.
180
15
181
-
### 1. Custom Content Types
182
-
New `ContentBlock` variants can be added without breaking existing clients
16
+
## Setup
183
17
184
-
### 2. Tool Categories
185
-
The `ToolKind` enum can be extended for new operation types
18
+
When the user tries to connect to an agent, the editor boots the agent sub-process on demand, and all communication happens over stdin/stdout.
186
19
187
-
### 3. Session Updates
188
-
New `SessionUpdate` variants enable protocol evolution
20
+
Each connection can suppport several concurrent sessions, so you can have multiple trains of thought going on at once.
189
21
190
-
### 4. Annotations
191
-
The `Annotations` type allows metadata extension without schema changes
ACP makes heavy use of JSON-RPC notifications to allow the agent to stream updates to the UI in real-time. It also uses JSON-RPC's bidrectional requests to allow the agent to make requests of the code editor: for example to request permissions for a tool call.
194
25
195
-
### Principle of Least Privilege
196
-
- Tools are explicitly granted through `enabled_tools`
197
-
- File operations require specific client tool mappings
198
-
- Permissions are granular and auditable
26
+
## MCP
199
27
200
-
### Isolation Boundaries
201
-
- Sessions cannot interact with each other
202
-
- MCP servers run in separate processes
203
-
- File access is mediated through client tools
28
+
Commonly the code editor will have user-configured MCP servers. When forwarding the prompt from the user, it passes configuration for these to the agent. This allows the agent to connect directly to the MCP server.
The code editor may itself also wish to export MCP based tools. Instead of trying to run MCP and ACP on the same socket, the code editor can provide its own MCP server as configuration. As agents may only support MCP over stdio, the code editor can provide a small proxy that tunnels requests back to itself:
213
33
214
-
The architecture is designed to accommodate:
215
-
-**Multiplexed Sessions**: Multiple agents in one session
Copy file name to clipboardExpand all lines: docs/overview/introduction.mdx
+20-16Lines changed: 20 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,9 @@ title: "Introduction"
3
3
description: "Get started with the Agent Client Protocol (ACP)"
4
4
---
5
5
6
-
The Agent Client Protocol (ACP) is a protocol that standardizes communication between code editors (interactive programs for viewing and editing source code) and coding agents (programs that use generative AI to autonomously modify code).
6
+
The Agent Client Protocol standardizes communication between code editors (IDEs, text-editors, etc.) and coding agents (programs that use generative AI to autonomously modify code).
7
7
8
-
The protocol is still under heavy development, and we aim to standardize it as we get confidence in the design by implementing it in various settings.
8
+
The protocol is still under development, but it should be complete enough to build interesting user experiences using it.
9
9
10
10
## Why ACP?
11
11
@@ -21,22 +21,26 @@ This decoupling allows both sides to innovate independently while giving develop
21
21
22
22
## Overview
23
23
24
-
The protocol is newline-delimited JSON sent over stdin/stdout. When a code editorwants to start a session with an agent, it boots it as a sub-process (inheriting any environment variables) and sends an initialize request to get the state of the world.
24
+
ACP assumes that the user is primarily in their editor, and wants to reach out and use agents to assist them with specific tasks.
25
25
26
-
If authentication is required, it can send authenticate to allow the agent to perform any authentication actions (like an Oauth flow).
26
+
Agents run as sub-processes of the code editor, and communicate using JSON-RPC over stdio. The protocol re-uses the JSON representations used in MCP where possible, but includes custom types for things like Diffs that are useful for agentic coding.
27
27
28
-
Once the agent is ready, the client can send sendUserMessage requests with content from the user. The agent sends streamAssistantMessageChunk and related tool call messages to update the UI while handling the user's message, and finally responds when there will be no more output.
28
+
The default format for user-readable text is Markdown, which allows enough flexibility to represent rich formatting without requiring that the code editor is capable of rendering HTML.
29
29
30
-
## Architecture
30
+
## Implementations
31
31
32
-
ACP follows a simple client-server architecture where the client (typically a code editor or IDE) spawns the agent as a subprocess and communicates via standard input/output streams. The protocol uses newline-delimited JSON-RPC 2.0 messages, ensuring compatibility with existing tooling and easy debugging. The client maintains control over the agent's lifecycle and can manage multiple concurrent sessions. Each session represents an isolated conversation context where the agent can access editor-provided tools for reading files, writing changes, and requesting user permissions for sensitive operations.
32
+
Currently ACP is supported by:
33
33
34
-
```
35
-
┌─────────────────┐ ┌─────────────────┐
36
-
│ │ │ │
37
-
│ Client │ stdin/stdout │ Agent │
38
-
│ (IDE) │ ←────────────────→ │ (AI Tool) │
39
-
│ │ JSON-RPC 2.0 │ │
40
-
│ │ │ │
41
-
└─────────────────┘ └─────────────────┘
42
-
```
34
+
### Editors
35
+
36
+
-[Zed](https://zed.dev)
37
+
-[neovim](https://neovim.io) if you install the [CodeCompanion](https://codecompanion.olimorris.dev) plugin.
0 commit comments