Skip to content

Commit e1070c4

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

10 files changed

Lines changed: 558 additions & 11 deletions

File tree

docs/protocol/schema.mdx

Lines changed: 138 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ Response from loading an existing session.
232232

233233
<ResponseField name="_meta" type={"object"} >
234234
Extension point for implementations
235+
</ResponseField>
236+
<ResponseField name="models" type={<><span><a href="#sessionmodelstate">SessionModelState</a></span><span> | null</span></>} >
237+
**UNSTABLE**
238+
239+
This capability is not part of the spec yet, and may be removed or changed at any point.
240+
241+
Initial model state if supported by the Agent
242+
235243
</ResponseField>
236244
<ResponseField name="modes" type={<><span><a href="#sessionmodestate">SessionModeState</a></span><span> | null</span></>} >
237245
Initial mode state if supported by the Agent
@@ -300,6 +308,14 @@ See protocol docs: [Creating a Session](https://agentclientprotocol.com/protocol
300308

301309
<ResponseField name="_meta" type={"object"} >
302310
Extension point for implementations
311+
</ResponseField>
312+
<ResponseField name="models" type={<><span><a href="#sessionmodelstate">SessionModelState</a></span><span> | null</span></>} >
313+
**UNSTABLE**
314+
315+
This capability is not part of the spec yet, and may be removed or changed at any point.
316+
317+
Initial model state if supported by the Agent
318+
303319
</ResponseField>
304320
<ResponseField name="modes" type={<><span><a href="#sessionmodestate">SessionModeState</a></span><span> | null</span></>} >
305321
Initial mode state if supported by the Agent
@@ -439,6 +455,57 @@ Response to `session/set_mode` method.
439455

440456
<ResponseField name="meta" type={"object"}></ResponseField>
441457

458+
<a id="session-set_model"></a>
459+
### <span class="font-mono">session/set_model</span>
460+
461+
**UNSTABLE**
462+
463+
This capability is not part of the spec yet, and may be removed or changed at any point.
464+
465+
Select a model for a given session.
466+
467+
#### <span class="font-mono">SessionSetModelRequest</span>
468+
469+
**UNSTABLE**
470+
471+
This capability is not part of the spec yet, and may be removed or changed at any point.
472+
473+
Request parameters for setting a session model.
474+
475+
**Type:** Object
476+
477+
**Properties:**
478+
479+
<ResponseField name="_meta" type={"object"}>
480+
Extension point for implementations
481+
</ResponseField>
482+
<ResponseField name="modelId" type={<a href="#modelid">ModelId</a>} required>
483+
The ID of the model to set.
484+
</ResponseField>
485+
<ResponseField
486+
name="sessionId"
487+
type={<a href="#sessionid">SessionId</a>}
488+
required
489+
>
490+
The ID of the session to set the model for.
491+
</ResponseField>
492+
493+
#### <span class="font-mono">SessionSetModelResponse</span>
494+
495+
**UNSTABLE**
496+
497+
This capability is not part of the spec yet, and may be removed or changed at any point.
498+
499+
Response to `session/set_model` method.
500+
501+
**Type:** Object
502+
503+
**Properties:**
504+
505+
<ResponseField name="_meta" type={"object"}>
506+
Extension point for implementations
507+
</ResponseField>
508+
442509
## Client
443510

444511
Defines the interface that ACP-compliant clients must implement.
@@ -541,7 +608,7 @@ Only available if the client supports the `fs.writeTextFile` capability.
541608

542609
#### <span class="font-mono">WriteTextFileResponse</span>
543610

544-
Response to fs/write_text_file
611+
Response to `fs/write_text_file`
545612

546613
**Type:** Object
547614

@@ -1093,7 +1160,7 @@ Information about a command.
10931160
Input for the command if required
10941161
</ResponseField>
10951162
<ResponseField name="name" type={"string"} required>
1096-
Command name (e.g., "create_plan", "research_codebase").
1163+
Command name (e.g., `create_plan`, `research_codebase`).
10971164
</ResponseField>
10981165

10991166
## <span class="font-mono">AvailableCommandInput</span>
@@ -1622,6 +1689,38 @@ All Agents MUST support this transport.
16221689
</Expandable>
16231690
</ResponseField>
16241691

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

16271726
An option presented to the user when requesting permission.
@@ -1998,6 +2097,43 @@ The set of modes and the one currently active.
19982097
The current mode the Agent is in.
19992098
</ResponseField>
20002099

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

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

rust/acp.rs

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

237+
#[cfg(feature = "unstable")]
238+
async fn set_session_model(
239+
&self,
240+
args: SessionSetModelRequest,
241+
) -> Result<SessionSetModelResponse, Error> {
242+
self.conn
243+
.request(
244+
SESSION_SET_MODEL_METHOD_NAME,
245+
Some(ClientRequest::ModelSelectRequest(args)),
246+
)
247+
.await
248+
}
249+
237250
async fn ext_method(&self, args: ExtRequest) -> Result<ExtResponse, Error> {
238251
self.conn
239252
.request(
@@ -667,6 +680,11 @@ impl<T: Agent> MessageHandler<AgentSide> for T {
667680
let response = self.set_session_mode(args).await?;
668681
Ok(AgentResponse::SetSessionModeResponse(response))
669682
}
683+
#[cfg(feature = "unstable")]
684+
ClientRequest::ModelSelectRequest(args) => {
685+
let response = self.set_session_model(args).await?;
686+
Ok(AgentResponse::ModelSelectResponse(response))
687+
}
670688
ClientRequest::ExtMethodRequest(args) => {
671689
let response = self.ext_method(args).await?;
672690
Ok(AgentResponse::ExtMethodResponse(response))

0 commit comments

Comments
 (0)