From 865560128b2113d51dbe315a69e266ea93e0fe85 Mon Sep 17 00:00:00 2001 From: shengyi Date: Sun, 12 Apr 2026 22:29:08 +0800 Subject: [PATCH 1/2] fix(acp): support agent-client-protocol v0.9.0 schema changes agent-client-protocol v0.9.0 upgraded to ACP schema v0.11.2 which removed the SessionConfigOption wrapper type. Config options are now bare SessionConfigOptionSelect/SessionConfigOptionBoolean instances. Use a conditional import to support both >=0.8.0 (with wrapper) and >=0.9.0 (without wrapper) so existing installs keep working while new installs resolve correctly. Fixes langchain-ai/deepagents#2678 --- libs/acp/deepagents_acp/server.py | 59 ++++++++++++++++++------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/libs/acp/deepagents_acp/server.py b/libs/acp/deepagents_acp/server.py index ecca9e34cb7..67f83942f62 100644 --- a/libs/acp/deepagents_acp/server.py +++ b/libs/acp/deepagents_acp/server.py @@ -38,7 +38,6 @@ PlanEntry, PromptCapabilities, ResourceContentBlock, - SessionConfigOption, SessionConfigOptionSelect, SessionConfigSelectOption, SessionModeState, @@ -48,6 +47,13 @@ ToolCallUpdate, ToolKind, ) + +try: + from acp.schema import SessionConfigOption +except ImportError: + # agent-client-protocol >=0.9.0 removed the SessionConfigOption wrapper; + # config options are now bare SessionConfigOptionSelect instances. + SessionConfigOption = None # type: ignore[assignment,misc] from deepagents import create_deep_agent from deepagents.backends import CompositeBackend, FilesystemBackend, StateBackend from langgraph.checkpoint.memory import MemorySaver @@ -135,14 +141,17 @@ def on_connect(self, conn: Client) -> None: """Store the client connection for sending session updates.""" self._conn = conn - def _build_config_options(self, session_id: str) -> list[SessionConfigOption]: + def _build_config_options( + self, + session_id: str, + ) -> list[SessionConfigOptionSelect]: """Build the list of session configuration options. Returns a list combining mode and model selectors if available. Modes are mapped to config options with category='mode'. Models are exposed as config options with category='model'. """ - config_options: list[SessionConfigOption] = [] + config_options: list[SessionConfigOptionSelect] = [] # Add mode selector if modes are configured if self._modes is not None: @@ -156,18 +165,18 @@ def _build_config_options(self, session_id: str) -> list[SessionConfigOption]: for mode in self._modes.available_modes ] - mode_config = SessionConfigOption( - root=SessionConfigOptionSelect( - id="mode", - name="Session Mode", - description="Controls how the agent requests permission", - category="mode", - type="select", - current_value=current_mode, - options=mode_options, - ) + mode_select = SessionConfigOptionSelect( + id="mode", + name="Session Mode", + description="Controls how the agent requests permission", + category="mode", + type="select", + current_value=current_mode, + options=mode_options, + ) + config_options.append( + SessionConfigOption(root=mode_select) if SessionConfigOption else mode_select, ) - config_options.append(mode_config) # Add model selector if models are configured if self._models is not None and len(self._models) > 0: @@ -181,18 +190,18 @@ def _build_config_options(self, session_id: str) -> list[SessionConfigOption]: for model in self._models ] - model_config = SessionConfigOption( - root=SessionConfigOptionSelect( - id="model", - name="Model", - description="The LLM model to use for this session", - category="model", - type="select", - current_value=current_model, - options=model_options, - ) + model_select = SessionConfigOptionSelect( + id="model", + name="Model", + description="The LLM model to use for this session", + category="model", + type="select", + current_value=current_model, + options=model_options, + ) + config_options.append( + SessionConfigOption(root=model_select) if SessionConfigOption else model_select, ) - config_options.append(model_config) return config_options From 22abe40c12e5f05ecd88f163f113135f36be607e Mon Sep 17 00:00:00 2001 From: Vivek Trivedy Date: Tue, 14 Apr 2026 22:51:26 -0400 Subject: [PATCH 2/2] ci: trigger CodeQL scan