Skip to content

Commit 662c5fa

Browse files
committed
Document initialization
1 parent d942e28 commit 662c5fa

1 file changed

Lines changed: 104 additions & 1 deletion

File tree

docs/protocol/initialization.mdx

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,107 @@ title: "Initialization"
33
description: "How all ACP connections begin"
44
---
55

6-
This page will document the initialization process for the Agent Client Protocol.
6+
{/* todo! link to all concepts */}
7+
8+
9+
The Initialization phase allows [Clients](../overview/client) and [Agents](../overview/agent) to negotiate protocol versions, capabilities, and authentication methods.
10+
11+
Before a Session can be created, Clients **MUST** initialize the connection by calling the `initialize method` with:
12+
13+
- The latest protocol version supported
14+
- The capabilities supported
15+
16+
17+
```json
18+
{
19+
"jsonrpc": "2.0",
20+
"id": 0,
21+
"method": "initialize",
22+
"params": {
23+
"protocol_version": 1,
24+
"client_capabilities": {
25+
"fs": {
26+
"read_text_file": true,
27+
"write_text_file": true
28+
}
29+
}
30+
}
31+
}
32+
```
33+
34+
The Agent **MUST** respond with the chosen protocol version and the capabilities it supports:
35+
36+
37+
```json
38+
{
39+
"jsonrpc": "2.0",
40+
"id": 0,
41+
"result": {
42+
"protocol_version": 1,
43+
"agent_capabilities": {
44+
"load_session": true,
45+
"prompt_capabilities": {
46+
"image": true,
47+
"audio": true,
48+
"embedded_context": true
49+
}
50+
}
51+
}
52+
}
53+
```
54+
55+
## Protocol version
56+
57+
The protocol versions that appear in the `initialize` requests and responses are a single integer that identifies a **MAJOR** protocol version. This version is only incremented when breaking changes are introduced.
58+
59+
Clients and Agents **MUST** agree on a protocol version and act according to its specification.
60+
61+
See [Capabilities](#capabilities) to learn how non-breaking features are introduced.
62+
63+
### Version Negotiation
64+
65+
The `initialize` request **MUST** include the latest protocol version the Client supports.
66+
67+
If the Agent supports the requested version, it **MUST** respond with the same version. Otherwise, the server **MUST** respond with latest version it supports.
68+
69+
If the Client does not support the version specified by the Agent in the `initialize` response, the Client **SHOULD** close the connection and inform the User about it.
70+
71+
72+
## Capabilities
73+
74+
Capabilities describe features supported by the Client and the Agent.
75+
76+
All capabilities included in the `initialize` request are **OPTIONAL**. Clients and Agents **SHOULD** support all possible combinations of their peer's capabilities.
77+
78+
The introduction of new capabilities is not considered a breaking change. Therefore, Clients and Agents **MUST** treat all capabilities omitted in the `initialize` request as **UNSUPPORTED**.
79+
80+
Capabilities are high-level and are not attached to a specific base protocol concept.
81+
82+
Capabilities may specify the availability of protocol methods, notifications, or a subset of their parameters. They may also signal behaviors of the Agent or Client implementation.
83+
84+
85+
### Client Capabilities
86+
87+
The Client **SHOULD** specify whether it supports the following capability.
88+
89+
#### FileSystem
90+
91+
The Client **MAY** expose its FileSystem abstraction to various degrees. This may allow Agents to access unsaved buffer state, and Clients to track Agent changes directly.
92+
93+
- `read_text_file`: The `fs/read_text_file` method is available.
94+
- `write_text_file`: The `fs/write_text_file` method is available.
95+
96+
### Agent Capabilities
97+
98+
The Agent **SHOULD** specify whether it supports the following capabilities.
99+
100+
- `load_session`: The `session/load` method is available.
101+
- `prompt_capabilities`: Object indicating the different types of content that may be included in `session/prompt` requests.
102+
103+
#### Prompt capabilities
104+
105+
As a baseline, all Agents **MUST** support `session/prompt` containing the `ContentBlock::Text` and `ContentBlock::ResourceLink`, but they **MAY** opt in to richer types of content by specifying the following capabilities:
106+
107+
- `image`: The prompt may include `ContentBlock::Image`
108+
- `audio`: The prompt may include `ContentBlock::Audio`
109+
- `embedded_context`: The prompt may include `ContentBlock::EmbeddedResource`

0 commit comments

Comments
 (0)