From abc9e7fdfb2b0ff634e0c228f6cebb4f474d3d19 Mon Sep 17 00:00:00 2001 From: andreivince Date: Sat, 21 Nov 2026 17:07:12 -0500 Subject: [PATCH] fix(examples): return the agent's protocol version from initialize The echo agents returned whatever version the client asked for. The spec says an agent that does not support the requested version must answer with the latest version it supports, so return PROTOCOL_VERSION like examples/agent.py does. --- examples/echo_agent.py | 3 ++- examples/http_server.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/echo_agent.py b/examples/echo_agent.py index c94c9691..090a0974 100644 --- a/examples/echo_agent.py +++ b/examples/echo_agent.py @@ -9,6 +9,7 @@ from uuid import uuid4 from acp import ( + PROTOCOL_VERSION, Agent, InitializeResponse, NewSessionResponse, @@ -44,7 +45,7 @@ async def initialize( client_info: Implementation | None = None, **kwargs: Any, ) -> InitializeResponse: - return InitializeResponse(protocol_version=protocol_version) + return InitializeResponse(protocol_version=PROTOCOL_VERSION) async def new_session( self, diff --git a/examples/http_server.py b/examples/http_server.py index 8a4fd774..4eeebbab 100644 --- a/examples/http_server.py +++ b/examples/http_server.py @@ -21,6 +21,7 @@ from uuid import uuid4 from acp import ( + PROTOCOL_VERSION, Agent, InitializeResponse, NewSessionResponse, @@ -44,7 +45,7 @@ async def initialize( client_info: Implementation | None = None, **kwargs: Any, ) -> InitializeResponse: - return InitializeResponse(protocol_version=protocol_version) + return InitializeResponse(protocol_version=PROTOCOL_VERSION) async def new_session(self, cwd: str = "", **kwargs: Any) -> NewSessionResponse: return NewSessionResponse(session_id=uuid4().hex)