Skip to content

Commit abc9e7f

Browse files
committed
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.
1 parent 0459667 commit abc9e7f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎examples/echo_agent.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from uuid import uuid4
1010

1111
from acp import (
12+
PROTOCOL_VERSION,
1213
Agent,
1314
InitializeResponse,
1415
NewSessionResponse,
@@ -44,7 +45,7 @@ async def initialize(
4445
client_info: Implementation | None = None,
4546
**kwargs: Any,
4647
) -> InitializeResponse:
47-
return InitializeResponse(protocol_version=protocol_version)
48+
return InitializeResponse(protocol_version=PROTOCOL_VERSION)
4849

4950
async def new_session(
5051
self,

‎examples/http_server.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from uuid import uuid4
2222

2323
from acp import (
24+
PROTOCOL_VERSION,
2425
Agent,
2526
InitializeResponse,
2627
NewSessionResponse,
@@ -44,7 +45,7 @@ async def initialize(
4445
client_info: Implementation | None = None,
4546
**kwargs: Any,
4647
) -> InitializeResponse:
47-
return InitializeResponse(protocol_version=protocol_version)
48+
return InitializeResponse(protocol_version=PROTOCOL_VERSION)
4849

4950
async def new_session(self, cwd: str = "", **kwargs: Any) -> NewSessionResponse:
5051
return NewSessionResponse(session_id=uuid4().hex)

0 commit comments

Comments
 (0)