Skip to content

Commit f5e884a

Browse files
committed
Unstable support for model selection
Signed-off-by: Ben Brandt <benjamin.j.brandt@gmail.com>
1 parent 4f58953 commit f5e884a

10 files changed

Lines changed: 561 additions & 19 deletions

File tree

docs/protocol/schema.mdx

Lines changed: 141 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/ini
113113
<ResponseField name="agentCapabilities" type={<a href="#agentcapabilities">AgentCapabilities</a>} >
114114
Capabilities supported by the agent.
115115

116-
- Default: `{"loadSession":false,"mcpCapabilities":{"http":false,"sse":false},"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false}}`
116+
- Default: `{"loadSession":false,"mcpCapabilities":{"http":false,"sse":false},"modelSelection":false,"promptCapabilities":{"audio":false,"embeddedContext":false,"image":false}}`
117117

118118
</ResponseField>
119119
<ResponseField name="authMethods" type={<><span><a href="#authmethod">AuthMethod</a></span><span>[]</span></>} >
@@ -130,6 +130,57 @@ The client should disconnect, if it doesn't support this version.
130130

131131
</ResponseField>
132132

133+
<a id="model-select"></a>
134+
### <span class="font-mono">model/select</span>
135+
136+
**UNSTABLE**
137+
138+
This capability is not part of the spec yet, and may be removed or changed at any point.
139+
140+
Select a model for a given session.
141+
142+
#### <span class="font-mono">ModelSelectRequest</span>
143+
144+
**UNSTABLE**
145+
146+
This capability is not part of the spec yet, and may be removed or changed at any point.
147+
148+
Request parameters for setting a session model.
149+
150+
**Type:** Object
151+
152+
**Properties:**
153+
154+
<ResponseField name="_meta" type={"object"}>
155+
Extension point for implementations
156+
</ResponseField>
157+
<ResponseField name="modelId" type={<a href="#modelid">ModelId</a>} required>
158+
The ID of the model to set.
159+
</ResponseField>
160+
<ResponseField
161+
name="sessionId"
162+
type={<a href="#sessionid">SessionId</a>}
163+
required
164+
>
165+
The ID of the session to set the model for.
166+
</ResponseField>
167+
168+
#### <span class="font-mono">ModelSelectResponse</span>
169+
170+
**UNSTABLE**
171+
172+
This capability is not part of the spec yet, and may be removed or changed at any point.
173+
174+
Response to `model/select` method.
175+
176+
**Type:** Object
177+
178+
**Properties:**
179+
180+
<ResponseField name="_meta" type={"object"}>
181+
Extension point for implementations
182+
</ResponseField>
183+
133184
<a id="session-cancel"></a>
134185
### <span class="font-mono">session/cancel</span>
135186

@@ -300,6 +351,14 @@ See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol
300351

301352
<ResponseField name="_meta" type={"object"} >
302353
Extension point for implementations
354+
</ResponseField>
355+
<ResponseField name="models" type={<><span><a href="#sessionmodelstate">SessionModelState</a></span><span> | null</span></>} >
356+
**UNSTABLE**
357+
358+
This capability is not part of the spec yet, and may be removed or changed at any point.
359+
360+
Initial model state if supported by the Agent
361+
303362
</ResponseField>
304363
<ResponseField name="modes" type={<><span><a href="#sessionmodestate">SessionModeState</a></span><span> | null</span></>} >
305364
Initial mode state if supported by the Agent
@@ -541,7 +600,7 @@ Only available if the client supports the `fs.writeTextFile` capability.
541600

542601
#### <span class="font-mono">WriteTextFileResponse</span>
543602

544-
Response to fs/write_text_file
603+
Response to `fs/write_text_file`
545604

546605
**Type:** Object
547606

@@ -986,6 +1045,16 @@ See protocol docs: [Agent Capabilities](https://agentclientprotocol.com/protocol
9861045

9871046
- Default: `{"http":false,"sse":false}`
9881047

1048+
</ResponseField>
1049+
<ResponseField name="modelSelection" type={"boolean"} >
1050+
**UNSTABLE**
1051+
1052+
This capability is not part of the spec yet, and may be removed or changed at any point.
1053+
1054+
Whether the agent supports `model/*`.
1055+
1056+
- Default: `false`
1057+
9891058
</ResponseField>
9901059
<ResponseField name="promptCapabilities" type={<a href="#promptcapabilities">PromptCapabilities</a>} >
9911060
Prompt capabilities supported by the agent.
@@ -1093,7 +1162,7 @@ Information about a command.
10931162
Input for the command if required
10941163
</ResponseField>
10951164
<ResponseField name="name" type={"string"} required>
1096-
Command name (e.g., "create_plan", "research_codebase").
1165+
Command name (e.g., `create_plan`, `research_codebase`).
10971166
</ResponseField>
10981167

10991168
## <span class="font-mono">AvailableCommandInput</span>
@@ -1622,6 +1691,38 @@ All Agents MUST support this transport.
16221691
</Expandable>
16231692
</ResponseField>
16241693

1694+
## <span class="font-mono">ModelId</span>
1695+
1696+
**UNSTABLE**
1697+
1698+
This capability is not part of the spec yet, and may be removed or changed at any point.
1699+
1700+
A unique identifier for a model.
1701+
1702+
**Type:** `string`
1703+
1704+
## <span class="font-mono">ModelInfo</span>
1705+
1706+
**UNSTABLE**
1707+
1708+
This capability is not part of the spec yet, and may be removed or changed at any point.
1709+
1710+
Information about a selectable model.
1711+
1712+
**Type:** Object
1713+
1714+
**Properties:**
1715+
1716+
<ResponseField name="_meta" type={"object"}>
1717+
Extension point for implementations
1718+
</ResponseField>
1719+
<ResponseField name="modelId" type={<a href="#modelid">ModelId</a>} required>
1720+
Unique identifier for the model.
1721+
</ResponseField>
1722+
<ResponseField name="name" type={"string"} required>
1723+
Human-readable name of the model.
1724+
</ResponseField>
1725+
16251726
## <span class="font-mono">PermissionOption</span>
16261727

16271728
An option presented to the user when requesting permission.
@@ -1998,6 +2099,43 @@ The set of modes and the one currently active.
19982099
The current mode the Agent is in.
19992100
</ResponseField>
20002101

2102+
## <span class="font-mono">SessionModelState</span>
2103+
2104+
**UNSTABLE**
2105+
2106+
This capability is not part of the spec yet, and may be removed or changed at any point.
2107+
2108+
The set of models and the one currently active.
2109+
2110+
**Type:** Object
2111+
2112+
**Properties:**
2113+
2114+
<ResponseField name="_meta" type={"object"}>
2115+
Extension point for implementations
2116+
</ResponseField>
2117+
<ResponseField
2118+
name="availableModels"
2119+
type={
2120+
<>
2121+
<span>
2122+
<a href="#modelinfo">ModelInfo</a>
2123+
</span>
2124+
<span>[]</span>
2125+
</>
2126+
}
2127+
required
2128+
>
2129+
The set of models that the Agent can use
2130+
</ResponseField>
2131+
<ResponseField
2132+
name="currentModelId"
2133+
type={<a href="#modelid">ModelId</a>}
2134+
required
2135+
>
2136+
The current model the Agent is in.
2137+
</ResponseField>
2138+
20012139
## <span class="font-mono">SessionUpdate</span>
20022140

20032141
Different types of updates that can be sent during session processing.

rust/acp.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ impl Agent for ClientSideConnection {
234234
)
235235
}
236236

237+
#[cfg(feature = "unstable")]
238+
async fn select_model(&self, args: ModelSelectRequest) -> Result<ModelSelectResponse, Error> {
239+
self.conn
240+
.request(
241+
MODEL_SELECT_METHOD_NAME,
242+
Some(ClientRequest::ModelSelectRequest(args)),
243+
)
244+
.await
245+
}
246+
237247
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
238248
self.conn
239249
.request(
@@ -667,6 +677,11 @@ impl<T: Agent> MessageHandler<AgentSide> for T {
667677
let response = self.set_session_mode(args).await?;
668678
Ok(AgentResponse::SetSessionModeResponse(response))
669679
}
680+
#[cfg(feature = "unstable")]
681+
ClientRequest::ModelSelectRequest(args) => {
682+
let response = self.select_model(args).await?;
683+
Ok(AgentResponse::ModelSelectResponse(response))
684+
}
670685
ClientRequest::ExtMethodRequest(args) => {
671686
let response = self.ext_method(args).await?;
672687
Ok(AgentResponse::ExtMethodResponse(response))

0 commit comments

Comments
 (0)